Go to the documentation of this file.
38 #ifdef GECODE_HAS_SET_VARS
74 static void*
operator new(
size_t size);
76 static void operator delete(
void*
p,
size_t size);
86 SetExpr::Node::operator
new(
size_t size) {
90 SetExpr::Node::operator
delete(
void*
p, size_t) {
97 if ((
l !=
nullptr) &&
l->decrement())
99 if ((
r !=
nullptr) &&
r->decrement())
136 static NNF* nnf(Region&
r, Node* n,
bool neg);
149 static void*
operator new(
size_t s, Region&
r);
151 static void operator delete(
void*);
153 static void operator delete(
void*, Region&);
161 NNF::operator
delete(
void*) {}
164 NNF::operator
delete(
void*, Region&) {}
167 NNF::operator
new(
size_t s, Region&
r) {
187 rel(home,
u.a.x->x, srt, bc);
191 rel(home,
u.a.x->x, srt, s);
197 IntSetRanges sr(
u.a.x->s);
198 Set::RangesCompl<IntSetRanges> src(sr);
208 dom(home, s, srt, ss);
238 rel(home, bc, srt, s);
257 rel(home, bc, srt, s);
294 rel(home, br, srt, bc);
305 rel(home, br, srt, s);
332 rel(home,
u.a.x->x, srt, bc,
b);
336 rel(home,
u.a.x->x, srt, s,
b);
342 IntSetRanges sr(
u.a.x->s);
343 Set::RangesCompl<IntSetRanges> src(sr);
366 dom(home, s, invsrt, ss,
b);
376 rel(home,ic,srt,s,
b);
378 rel(home,iv,srt,s,
b);
390 rel(home, br, srt, s,
b);
401 rel(home, br, srt, s,
b);
421 rel(home, br, srt, bc);
428 rel(home, br, srt, s,
b);
461 u.b.l->post(home,
t,
b,
i);
462 u.b.r->post(home,
t,
b,
i);
469 post(home,srt,
n->u.a.x->x);
475 default: n_srt = srt;
477 n->post(home,n_srt,
this);
491 post(home,srt,
n->u.a.x->x,
b);
497 default: n_srt = srt;
499 n->post(home,
b,
true,n_srt,
this);
506 }
else if (srt ==
SRT_EQ) {
508 }
else if (srt ==
SRT_NQ) {
511 BoolVar nb(home,0,1);
513 post(home,nb,
true,srt,n);
518 NNF::nnf(Region&
r, Node* n,
bool neg) {
524 NNF*
x =
new (
r) NNF;
534 return nnf(
r,
n->l,!
neg);
547 NNF*
x =
new (
r) NNF;
550 x->u.b.l = nnf(
r,
n->l,
neg);
551 x->u.b.r = nnf(
r,
n->r,
neg);
554 p_l=
x->u.b.l->p; n_l=
x->u.b.l->n;
560 p_r=
x->u.b.r->p; n_r=
x->u.b.r->n;
602 int ls =
same(
t,
l.n->t) ?
l.n->same : 1;
603 int rs =
same(
t,
r.n->t) ?
r.n->same : 1;
631 if (
n !=
nullptr &&
n->decrement())
640 if (
n !=
nullptr &&
n->decrement())
653 NNF::nnf(
r,
n,
false)->post(home,
SRT_EQ,s);
660 return NNF::nnf(
r,
n,
false)->post(home,srt,NNF::nnf(
r,e.n,
false));
666 return NNF::nnf(
r,
n,
false)->post(home,
b,
t,srt,
667 NNF::nnf(
r,e.n,
false));
700 for (
int i=1;
i<
x.size();
i++)
709 for (
int i=1;
i<
x.size();
i++)
718 for (
int i=1;
i<
x.size();
i++)
723 namespace MiniModel {
741 IntVar m = result(home,ret);
760 if (
t==SNLE_CARD && irt!=
IRT_NQ) {
765 static_cast<unsigned int>(
c));
770 static_cast<unsigned int>(
c-1));
774 static_cast<unsigned int>(
c),
779 static_cast<unsigned int>(
c+1),
784 static_cast<unsigned int>(
c),
785 static_cast<unsigned int>(
c));
797 rel(home,
post(home,
nullptr,ipls), irt,
c);
810 rel(home,
post(home,
nullptr,ipls), irt,
c,
b);
Post propagator for SetVar x
struct Gecode::@626::NNF::@71::@73 a
For atomic nodes.
IntRelType
Relation types for integers.
Node(void)
Default constructor.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
const SetExpr & operator=(const SetExpr &e)
Assignment operator.
virtual void post(Home home, IntRelType irt, int c, const IntPropLevels &ipls) const
Post expression to be in relation irt with c.
unsigned int size(I &i)
Size of all ranges of range iterator i.
SetNonLinIntExprType
The expression type.
static const IntSet empty
Empty set.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
const int min
Smallest allowed integer in integer set.
bool decrement(void)
Decrement reference count and possibly free memory.
int p
Number of positive literals for node type.
void * ralloc(size_t s)
Allocate s bytes from heap.
int same
Number of variables in subtree with same type (for INTER and UNION)
Linear expressions over integer variables.
FloatVal operator+(const FloatVal &x)
SetExpr operator|(const SetExpr &l, const SetExpr &r)
Union of set expressions.
SetExpr singleton(const LinIntExpr &e)
Singleton expression.
Integer valued set expressions.
Class for specifying integer propagation levels used by minimodel.
virtual void post(Home home, IntRelType irt, int c, BoolVar b, const IntPropLevels &ipls) const
Post reified expression to be in relation irt with c.
Gecode toplevel namespace
union Gecode::@626::NNF::@71 u
Union depending on nodetype t.
VarImp * x
Pointer to variable implementation.
const int max
Largest allowed integer in integer set.
const unsigned int card
Maximum cardinality of an integer set.
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
Home class for posting propagators
SetNonLinIntExpr(const SetExpr &e0, SetNonLinIntExprType t0)
Constructor.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Post propagator for SetVar SetOpType SetVar SetRelType r
Boolean integer variables.
int n
Number of negative literals for node type.
SetExpr(void)
Default constructor.
Base class for non-linear expressions over integer variables.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
LinIntExpr e
Possibly a linear expression.
Class to set group information when a post function is executed.
SetRelType
Common relation types for sets.
SetExpr operator&(const SetExpr &l, const SetExpr &r)
Intersection of set expressions.
SetExpr setunion(const SetVarArgs &x)
Union of set variables.
NodeType
Type of set expression.
Minimum element expression.
#define GECODE_NEVER
Assert that this command is never executed.
SetVar x
Possibly a variable.
FloatVal operator-(const FloatVal &x)
Heap heap
The single global heap.
NodeType t
Type of expression.
IntRelType neg(IntRelType irt)
Return negated relation type of irt.
bool failed(void) const
Check whether corresponding space is failed.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Maximum element expression.
#define GECODE_MINIMODEL_EXPORT
SetExpr setdunion(const SetVarArgs &x)
Disjoint union of set variables.
static const IntPropLevels def
Default propagation levels for all constraints.
struct Gecode::@626::NNF::@71::@72 b
For binary nodes (and, or, eqv)
IntSet s
Possibly a constant.
virtual IntVar post(Home home, IntVar *ret, const IntPropLevels &) const
Post expression.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool same(VarArgArray< Var > x, VarArgArray< Var > y)
Gecode::FloatVal c(-8, 8)
int n
Number of negative literals for node type.
void rfree(void *p)
Free memory block starting at p.
SetVar post(Home home) const
Post propagators for expression.
Gecode::IntArgs i({1, 2, 3, 4})
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
~SetExpr(void)
Destructor.
unsigned int use
Nodes are reference counted.