Go to the documentation of this file.
43 namespace Gecode {
namespace Int {
namespace Arithmetic {
50 template<
class Ops,
bool minus>
107 template<
class Ops,
bool minus>
114 template<
class Ops,
bool minus>
128 template<
class Ops,
bool minus>
135 template<
class Ops,
bool minus>
141 template<
class Ops,
bool minus>
157 assert((x0.
min() < 0) && (x0.
max() > 0));
158 assert((x1.
min() < 0) && (x1.
max() > 0));
177 if (
static_cast<unsigned int>(ops.exp()) >=
sizeof(
int) * CHAR_BIT) {
182 ops.exp(ops.even() ? 30 : 31);
185 if (ops.exp() == 0) {
188 }
else if (ops.exp() == 1) {
193 assert(ops.exp() > 1);
208 if ((x0.
min() >= 0) || (x1.
min() >= 0))
211 if ((x0.
max() <= 0) || (x1.
max() <= 0))
214 assert((x0.
min() < 0) && (x0.
max() > 0));
215 assert((x1.
min() < 0) && (x1.
max() > 0));
217 (void)
new (home)
NrootBnd(home,x0,x1,ops);
237 if ((x0.min() >= 0) || (x1.min() >= 0))
240 if ((x0.max() <= 0) || (x1.max() <= 0))
268 return ops.tpow(
x+1)-1;
283 return (
x < 0) ? -
ops.cnroot(-
x) :
ops.fnroot(
x);
287 return (
x < 0) ? -
ops.cnroot(-
x) :
ops.fnroot(
x);
291 template<
class Ops,
bool minus>
298 template<
class Ops,
bool minus>
313 template<
class Ops,
bool minus>
320 template<
class Ops,
bool minus>
326 template<
class Ops,
bool minus>
337 template<
class Ops,
bool minus>
376 if (
static_cast<unsigned int>(ops.exp()) >=
sizeof(
int) * CHAR_BIT) {
381 ops.exp(ops.even() ? 30 : 31);
384 if (ops.exp() == 0) {
387 }
else if (ops.exp() == 1) {
392 assert(ops.exp() > 1);
407 if ((x0.
min() >= 0) || (x1.
min() >= 0))
410 if ((x0.
max() <= 0) || (x1.
max() <= 0))
413 assert((x0.
min() < 0) && (x0.
max() > 0));
414 assert((x1.
min() < 0) && (x1.
max() > 0));
416 (void)
new (home)
NrootDom(home,x0,x1,ops);
447 if ((x0.min() >= 0) || (x1.min() >= 0))
450 if ((x0.max() <= 0) || (x1.max() <= 0))
455 return x0.assigned() && x1.assigned() ? home.
ES_SUBSUMED(*
this)
Mapping integer to n-th root.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Post propagator for SetVar x
int min(int x) const
Perform mapping of minimum.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
ExecStatus prop_nroot_plus_bnd(Space &home, IntView x0, IntView x1, const Ops &ops)
ExecStatus ES_SUBSUMED(Propagator &p)
int min(void) const
Return minimum of domain.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Positive bounds consistent n-th root propagator.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
bool same(const CachedView< View > &x, const CachedView< View > &y)
static ExecStatus post(Home home, View0 x0, View1 x1)
Post domain consistent propagator .
ExecStatus ES_NOFIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has not computed partial fixpoint
Base-class for both propagators and branchers.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
NrootBnd(Space &home, bool share, NrootBnd< Ops > &p)
Constructor for cloning p.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
RangesMapPow(const Ops &o)
Initialize with operations o.
Gecode toplevel namespace
int max(void) const
Return maximum of domain.
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
NrootPlusDom(Space &home, bool share, NrootPlusDom< Ops, minus > &p)
Constructor for cloning p.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Range iterator for mapping ranges.
Home class for posting propagators
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
RangesMapNroot(const Ops &o)
Initialize with operations o.
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Post propagator for SetVar SetOpType SetVar SetRelType r
const int max
Largest allowed integer value.
ExecStatus prop_nroot_bnd(Space &home, IntView x0, IntView x1, const Ops &ops)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
int ModEvent
Type for modification events.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Mapping ranges to powers.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
int max(int x) const
Perform mapping of maximum.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Domain consistent n-th root propagator.
@ ES_FIX
Propagation has computed fixpoint.
Integer view for integer variables.
Range iterator for integer variable views
NrootDom(Space &home, bool share, NrootDom< Ops > &p)
Constructor for cloning p.
const int min
Smallest allowed integer value.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Domain consistent n-th root propagator.
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Bounds consistent n-th root propagator.
@ ES_FAILED
Execution has resulted in failure.
int med(void) const
Return median of domain (greatest element not greater than the median)
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int ModEventDelta
Modification event deltas.
@ ES_NOFIX
Propagation has not computed fixpoint.
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
@ ES_OK
Execution is okay.
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
int p
Number of positive literals for node type.
NrootPlusBnd(Space &home, bool share, NrootPlusBnd< Ops, minus > &p)
Constructor for cloning p.
int min(int x) const
Perform mapping of minimum.
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
int max(int x) const
Perform mapping of maximum.