36namespace Gecode {
namespace Int {
namespace Arithmetic {
43 template<
class VA,
class VB,
class VC>
49 template<
class VA,
class VB,
class VC>
55 template<
class VA,
class VB,
class VC>
61 template<
class VA,
class VB,
class VC>
81 return x0.assigned() && x1.assigned() ?
85 template<
class VA,
class VB,
class VC>
120 if (
pos(x2) ||
pos(x0))
goto rewrite_ppp;
121 if (
neg(x2) ||
neg(x0))
goto rewrite_npn;
125 if (
neg(x2) ||
pos(x0))
goto rewrite_pnn;
126 if (
pos(x2) ||
neg(x0))
goto rewrite_nnp;
130 if (
pos(x0))
goto rewrite_ppp;
131 if (
neg(x0))
goto rewrite_nnp;
135 if (
pos(x0))
goto rewrite_pnn;
136 if (
neg(x0))
goto rewrite_npn;
139 assert(
any(x1) &&
any(x2));
141 mll(x1.min(),
dll(x2.min()))-1)));
143 mll(x1.max(),
dll(x2.min())))));
152 if (
pos(x0))
goto rewrite_ppp;
153 if (
neg(x0))
goto rewrite_nnp;
158 if (x0.assigned() && x1.assigned())
168 if (
pos(x0))
goto rewrite_ppp;
169 if (
neg(x0))
goto rewrite_npn;
174 if (x0.assigned() && x1.assigned())
184 if (
pos(x0))
goto rewrite_pnn;
185 if (
neg(x0))
goto rewrite_npn;
192 if (x0.assigned() && x1.assigned())
202 if (
pos(x0))
goto rewrite_pnn;
203 if (
neg(x0))
goto rewrite_nnp;
208 if (x0.assigned() && x1.assigned())
214 ::post(home(*
this),x0,x1,x2)));
225 assert(x0.assigned() && x1.assigned());
226 int result = std::abs(x0.val()) / std::abs(x1.val());
227 if (x0.val()/x1.val() < 0)
238 if (
pos(x1) ||
pos(x2))
goto post_ppp;
239 if (
neg(x1) ||
neg(x2))
goto post_pnn;
240 }
else if (
neg(x0)) {
241 if (
neg(x1) ||
pos(x2))
goto post_nnp;
242 if (
pos(x1) ||
neg(x2))
goto post_npn;
243 }
else if (
pos(x1)) {
244 if (
pos(x2))
goto post_ppp;
245 if (
neg(x2))
goto post_npn;
246 }
else if (
neg(x1)) {
247 if (
pos(x2))
goto post_nnp;
248 if (
neg(x2))
goto post_pnn;
306 }
else if (x0.max() <= 0) {
308 }
else if (x2.min() > 0) {
310 }
else if (x2.max() < 0) {
317 int x1max = std::max(x1.max(),std::max(-x1.max(),
318 std::max(x1.min(),-x1.min())));
322 int x2absmin =
any(x2) ? 0 : (
pos(x2) ? x2.min() : -x2.max());
325 }
while (!signIsSame &&
326 (x0.min() > 0 || x0.max() < 0 || x2.min() > 0 || x2.max() < 0));
329 int x2max = std::max(x2.max(),std::max(-x2.max(),
330 std::max(x2.min(),-x2.min())));
331 int x1absmin =
any(x1) ? 0 : (
pos(x1) ? x1.min() : -x1.max());
332 if (x2max < x1absmin)
int p
Number of positive literals for node type.
bool neg
Is atomic formula negative.
Base-class for both propagators and branchers.
Home class for posting propagators
Bounds consistent division propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
DivBnd(Space &home, DivBnd< View > &p)
Constructor for cloning p.
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.
Integer division/modulo propagator.
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
DivMod(Space &home, DivMod< View > &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Bounds consistent positive division propagator.
static ExecStatus post(Home home, VA x0, VB x1, VC x2)
Post propagator (rounding towards 0)
virtual Actor * copy(Space &home)
Copy propagator during cloning.
DivPlusBnd(Home home, VA x0, VB x1, VC x2)
Constructor for posting.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Range iterator for singleton range.
Mixed ternary propagator.
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_REWRITE(prop, post)
Rewrite propagator by executing post function.
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
long long int dll(int x)
Decrement x by one.
bool pos(const View &x)
Test whether x is postive.
bool any(const View &x)
Test whether x is neither positive nor negative.
long long int mll(long long int x, long long int y)
Multiply x and \y.
long long int ill(int x)
Increment x by one.
long long int ll(int x)
Cast x into a long long int.
IntType ceil_div_pp(IntType x, IntType y)
Compute where x and y are non-negative.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
IntType ceil_div_xp(IntType x, IntType y)
Compute where y is non-negative.
IntType floor_div_xp(IntType x, IntType y)
Compute where y is non-negative.
IntType floor_div_xx(IntType x, IntType y)
Compute .
IntType floor_div_pp(IntType x, IntType y)
Compute where x and y are non-negative.
IntType ceil_div_xx(IntType x, IntType y)
Compute .
IntType floor_div_px(IntType x, IntType y)
Compute where x is non-negative.
Gecode toplevel namespace
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_NOFIX
Propagation has not computed fixpoint.