40 namespace Gecode {
namespace Float {
namespace Arithmetic {
46 return x.min() >= 0.0;
52 return x.max() <= 0.0;
58 return (x.min() <= 0.0) && (x.max() >= 0.0);
141 template<
class VA,
class VB,
class VC>
147 template<
class VA,
class VB,
class VC>
154 template<
class VA,
class VB,
class VC>
160 template<
class VA,
class VB,
class VC>
168 if (x0.assigned() && x1.assigned() && x2.assigned())
173 template<
class VA,
class VB,
class VC>
202 return new (home)
Mult<View>(home,share,*
this);
210 if (
pos(x1) ||
pos(x2))
goto rewrite_ppp;
211 if (
neg(x1) ||
neg(x2))
goto rewrite_pnn;
215 if (
neg(x1) ||
pos(x2))
goto rewrite_nnp;
216 if (
pos(x1) ||
neg(x2))
goto rewrite_npn;
220 if (
pos(x2))
goto rewrite_ppp;
221 if (
neg(x2))
goto rewrite_npn;
225 if (
pos(x2))
goto rewrite_nnp;
226 if (
neg(x2))
goto rewrite_pnn;
230 assert(
any(x0) &&
any(x1));
232 r.
mul_up(x0.min(),x1.min()))));
237 if (r.
div_up(x2.min(),x1.min()) < x0.min())
239 if (r.
div_up(x2.min(),x0.min()) < x1.min())
243 if (r.
div_up(x2.max(),x1.max()) < x0.min())
245 if (r.
div_up(x2.max(),x0.max()) < x1.min())
250 assert((x0.val() == 0.0) && (x2.val() == 0.0));
255 assert((x1.val() == 0.0) && (x2.val() == 0.0));
269 if (
pos(x2))
goto rewrite_ppp;
270 if (
neg(x2))
goto rewrite_pnn;
275 if (x0.assigned() && x1.assigned()) {
290 if (
pos(x2))
goto rewrite_nnp;
291 if (
neg(x2))
goto rewrite_npn;
293 if (x0.max() != 0.0) {
298 if (x0.assigned() && x1.assigned()) {
307 ::
post(home(*
this),x0,x1,x2)));
328 if (
pos(x1) ||
pos(x2))
goto post_ppp;
329 if (
neg(x1) ||
neg(x2))
goto post_pnn;
330 }
else if (
neg(x0)) {
331 if (
neg(x1) ||
pos(x2))
goto post_nnp;
332 if (
pos(x1) ||
neg(x2))
goto post_npn;
333 }
else if (
pos(x1)) {
334 if (
pos(x2))
goto post_ppp;
335 if (
neg(x2))
goto post_npn;
336 }
else if (
neg(x1)) {
337 if (
pos(x2))
goto post_nnp;
338 if (
neg(x2))
goto post_pnn;
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: )
FloatNum mul_down(FloatNum x, FloatNum y)
Return lower bound of x times y (domain: )
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
ExecStatus ES_SUBSUMED(Propagator &p)
const FloatNum max
Largest allowed float value.
bool neg(const View &x)
Test whether x is negative.
bool any(const View &x)
Test whether x is neither positive nor negative.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
bool pos(const View &x)
Test whether x is postive.
MultPlus(Home home, VA x0, VB x1, VC x2)
Constructor for posting.
Bounds consistent positive multiplication propagator.
Propagation has computed fixpoint.
Base-class for both propagators and branchers.
Mult(Space &home, bool share, Mult< View > &p)
Constructor for cloning p.
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
static ExecStatus post(Home home, View x0, View x1)
Post propagator for .
bool same(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether two views are the same.
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
Mixed ternary propagator.
Bounds or domain consistent propagator for .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Bounds consistent multiplication propagator.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
MultZeroOne(Space &home, bool share, MultZeroOne< View > &p)
Constructor for cloning p.
Floating point rounding policy.
static ExecStatus post(Home home, VA x0, VB x1, VC x2)
Post propagator .
RelTest rtest_eq(View x, View y)
Test whether views x and y are equal.
Node * x
Pointer to corresponding Boolean expression node.
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: )
Propagation has not computed fixpoint.
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.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
Gecode toplevel namespace
Relation may hold or not.
FloatNum mul_up(FloatNum x, FloatNum y)
Return upper bound of x times y (domain: )
int ModEventDelta
Modification event deltas.
Home class for posting propagators
#define GECODE_NEVER
Assert that this command is never executed.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.