Go to the documentation of this file.
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) )
62 if (
r.sin_down(iv_min) > aSinIv.max()) { n_min++; iv_min = -
ASINSUP_UP; }
63 else if (
r.sin_up(iv_min) < aSinIv.min()) { iv_min =
ASININF_DOWN; }
66 if (
r.sin_down(iv_min) > aSinIv.max()) { n_min++; iv_min = -
ASINSUP_UP; }
67 else if (
r.sin_up(iv_min) < aSinIv.min()) { n_min+=2; iv_min =
ASININF_DOWN; }
70 if (
r.sin_down(iv_min) > aSinIv.max()) { n_min++; iv_min = -
ASINSUP_UP; }
71 else if (
r.sin_up(iv_min) < aSinIv.min()) { n_min+=2; iv_min =
ASININF_DOWN; }
74 if (
r.sin_down(iv_min) > aSinIv.max()) { n_min+=3; iv_min = -
ASINSUP_UP; }
75 else if (
r.sin_up(iv_min) < aSinIv.min()) { n_min+=2; iv_min =
ASININF_DOWN; }
86 switch (
POS(iv_max) )
89 if (
r.sin_down(iv_max) > aSinIv.max()) { iv_max =
ASINSUP_UP; }
90 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max--; iv_max = -
ASININF_DOWN; }
93 if (
r.sin_down(iv_max) > aSinIv.max()) { iv_max =
ASINSUP_UP; }
94 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max++; iv_max = -
ASININF_DOWN; }
97 if (
r.sin_down(iv_max) > aSinIv.max()) { iv_max =
ASINSUP_UP; }
98 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max++; iv_max = -
ASININF_DOWN; }
101 if (
r.sin_down(iv_max) > aSinIv.max()) { n_max+=2; iv_max =
ASINSUP_UP; }
102 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max++; iv_max = -
ASININF_DOWN; }
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>
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
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
void aSinProject(Rounding &r, const V &aSinIv, FloatNum &iv_min, FloatNum &iv_max, int &n_min, int &n_max)
ExecStatus ES_SUBSUMED(Propagator &p)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
bool same(const Item &i, const Item &j)
Whether two items are the same.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Base-class for both propagators and branchers.
Gecode toplevel namespace
Cos(Space &home, bool share, Cos &p)
Constructor for cloning p.
Home class for posting propagators
static FloatVal pi_half(void)
Return .
Post propagator for SetVar SetOpType SetVar SetRelType r
double FloatNum
Floating point number base type.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
FloatNum pi_upper(void)
Return upper bound of .
Floating point rounding policy.
#define GECODE_NEVER
Assert that this command is never executed.
Sin(Space &home, bool share, Sin &p)
Constructor for cloning p.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
Propagator for bounds consistent sinus operator
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
@ ES_FIX
Propagation has computed fixpoint.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
@ ES_FAILED
Execution has resulted in failure.
int ModEventDelta
Modification event deltas.
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
FloatNum pi_twice_upper(void)
Return upper bound of .