38 namespace Gecode {
namespace Float {
namespace Trigonometric {
46 #define I0__PI_2I FloatVal(0,pi_half_upper()) 47 #define POS(X) ((I0__PI_2I.in(X))?0:1) 48 #define ATANINF_DOWN r.atan_down(aTanIv.min()) 49 #define ATANSUP_UP r.atan_up(aTanIv.max()) 53 switch (
POS(iv_min) )
56 if (
r.tan_down(iv_min) > aTanIv.max()) { n_min++; iv_min =
ATANINF_DOWN; }
57 else if (
r.tan_up(iv_min) < aTanIv.min()) { iv_min =
ATANINF_DOWN; }
60 if (
r.tan_down(iv_min) > aTanIv.max()) { n_min+=2; iv_min =
ATANINF_DOWN; }
61 else if (
r.tan_up(iv_min) < aTanIv.min()) { n_min++; iv_min =
ATANINF_DOWN; }
70 switch (
POS(iv_max) )
73 if (
r.tan_down(iv_max) > aTanIv.max()) { iv_max =
ATANSUP_UP; }
74 else if (
r.tan_up(iv_max) < aTanIv.min()) { n_max--; iv_max =
ATANSUP_UP; }
77 if (
r.tan_down(iv_max) > aTanIv.max()) { n_max++; iv_max =
ATANSUP_UP; }
78 else if (
r.tan_up(iv_max) < aTanIv.min()) { iv_max =
ATANSUP_UP; }
95 template<
class A,
class B>
100 template<
class A,
class B>
104 #define I0__PI_2I FloatVal(0,pi_half_upper()) 110 (void)
new (home)
Tan<A,B>(home,x0,x1);
114 template<
class A,
class B>
119 template<
class A,
class B>
122 return new (home)
Tan<A,B>(home,share,*
this);
125 template<
class A,
class B>
133 #define I0__PI_2I FloatVal(0,pi_half_upper()) 138 n_min = static_cast<int>(
r.div_up(x0.min(),
pi_upper()));
139 n_max = static_cast<int>(
r.div_up(x0.max(),
pi_upper()));
146 if (
r.tan_down(x0_min) > x0_min) n_min++;
147 t =
r.add_down(
r.mul_up(n_min,
pi_upper()),
r.tan_down(x0_min));
148 }
while (
t > x0_min);
149 t =
r.sub_down(
r.mul_up(2*n_max,
pi_upper()),x0.max());
152 if (
r.tan_down(x0_max) < x0_max) n_max--;
153 t =
r.add_up(
r.mul_up(n_max,
pi_upper()),
r.tan_up(x0_max));
154 }
while (
t > x0_max);
155 x0_max =
r.sub_up(
r.mul_up(2*n_max,
pi_upper()),x0_max);
161 n_min = static_cast<int>(
r.div_up(x0.min(),
pi_upper()));
162 n_max = static_cast<int>(
r.div_up(x0.max(),
pi_upper()));
163 if (x0.min() < 0) n_min--;
164 if (x0.max() < 0) n_max--;
170 if (n_iv_min > n_iv_max)
return ES_FAILED;
183 template<
class A,
class B>
188 template<
class A,
class B>
200 template<
class A,
class B>
205 template<
class A,
class B>
208 return new (home)
ATan<A,B>(home,share,*
this);
211 template<
class A,
class B>
FloatNum pi_half_upper(void)
Return upper bound of .
void aTanProject(Rounding &r, const V &aTanIv, FloatNum &iv_min, FloatNum &iv_max, int &n_min, int &n_max)
Tan(Space &home, bool share, Tan &p)
Constructor for cloning p.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
ExecStatus ES_SUBSUMED(Propagator &p)
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Propagator for bounds consistent arc tangent operator
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Propagation has computed fixpoint.
Base-class for both propagators and branchers.
Propagator for bounds consistent tangent operator
int p
Number of positive literals for node type.
bool same(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether two views are the same.
Execution has resulted in failure.
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Floating point rounding policy.
ATan(Space &home, bool share, ATan &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Home class for posting propagators
double FloatNum
Floating point number base type.
#define GECODE_NEVER
Assert that this command is never executed.
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum pi_upper(void)
Return upper bound of .