this repo has no description
at develop 7.6 kB view raw
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2/* 3 * Main authors: 4 * Vincent Barichard <Vincent.Barichard@univ-angers.fr> 5 * 6 * Copyright: 7 * Vincent Barichard, 2012 8 * 9 * This file is part of Gecode, the generic constraint 10 * development environment: 11 * http://www.gecode.org 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining 14 * a copy of this software and associated documentation files (the 15 * "Software"), to deal in the Software without restriction, including 16 * without limitation the rights to use, copy, modify, merge, publish, 17 * distribute, sublicense, and/or sell copies of the Software, and to 18 * permit persons to whom the Software is furnished to do so, subject to 19 * the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be 22 * included in all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31 * 32 */ 33 34#ifndef GECODE_FLOAT_TRIGONOMETRIC_HH 35#define GECODE_FLOAT_TRIGONOMETRIC_HH 36 37#include <gecode/float.hh> 38 39/** 40 * \namespace Gecode::Float::Trigonometric 41 * \brief %Trigonometric propagators 42 */ 43namespace Gecode { namespace Float { namespace Trigonometric { 44 45 /** 46 * \brief %Propagator for bounds consistent sinus operator 47 * 48 * The types \a A and \a B give the types of the views. 49 * 50 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 51 * \ingroup FuncFloatProp 52 */ 53 template<class A, class B> 54 class Sin : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 55 protected: 56 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 57 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 58 /// Perform actual propagation 59 static ExecStatus dopropagate(Space& home, A x0, B x1); 60 /// Constructor for cloning \a p 61 Sin(Space& home, Sin& p); 62 /// Constructor for creation 63 Sin(Home home, A x0, B x1); 64 public: 65 /// Create copy during cloning 66 virtual Actor* copy(Space& home); 67 /// Perform propagation 68 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 69 /// Post propagator for \f$sin(x_0) = x_1\f$ 70 static ExecStatus post(Home home, A x0, B x1); 71 }; 72 73 74 /** 75 * \brief %Propagator for bounds consistent cosinus operator 76 * 77 * The types \a A and \a B give the types of the views. 78 * 79 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 80 * \ingroup FuncFloatProp 81 */ 82 template<class A, class B> 83 class Cos : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 84 protected: 85 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 86 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 87 /// Perform actual propagation 88 static ExecStatus dopropagate(Space& home, A x0, B x1); 89 /// Constructor for cloning \a p 90 Cos(Space& home, Cos& p); 91 /// Constructor for creation 92 Cos(Home home, A x0, B x1); 93 public: 94 /// Create copy during cloning 95 virtual Actor* copy(Space& home); 96 /// Perform propagation 97 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 98 /// Post propagator for \f$cos(x_0) = x_1\f$ 99 static ExecStatus post(Home home, A x0, B x1); 100 }; 101 102 /** 103 * \brief %Propagator for bounds consistent arc sinus operator 104 * 105 * The types \a A and \a B give the types of the views. 106 * 107 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 108 * \ingroup FuncFloatProp 109 */ 110 template<class A, class B> 111 class ASin : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 112 protected: 113 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 114 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 115 116 /// Constructor for cloning \a p 117 ASin(Space& home, ASin& p); 118 /// Constructor for creation 119 ASin(Home home, A x0, B x1); 120 public: 121 /// Create copy during cloning 122 virtual Actor* copy(Space& home); 123 /// Perform propagation 124 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 125 /// Post propagator for \f$asin(x_0) = x_1\f$ 126 static ExecStatus post(Home home, A x0, B x1); 127 }; 128 129 130 /** 131 * \brief %Propagator for bounds consistent arc cosinus operator 132 * 133 * The types \a A and \a B give the types of the views. 134 * 135 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 136 * \ingroup FuncFloatProp 137 */ 138 template<class A, class B> 139 class ACos : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 140 protected: 141 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 142 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 143 144 /// Constructor for cloning \a p 145 ACos(Space& home, ACos& p); 146 /// Constructor for creation 147 ACos(Home home, A x0, B x1); 148 public: 149 /// Create copy during cloning 150 virtual Actor* copy(Space& home); 151 /// Perform propagation 152 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 153 /// Post propagator for \f$acos(x_0) = x_1\f$ 154 static ExecStatus post(Home home, A x0, B x1); 155 }; 156 157 /** 158 * \brief %Propagator for bounds consistent tangent operator 159 * 160 * The types \a A and \a B give the types of the views. 161 * 162 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 163 * \ingroup FuncFloatProp 164 */ 165 template<class A, class B> 166 class Tan : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 167 protected: 168 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 169 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 170 /// Perform actual propagation 171 static ExecStatus dopropagate(Space& home, A x0, B x1); 172 /// Constructor for cloning \a p 173 Tan(Space& home, Tan& p); 174 /// Constructor for creation 175 Tan(Home home, A x0, B x1); 176 public: 177 /// Create copy during cloning 178 virtual Actor* copy(Space& home); 179 /// Perform propagation 180 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 181 /// Post propagator for \f$tan(x_0) = x_1\f$ 182 static ExecStatus post(Home home, A x0, B x1); 183 }; 184 185 /** 186 * \brief %Propagator for bounds consistent arc tangent operator 187 * 188 * The types \a A and \a B give the types of the views. 189 * 190 * Requires \code #include <gecode/float/trigonometric.hh> \endcode 191 * \ingroup FuncFloatProp 192 */ 193 template<class A, class B> 194 class ATan : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> { 195 protected: 196 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x0; 197 using MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>::x1; 198 199 /// Constructor for cloning \a p 200 ATan(Space& home, ATan& p); 201 /// Constructor for creation 202 ATan(Home home, A x0, B x1); 203 public: 204 /// Create copy during cloning 205 virtual Actor* copy(Space& home); 206 /// Perform propagation 207 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 208 /// Post propagator for \f$atan(x_0) = x_1\f$ 209 static ExecStatus post(Home home, A x0, B x1); 210 }; 211}}} 212 213#include <gecode/float/trigonometric/sincos.hpp> 214#include <gecode/float/trigonometric/asinacos.hpp> 215#include <gecode/float/trigonometric/tanatan.hpp> 216 217#endif 218 219// STATISTICS: float-prop