73 long long int m,
long long int& d)
const;
83 static void*
operator new(
size_t size);
85 static void operator delete(
void*
p,
size_t size);
115 LinIntExpr::Node::operator
new(
size_t size) {
120 LinIntExpr::Node::operator
delete(
void*
p, size_t) {
126 if ((
l !=
nullptr) &&
l->decrement())
128 if ((
r !=
nullptr) &&
r->decrement())
152 return static_cast<int>(d);
158 if (home.
failed())
return;
186 int c = n->
fill(home,ipls,its,
nullptr);
190 }
else if (n->
n_int == 0) {
194 int c = n->
fill(home,ipls,
nullptr,bts);
197 }
else if (n->
n_bool == 1) {
203 int c = n->
fill(home,ipls,its,bts);
216 int c = n->
fill(home,ipls,its,bts);
231 if (home.
failed())
return;
249 int c = n->
fill(home,ipls,its,
nullptr);
253 }
else if (n->
n_int == 0) {
257 int c = n->
fill(home,ipls,
nullptr,bts);
260 }
else if (n->
n_bool == 1) {
266 int c = n->
fill(home,ipls,its,bts);
279 int c = n->
fill(home,ipls,its,bts);
299 int c = n->
fill(home,ipls,its,
nullptr);
300 if ((n->
n_int == 1) && (c == 0) && (its[0].
a == 1))
309 }
else if (n->
n_int == 0) {
313 int c = n->
fill(home,ipls,
nullptr,bts);
320 }
else if (n->
n_bool == 1) {
326 int c = n->
fill(home,ipls,its,bts);
342 int c = n->
fill(home,ipls,its,bts);
367 n->
l = n->
r =
nullptr;
375 n->
l = n->
r =
nullptr;
386 n->
l = n->
r =
nullptr;
396 n->
l = n->
r =
nullptr;
406 n->
l = n->
r =
nullptr;
408 n->sum.ti = heap.alloc<Int::Linear::Term<Int::IntView> >(x.size());
409 for (int i=x.size(); i--; ) {
410 n->sum.ti[i].x = x[i];
418 if (
a.size() !=
x.size())
423 n->
l = n->
r =
nullptr;
425 n->sum.ti = heap.alloc<Int::Linear::Term<Int::IntView> >(x.size());
426 for (int i=x.size(); i--; ) {
427 n->sum.ti[i].x = x[i];
428 n->sum.ti[i].a = a[i];
438 n->
l = n->
r =
nullptr;
440 n->sum.tb = heap.alloc<Int::Linear::Term<Int::BoolView> >(x.size());
441 for (int i=x.size(); i--; ) {
442 n->sum.tb[i].x = x[i];
450 if (
a.size() !=
x.size())
455 n->
l = n->
r =
nullptr;
457 n->sum.tb = heap.alloc<Int::Linear::Term<Int::BoolView> >(x.size());
458 for (int i=x.size(); i--; ) {
459 n->sum.tb[i].x = x[i];
460 n->sum.tb[i].a = a[i];
470 n->
l = e0.n; n->
l->
use++;
471 n->
r = e1.n; n->
r->
use++;
480 n->
r = e.n; n->
r->
use++;
489 n->
l = e.n; n->
l->
use++;
499 n->
l = n->
r =
nullptr;
524 long long int m,
long long int& d)
const {
535 ti->a=
static_cast<int>(m);
ti->
x=
sum.ne->post(home,
nullptr, ipls);
ti++;
542 for (
int i=
n_int; i--; ) {
544 ti[i].x =
sum.ti[i].x;
ti[i].a =
static_cast<int>(m*
sum.ti[i].a);
549 for (
int i=
n_bool; i--; ) {
551 tb[i].x =
sum.tb[i].x;
tb[i].a =
static_cast<int>(m*
sum.tb[i].a);
908 for (
int i = 0; i<args.
size(); i++)
918 return e.
post(home,ipls);
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Passing Boolean variables.
Boolean integer variables.
void free(T *b, long unsigned int n)
Delete n objects starting at b.
void rfree(void *p)
Free memory block starting at p.
void * ralloc(size_t s)
Allocate s bytes from heap.
Home class for posting propagators
bool failed(void) const
Check whether corresponding space is failed.
Passing integer arguments.
Class for specifying integer propagation levels used by minimodel.
IntPropLevel linear(void) const
Return integer propagation level for non-binary linear constraints.
IntPropLevel linear2(void) const
Return integer propagation level for binary linear constraints.
Passing integer variables.
Exception: Arguments are of different size
Class for describing linear term .
Nodes for linear expressions.
bool decrement(void)
Decrement reference count and possibly free memory.
Int::Linear::Term< Int::IntView > * ti
Integer views and coefficients.
unsigned int use
Nodes are reference counted.
union Gecode::LinIntExpr::Node::@69 sum
Sum of integer or Boolean variables, or non-linear expression.
int n_int
Integer variables in tree.
IntVar x_int
Integer variable (potentially)
NodeType t
Type of expression.
NonLinIntExpr * ne
Non-linear expression.
BoolVar x_bool
Boolean variable (potentially)
void fill(Home home, const IntPropLevels &ipls, Int::Linear::Term< Int::IntView > *&ti, Int::Linear::Term< Int::BoolView > *&tb, long long int m, long long int &d) const
Generate linear terms from expression.
Int::Linear::Term< Int::BoolView > * tb
Bool views and coefficients.
int a
Coefficient and offset.
int n_bool
Boolean variables in tree.
Node(void)
Default constructor.
Linear expressions over integer variables.
NodeType
Type of linear expression.
@ NT_CONST
Integer constant.
@ NT_SUB
Subtraction of linear terms.
@ NT_SUM_BOOL
Sum of Boolean variables.
@ NT_ADD
Addition of linear terms.
@ NT_SUM_INT
Sum of integer variables.
@ NT_VAR_BOOL
Linear term with Boolean variable.
@ NT_MUL
Multiplication by coefficient.
@ NT_NONLIN
Non-linear expression.
@ NT_VAR_INT
Linear term with integer variable.
LinIntExpr(void)
Default constructor.
~LinIntExpr(void)
Destructor.
void post(Home home, IntRelType irt, const IntPropLevels &ipls) const
Post propagator.
const LinIntExpr & operator=(const LinIntExpr &e)
Assignment operator.
NonLinIntExpr * nle(void) const
Return non-linear expression inside, or null if not non-linear.
Matrix-interface for arrays.
ArgsType const get_array(void) const
Return an Args-array of the contents of the matrix.
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
Base class for non-linear expressions over integer variables.
virtual IntVar post(Home home, IntVar *ret, const IntPropLevels &ipls) const =0
Return variable constrained to be equal to the expression.
Class to set group information when a post function is executed.
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
bool assigned(void) const
Test whether view is assigned.
VarImp * x
Pointer to variable implementation.
void post(Home home, Term< IntView > *t, int n, IntRelType irt, int c, IntPropLevel=IPL_DEF)
Post propagator for linear constraint over integers.
Heap heap
The single global heap.
IntRelType
Relation types for integers.
@ IRT_GQ
Greater or equal ( )
@ IRT_LQ
Less or equal ( )
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
const int min
Smallest allowed integer value.
bool valid(int n)
Return whether n is in range.
const int max
Largest allowed integer value.
void estimate(Term< View > *t, int n, int c, int &l, int &u)
Estimate lower and upper bounds.
Gecode toplevel namespace
FloatVal operator-(const FloatVal &x)
FloatVal operator+(const FloatVal &x)
Post propagator for SetVar SetOpType SetVar SetRelType r
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
IntVar expr(Home home, const LinIntExpr &e, const IntPropLevels &ipls=IntPropLevels::def)
Post linear expression and return its value.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
LinIntExpr sum(const IntVarArgs &x)
Construct linear expression as sum of integer variables.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Post propagator for SetVar x
#define GECODE_NEVER
Assert that this command is never executed.