Go to the documentation of this file.
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)
long long int mll(long long int x, long long int y)
Multiply x and \y.
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
DivBnd(Space &home, bool share, DivBnd< View > &p)
Constructor for cloning p.
bool pos(const View &x)
Test whether x is postive.
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.
ExecStatus ES_SUBSUMED(Propagator &p)
DivMod(Space &home, bool share, DivMod< View > &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
const FloatNum min
Smallest allowed float value.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
ExecStatus subsumed(Space &home, Propagator &p, int c, TaskArray< Task > &t)
Check for subsumption (all tasks must be assigned)
Base-class for both propagators and branchers.
IntType floor_div_xp(IntType x, IntType y)
Compute where y is non-negative.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
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.
Mixed ternary propagator.
Bounds consistent division propagator.
long long int ill(int x)
Increment x by one.
Bounds consistent positive division propagator.
IntType ceil_div_xp(IntType x, IntType y)
Compute where y is non-negative.
Gecode toplevel namespace
IntType floor_div_xx(IntType x, IntType y)
Compute .
Home class for posting propagators
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
bool any(const View &x)
Test whether x is neither positive nor negative.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator (rounding towards 0)
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntType ceil_div_xx(IntType x, IntType y)
Compute .
bool neg(const View &x)
Test whether x is negative.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
IntType ceil_div_pp(IntType x, IntType y)
Compute where x and y are non-negative.
long long int dll(int x)
Decrement x by one.
@ ES_FIX
Propagation has computed fixpoint.
Integer division/modulo propagator.
Range iterator for singleton range.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
static ExecStatus post(Home home, VA x0, VB x1, VC x2)
Post propagator (rounding towards 0)
int ModEventDelta
Modification event deltas.
@ ES_NOFIX
Propagation has not computed fixpoint.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
IntType floor_div_px(IntType x, IntType y)
Compute where x is non-negative.
const FloatNum max
Largest allowed float value.