34namespace Gecode {
namespace Float {
namespace Trigonometric {
42 #define I0__PI_2I FloatVal(0,pi_half_upper())
43 #define POS(X) ((I0__PI_2I.in(X))?0:1)
44 #define ATANINF_DOWN r.atan_down(aTanIv.min())
45 #define ATANSUP_UP r.atan_up(aTanIv.max())
49 switch (
POS(iv_min) )
52 if (
r.tan_down(iv_min) > aTanIv.max()) { n_min++; iv_min =
ATANINF_DOWN; }
53 else if (
r.tan_up(iv_min) < aTanIv.min()) { iv_min =
ATANINF_DOWN; }
56 if (
r.tan_down(iv_min) > aTanIv.max()) { n_min+=2; iv_min =
ATANINF_DOWN; }
57 else if (
r.tan_up(iv_min) < aTanIv.min()) { n_min++; iv_min =
ATANINF_DOWN; }
66 switch (
POS(iv_max) )
69 if (
r.tan_down(iv_max) > aTanIv.max()) { iv_max =
ATANSUP_UP; }
70 else if (
r.tan_up(iv_max) < aTanIv.min()) { n_max--; iv_max =
ATANSUP_UP; }
73 if (
r.tan_down(iv_max) > aTanIv.max()) { n_max++; iv_max =
ATANSUP_UP; }
74 else if (
r.tan_up(iv_max) < aTanIv.min()) { iv_max =
ATANSUP_UP; }
91 template<
class A,
class B>
99 #define I0__PI_2I FloatVal(0,pi_half_upper())
104 n_min =
static_cast<int>(
r.div_up(x0.min(),
pi_upper()));
105 n_max =
static_cast<int>(
r.div_up(x0.max(),
pi_upper()));
112 if (
r.tan_down(x0_min) > x0_min) n_min++;
113 t =
r.add_down(
r.mul_up(n_min,
pi_upper()),
r.tan_down(x0_min));
114 }
while (
t > x0_min);
115 t =
r.sub_down(
r.mul_up(2*n_max,
pi_upper()),x0.max());
118 if (
r.tan_down(x0_max) < x0_max) n_max--;
119 t =
r.add_up(
r.mul_up(n_max,
pi_upper()),
r.tan_up(x0_max));
120 }
while (
t > x0_max);
121 x0_max =
r.sub_up(
r.mul_up(2*n_max,
pi_upper()),x0_max);
127 n_min =
static_cast<int>(
r.div_up(x0.min(),
pi_upper()));
128 n_max =
static_cast<int>(
r.div_up(x0.max(),
pi_upper()));
129 if (x0.min() < 0) n_min--;
130 if (x0.max() < 0) n_max--;
136 if (n_iv_min > n_iv_max)
return ES_FAILED;
144 template<
class A,
class B>
149 template<
class A,
class B>
153 #define I0__PI_2I FloatVal(0,pi_half_upper())
159 (void)
new (home)
Tan<A,B>(home,x0,x1);
163 template<
class A,
class B>
168 template<
class A,
class B>
171 return new (home)
Tan<A,B>(home,*
this);
174 template<
class A,
class B>
186 template<
class A,
class B>
191 template<
class A,
class B>
205 template<
class A,
class B>
210 template<
class A,
class B>
216 template<
class A,
class B>
int p
Number of positive literals for node type.
Base-class for both propagators and branchers.
Floating point rounding policy.
Propagator for bounds consistent arc tangent operator
virtual Actor * copy(Space &home)
Create copy during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
ATan(Space &home, ATan &p)
Constructor for cloning p.
Propagator for bounds consistent tangent operator
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
static ExecStatus dopropagate(Space &home, A x0, B x1)
Perform actual propagation.
virtual Actor * copy(Space &home)
Create copy during cloning.
Tan(Space &home, Tan &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
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.
double FloatNum
Floating point number base type.
void aTanProject(Rounding &r, const V &aTanIv, 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
FloatNum pi_upper(void)
Return upper bound of .
Post propagator for SetVar SetOpType SetVar SetRelType r
FloatNum pi_half_upper(void)
Return upper bound of .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
#define GECODE_NEVER
Assert that this command is never executed.