40 #ifdef GECODE_HAS_FLOAT_VARS
81 static void*
operator new(
size_t size);
83 static void operator delete(
void*
p,
size_t size);
110 LinFloatExpr::Node::operator
new(
size_t size) {
115 LinFloatExpr::Node::operator
delete(
void*
p, size_t) {
122 if ((
l != NULL) &&
l->decrement())
124 if ((
r != NULL) &&
r->decrement())
157 if (home.
failed())
return;
188 if (home.
failed())
return;
217 if ((n->
n_float == 1) && (c == 0) && (fts[0].
a == 1))
271 for (
int i=x.
size();
i--; ) {
287 for (
int i=x.
size();
i--; ) {
298 n->
l = e0.n; n->
l->
use++;
299 n->
r = e1.n; n->
r->
use++;
307 n->
r = e.n; n->
r->
use++;
315 n->
l = e.n; n->
l->
use++;
359 tf->
a=m; tf->
x=
sum.ne->post(home, NULL); tf++;
373 l->
fill(home,tf,m,d);
375 r->
fill(home,tf,m,d);
382 l->
fill(home,tf,m,d);
384 r->
fill(home,tf,-m,d);
388 l->
fill(home,tf,m*a,d);
bool failed(void) const
Check whether corresponding space is failed.
FloatVal operator-(const FloatVal &x)
FloatVar x_float
Float variable (potentially)
void fill(Home home, Float::Linear::Term *&tf, FloatVal m, FloatVal &d) const
Generate linear terms from expression.
void post(Home home, FloatRelType frt) const
Post propagator.
int n_float
Float variables in tree.
bool valid(const FloatVal &n)
Return whether float n is a valid number.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
NodeType t
Type of expression.
const FloatNum max
Largest allowed float value.
void rfree(void *p)
Free memory block starting at p.
int size(void) const
Return size of array (number of elements)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
unsigned int use
Nodes are reference counted.
void * ralloc(size_t s)
Allocate s bytes from heap.
Linear term with variable.
virtual FloatVar post(Home home, FloatVar *ret) const =0
Return variable constrained to be equal to the expression.
bool decrement(void)
Decrement reference count and possibly free memory.
FloatVal a
Coefficient and offset.
Nodes for linear expressions.
Heap heap
The single global heap.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Base class for non-linear float expressions.
FloatVal operator+(const FloatVal &x)
FloatRelType
Relation types for floats.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Subtraction of linear terms.
Float::Linear::Term * tf
Integer views and coefficients.
LinFloatExpr(void)
Default constructor.
~LinFloatExpr(void)
Destructor.
NodeType
Type of linear expression.
Multiplication by coefficient.
Boolean integer variables.
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
const LinFloatExpr & operator=(const LinFloatExpr &e)
Assignment operator.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
FloatVal operator*(const FloatVal &x, const FloatVal &y)
void free(T *b, long unsigned int n)
Delete n objects starting at b.
NonLinFloatExpr * ne
Non-linear expression.
Node * x
Pointer to corresponding Boolean expression node.
Node(void)
Default constructor.
NonLinFloatExpr * nlfe(void) const
Return non-linear expression inside, or NULL if not non-linear.
FloatVal val(void) const
Return assigned value.
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Exception: Arguments are of different size
Class for describing linear term .
#define GECODE_MINIMODEL_EXPORT
bool assigned(void) const
Test whether view is assigned.
Addition of linear terms.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
union Gecode::LinFloatExpr::Node::@60 sum
Sum of integer or Boolean variables, or non-linear expression.
Home class for posting propagators
double FloatNum
Floating point number base type.
#define GECODE_NEVER
Assert that this command is never executed.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.