40 namespace Gecode {
namespace Int {
namespace Arithmetic {
47 template<
class VA,
class VB,
class VC>
53 template<
class VA,
class VB,
class VC>
60 template<
class VA,
class VB,
class VC>
66 template<
class VA,
class VB,
class VC>
86 return x0.assigned() && x1.assigned() ?
90 template<
class VA,
class VB,
class VC>
125 if (
pos(x2) ||
pos(x0))
goto rewrite_ppp;
126 if (
neg(x2) ||
neg(x0))
goto rewrite_npn;
130 if (
neg(x2) ||
pos(x0))
goto rewrite_pnn;
131 if (
pos(x2) ||
neg(x0))
goto rewrite_nnp;
135 if (
pos(x0))
goto rewrite_ppp;
136 if (
neg(x0))
goto rewrite_nnp;
140 if (
pos(x0))
goto rewrite_pnn;
141 if (
neg(x0))
goto rewrite_npn;
144 assert(
any(x1) &&
any(x2));
146 mll(x1.min(),
dll(x2.min()))-1)));
148 mll(x1.max(),
dll(x2.min())))));
157 if (
pos(x0))
goto rewrite_ppp;
158 if (
neg(x0))
goto rewrite_nnp;
163 if (x0.assigned() && x1.assigned())
173 if (
pos(x0))
goto rewrite_ppp;
174 if (
neg(x0))
goto rewrite_npn;
179 if (x0.assigned() && x1.assigned())
189 if (
pos(x0))
goto rewrite_pnn;
190 if (
neg(x0))
goto rewrite_npn;
197 if (x0.assigned() && x1.assigned())
207 if (
pos(x0))
goto rewrite_pnn;
208 if (
neg(x0))
goto rewrite_nnp;
213 if (x0.assigned() && x1.assigned())
219 ::
post(home(*
this),x0,x1,x2)));
230 assert(x0.assigned() && x1.assigned());
232 if (x0.val()/x1.val() < 0)
243 if (
pos(x1) ||
pos(x2))
goto post_ppp;
244 if (
neg(x1) ||
neg(x2))
goto post_pnn;
245 }
else if (
neg(x0)) {
246 if (
neg(x1) ||
pos(x2))
goto post_nnp;
247 if (
pos(x1) ||
neg(x2))
goto post_npn;
248 }
else if (
pos(x1)) {
249 if (
pos(x2))
goto post_ppp;
250 if (
neg(x2))
goto post_npn;
251 }
else if (
neg(x1)) {
252 if (
pos(x2))
goto post_nnp;
253 if (
neg(x2))
goto post_pnn;
311 }
else if (x0.max() <= 0) {
313 }
else if (x2.min() > 0) {
315 }
else if (x2.max() < 0) {
327 int x2absmin =
any(x2) ? 0 : (
pos(x2) ? x2.min() : -x2.max());
330 }
while (!signIsSame &&
331 (x0.min() > 0 || x0.max() < 0 || x2.min() > 0 || x2.max() < 0));
336 int x1absmin =
any(x1) ? 0 : (
pos(x1) ? x1.min() : -x1.max());
337 if (x2max < x1absmin)
IntType ceil_div_pp(IntType x, IntType y)
Compute where x and y are non-negative.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Bounds consistent positive division propagator.
Integer division/modulo propagator.
bool any(const View &x)
Test whether x is neither positive nor negative.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntConLevel icl)
Post propagator for .
Range iterator for singleton range.
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.
DivPlusBnd(Home home, VA x0, VB x1, VC x2)
Constructor for posting.
long long int ll(int x)
Cast x into a long long int.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
long long int mll(long long int x, long long int y)
Multiply x and .
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
IntType floor_div_xx(IntType x, IntType y)
Compute .
Propagation has computed fixpoint.
DivBnd(Space &home, bool share, DivBnd< View > &p)
Constructor for cloning p.
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
Base-class for both propagators and branchers.
long long int ill(int x)
Increment x by one.
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Mixed ternary propagator.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
IntType floor_div_pp(IntType x, IntType y)
Compute where x and y are non-negative.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
DivMod(Space &home, bool share, DivMod< View > &p)
Constructor for cloning p.
IntType floor_div_xp(IntType x, IntType y)
Compute where y is non-negative.
IntType ceil_div_xp(IntType x, IntType y)
Compute where y is non-negative.
IntType ceil_div_xx(IntType x, IntType y)
Compute .
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Bounds consistent division propagator.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
ExecStatus subsumed(Space &home, Propagator &p, TaskArray< Task > &t)
Check tasks t for subsumption.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
IntType floor_div_px(IntType x, IntType y)
Compute where x is non-negative.
bool pos(const View &x)
Test whether x is postive.
long long int dll(int x)
Decrement x by one.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator (rounding towards 0)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagation has not computed fixpoint.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
static ExecStatus post(Home home, VA x0, VB x1, VC x2)
Post propagator (rounding towards 0)
Home class for posting propagators
bool neg(const View &x)
Test whether x is negative.