34namespace Gecode {
namespace Float {
namespace Trigonometric {
43 #define I0__PI_2I FloatVal(0,pi_half_upper())
44 #define IPI_2__PII FloatVal(pi_half_lower(),pi_upper())
45 #define IPI__3PI_2I FloatVal(pi_lower(),3*pi_half_upper())
46 #define I3PI_2__2PII FloatVal(3*pi_half_lower(),pi_twice_upper())
47 #define POS(X) ((I0__PI_2I.in(X))?0: (IPI_2__PII.in(X))?1: (IPI__3PI_2I.in(X))?2: 3 )
48 #define ASININF_DOWN r.asin_down(aSinIv.min())
49 #define ASINSUP_UP r.asin_up(aSinIv.max())
55 switch (
POS(iv_min) )
58 if (
r.sin_down(iv_min) > aSinIv.max()) { n_min++; iv_min = -
ASINSUP_UP; }
59 else if (
r.sin_up(iv_min) < aSinIv.min()) { iv_min =
ASININF_DOWN; }
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()) { n_min+=2; 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+=3; iv_min = -
ASINSUP_UP; }
71 else if (
r.sin_up(iv_min) < aSinIv.min()) { n_min+=2; iv_min =
ASININF_DOWN; }
82 switch (
POS(iv_max) )
85 if (
r.sin_down(iv_max) > aSinIv.max()) { iv_max =
ASINSUP_UP; }
86 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max--; iv_max = -
ASININF_DOWN; }
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()) { n_max+=2; iv_max =
ASINSUP_UP; }
98 else if (
r.sin_up(iv_max) < aSinIv.min()) { n_max++; iv_max = -
ASININF_DOWN; }
118 template<
class A,
class B>
125 if (x0.min() < 0) n_min-=2;
126 if (x0.max() < 0) n_max-=2;
132 if (n_iv_min > n_iv_max)
return ES_FAILED;
138 template<
class A,
class B>
143 template<
class A,
class B>
152 (void)
new (home)
Sin<A,B>(home,x0,x1);
159 template<
class A,
class B>
164 template<
class A,
class B>
167 return new (home)
Sin<A,B>(home,*
this);
170 template<
class A,
class B>
182 template<
class A,
class B>
190 if (x0Trans.
min() < 0) n_min-=2;
191 if (x0Trans.
max() < 0) n_max-=2;
197 if (n_iv_min > n_iv_max)
return ES_FAILED;
203 template<
class A,
class B>
208 template<
class A,
class B>
223 (void)
new (home)
Cos<A,B>(home,x0,x1);
229 template<
class A,
class B>
234 template<
class A,
class B>
237 return new (home)
Cos<A,B>(home,*
this);
240 template<
class A,
class B>
int p
Number of positive literals for node type.
Base-class for both propagators and branchers.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
static FloatVal pi_half(void)
Return .
Floating point rounding policy.
Propagator for bounds consistent cosinus operator
static ExecStatus dopropagate(Space &home, A x0, B x1)
Perform actual propagation.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Cos(Space &home, Cos &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Create copy during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for bounds consistent sinus operator
static ExecStatus dopropagate(Space &home, A x0, B x1)
Perform actual propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
virtual Actor * copy(Space &home)
Create copy during cloning.
Sin(Space &home, Sin &p)
Constructor for cloning p.
Home class for posting propagators
ExecStatus ES_SUBSUMED(Propagator &p)
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
double FloatNum
Floating point number base type.
void aSinProject(Rounding &r, const V &aSinIv, FloatNum &iv_min, FloatNum &iv_max, int &n_min, int &n_max)
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 .
FloatNum pi_upper(void)
Return upper bound of .
Post propagator for SetVar SetOpType SetVar SetRelType r
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum pi_twice_upper(void)
Return upper bound of .
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
#define GECODE_NEVER
Assert that this command is never executed.