38 namespace Gecode {
namespace Float {
namespace Trigonometric {
47 #define I0__PI_2I FloatVal(0,pi_half_upper())
48 #define IPI_2__PII FloatVal(pi_half_lower(),pi_upper())
49 #define IPI__3PI_2I FloatVal(pi_lower(),3*pi_half_upper())
50 #define I3PI_2__2PII FloatVal(3*pi_half_lower(),pi_twice_upper())
51 #define POS(X) ((I0__PI_2I.in(X))?0: (IPI_2__PII.in(X))?1: (IPI__3PI_2I.in(X))?2: 3 )
52 #define ASININF_DOWN r.asin_down(aSinIv.min())
53 #define ASINSUP_UP r.asin_up(aSinIv.max())
59 switch (
POS(iv_min) )
86 switch (
POS(iv_max) )
122 template<
class A,
class B>
127 template<
class A,
class B>
135 (void)
new (home)
Sin<A,B>(home,x0,x1);
142 template<
class A,
class B>
147 template<
class A,
class B>
150 return new (home)
Sin<A,B>(home,share,*
this);
153 template<
class A,
class B>
158 int n_min = 2*
static_cast<int>(r.div_up(x0.min(),
pi_twice_upper()));
159 int n_max = 2*
static_cast<int>(r.div_up(x0.max(),
pi_twice_upper()));
160 if (x0.min() < 0) n_min-=2;
161 if (x0.max() < 0) n_max-=2;
167 if (n_iv_min > n_iv_max)
return ES_FAILED;
178 template<
class A,
class B>
183 template<
class A,
class B>
197 (void)
new (home)
Cos<A,B>(home,x0,x1);
203 template<
class A,
class B>
208 template<
class A,
class B>
211 return new (home)
Cos<A,B>(home,share,*
this);
214 template<
class A,
class B>
222 if (x0Trans.
min() < 0) n_min-=2;
223 if (x0Trans.
max() < 0) n_max-=2;
229 if (n_iv_min > n_iv_max)
return ES_FAILED;
Propagator for bounds consistent cosinus operator
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntConLevel icl)
Post propagator for .
ExecStatus ES_SUBSUMED(Propagator &p)
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Sin(Space &home, bool share, Sin &p)
Constructor for cloning p.
void aSinProject(Rounding &r, const V &aSinIv, FloatNum &iv_min, FloatNum &iv_max, int &n_min, int &n_max)
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Propagation has computed fixpoint.
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
Base-class for both propagators and branchers.
int p
Number of positive literals for node type.
bool same(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether two views are the same.
FloatNum sin_up(FloatNum x)
Return upper bound of sine of x (domain: )
Execution has resulted in failure.
FloatNum pi_twice_upper(void)
Return upper bound of .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Floating point rounding policy.
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
static FloatVal pi_half(void)
Return .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for bounds consistent sinus operator
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Gecode toplevel namespace
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
friend FloatVal max(const FloatVal &x, const FloatVal &y)
int ModEventDelta
Modification event deltas.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Home class for posting propagators
double FloatNum
Floating point number base type.
#define GECODE_NEVER
Assert that this command is never executed.
Cos(Space &home, bool share, Cos &p)
Constructor for cloning p.
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: )
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
FloatNum pi_upper(void)
Return upper bound of .