39namespace Gecode {
namespace Int {
namespace Arithmetic {
46 template<
class Ops,
bool minus>
103 template<
class Ops,
bool minus>
110 template<
class Ops,
bool minus>
124 template<
class Ops,
bool minus>
131 template<
class Ops,
bool minus>
137 template<
class Ops,
bool minus>
153 assert((x0.
min() < 0) && (x0.
max() > 0));
154 assert((x1.
min() < 0) && (x1.
max() > 0));
173 if (
static_cast<unsigned int>(ops.exp()) >=
sizeof(
int) * CHAR_BIT) {
178 ops.exp(ops.even() ? 30 : 31);
181 if (ops.exp() == 0) {
184 }
else if (ops.exp() == 1) {
189 assert(ops.exp() > 1);
204 if ((x0.
min() >= 0) || (x1.
min() >= 0))
207 if ((x0.
max() <= 0) || (x1.
max() <= 0))
210 assert((x0.
min() < 0) && (x0.
max() > 0));
211 assert((x1.
min() < 0) && (x1.
max() > 0));
213 (void)
new (home)
NrootBnd(home,x0,x1,ops);
233 if ((x0.min() >= 0) || (x1.min() >= 0))
236 if ((x0.max() <= 0) || (x1.max() <= 0))
264 return ops.tpow(
x+1)-1;
279 return (
x < 0) ? -
ops.cnroot(-
x) :
ops.fnroot(
x);
283 return (
x < 0) ? -
ops.cnroot(-
x) :
ops.fnroot(
x);
287 template<
class Ops,
bool minus>
294 template<
class Ops,
bool minus>
309 template<
class Ops,
bool minus>
316 template<
class Ops,
bool minus>
322 template<
class Ops,
bool minus>
333 template<
class Ops,
bool minus>
372 if (
static_cast<unsigned int>(ops.exp()) >=
sizeof(
int) * CHAR_BIT) {
377 ops.exp(ops.even() ? 30 : 31);
380 if (ops.exp() == 0) {
383 }
else if (ops.exp() == 1) {
388 assert(ops.exp() > 1);
403 if ((x0.
min() >= 0) || (x1.
min() >= 0))
406 if ((x0.
max() <= 0) || (x1.
max() <= 0))
409 assert((x0.
min() < 0) && (x0.
max() > 0));
410 assert((x1.
min() < 0) && (x1.
max() > 0));
412 (void)
new (home)
NrootDom(home,x0,x1,ops);
443 if ((x0.min() >= 0) || (x1.min() >= 0))
446 if ((x0.max() <= 0) || (x1.max() <= 0))
451 return x0.assigned() && x1.assigned() ? home.
ES_SUBSUMED(*
this)
int p
Number of positive literals for node type.
Base-class for both propagators and branchers.
Home class for posting propagators
Bounds consistent n-th root propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
NrootBnd(Space &home, NrootBnd< Ops > &p)
Constructor for cloning p.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
Domain consistent n-th root propagator.
NrootDom(Space &home, NrootDom< Ops > &p)
Constructor for cloning p.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Positive bounds consistent n-th root propagator.
NrootPlusBnd(Space &home, NrootPlusBnd< Ops, minus > &p)
Constructor for cloning p.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Domain consistent n-th root propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
NrootPlusDom(Space &home, NrootPlusDom< Ops, minus > &p)
Constructor for cloning p.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Mapping integer to n-th root.
int max(int x) const
Perform mapping of maximum.
RangesMapNroot(const Ops &o)
Initialize with operations o.
int min(int x) const
Perform mapping of minimum.
Mapping ranges to powers.
int min(int x) const
Perform mapping of minimum.
RangesMapPow(const Ops &o)
Initialize with operations o.
int max(int x) const
Perform mapping of maximum.
Integer view for integer variables.
int min(void) const
Return minimum of domain.
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
int med(void) const
Return median of domain (greatest element not greater than the median)
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
int max(void) const
Return maximum of domain.
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
static ExecStatus post(Home home, View0 x0, View1 x1)
Post domain consistent propagator .
Range iterator for integer views.
Range iterator for mapping ranges.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
static ModEvent me(const ModEventDelta &med)
ExecStatus ES_NOFIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has not computed partial fixpoint
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.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
ExecStatus prop_nroot_bnd(Space &home, IntView x0, IntView x1, const Ops &ops)
ExecStatus prop_nroot_plus_bnd(Space &home, IntView x0, IntView x1, const Ops &ops)
const int min
Smallest allowed integer value.
const int max
Largest allowed integer value.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
@ ES_NOFIX
Propagation has not computed fixpoint.
Post propagator for SetVar x
int ModEvent
Type for modification events.