Go to the documentation of this file.
38 #ifdef GECODE_HAS_FLOAT_VARS
40 namespace Gecode {
namespace MiniModel {
55 #ifdef GECODE_HAS_MPFR
89 y = result(home,ret,
x);
98 y = result(home,ret,
a[0].
post(home));
103 y = result(home,ret,x0);
104 else if (x1.
max() <= x0.
min())
105 y = result(home,ret,x1);
107 y = result(home,ret);
108 min(home, x0, x1,
y);
114 y = result(home,ret);
120 y = result(home,ret,
a[0].
post(home));
125 y = result(home,ret,x1);
126 else if (x1.
max() <= x0.
min())
127 y = result(home,ret,x0);
129 y = result(home,ret);
130 max(home, x0, x1,
y);
136 y = result(home,ret);
146 y = result(home,ret,x0);
148 y = result(home,ret,x1);
150 y = result(home,ret,x1);
152 y = result(home,ret,x0);
154 y = result(home,ret);
155 mult(home, x0, x1,
y);
165 y = result(home,ret,x0);
167 y = result(home,ret,x0);
169 y = result(home,ret);
170 div(home, x0, x1,
y);
178 if (
x.
assigned() && ((
x.val() == 0.0) || (
x.val() == 1.0)))
181 y = result(home,ret);
190 if (
x.
assigned() && ((
x.val() == 0.0) || (
x.val() == 1.0)))
191 y = result(home,ret,
x);
193 y = result(home,ret);
202 if (
x.
assigned() && ((
x.val() == 0.0) || (
x.val() == 1.0)) &&
204 y = result(home,ret,
x);
206 y = result(home,ret);
207 pow(home,
x, aInt,
y);
215 if (
x.
assigned() && ((
x.val() == 0.0) || (
x.val() == 1.0)) &&
217 y = result(home,ret,
x);
219 y = result(home,ret);
224 #ifdef GECODE_HAS_MPFR
231 y = result(home,ret,
one);
233 y = result(home,ret);
242 y = result(home,ret);
250 y = result(home,ret);
258 y = result(home,ret);
266 y = result(home,ret);
274 y = result(home,ret);
282 y = result(home,ret);
290 y = result(home,ret);
301 if ((
t == ANLFE_MIN && frt ==
FRT_GQ) ||
302 (
t == ANLFE_MAX && frt ==
FRT_LQ)) {
306 rel(home,
x, frt,
c);
308 rel(home,
post(home,
nullptr), frt,
c);
313 rel(home,
post(home,
nullptr), frt,
c,
b);
329 using namespace MiniModel;
332 ArithNonLinFloatExpr* ae =
340 using namespace MiniModel;
343 n +=
static_cast<ArithNonLinFloatExpr*
>(e0.
nlfe())->
n;
347 n +=
static_cast<ArithNonLinFloatExpr*
>(e1.
nlfe())->
n;
350 ArithNonLinFloatExpr* ae =
354 ArithNonLinFloatExpr* e0e =
static_cast<ArithNonLinFloatExpr*
>(e0.
nlfe());
355 for (;
i<e0e->n;
i++)
356 ae->a[
i] = e0e->a[
i];
361 ArithNonLinFloatExpr* e1e =
static_cast<ArithNonLinFloatExpr*
>(e1.
nlfe());
363 for (;
i<curN+e1e->n;
i++)
364 ae->a[
i] = e1e->a[
i-curN];
373 using namespace MiniModel;
374 ArithNonLinFloatExpr* ae =
376 for (
int i=
x.size();
i--;)
383 using namespace MiniModel;
386 n +=
static_cast<ArithNonLinFloatExpr*
>(e0.
nlfe())->
n;
390 n +=
static_cast<ArithNonLinFloatExpr*
>(e1.
nlfe())->
n;
393 ArithNonLinFloatExpr* ae =
397 ArithNonLinFloatExpr* e0e =
static_cast<ArithNonLinFloatExpr*
>(e0.
nlfe());
398 for (;
i<e0e->n;
i++)
399 ae->a[
i] = e0e->a[
i];
404 ArithNonLinFloatExpr* e1e =
static_cast<ArithNonLinFloatExpr*
>(e1.
nlfe());
406 for (;
i<curN+e1e->n;
i++)
407 ae->a[
i] = e1e->a[
i-curN];
416 using namespace MiniModel;
417 ArithNonLinFloatExpr* ae =
419 for (
int i=
x.size();
i--;)
426 using namespace MiniModel;
427 ArithNonLinFloatExpr* ae =
436 using namespace MiniModel;
437 ArithNonLinFloatExpr* ae =
446 using namespace MiniModel;
447 ArithNonLinFloatExpr* ae =
456 using namespace MiniModel;
457 ArithNonLinFloatExpr* ae =
466 using namespace MiniModel;
467 ArithNonLinFloatExpr* ae =
476 using namespace MiniModel;
477 ArithNonLinFloatExpr* ae =
485 using namespace MiniModel;
486 ArithNonLinFloatExpr* ae =
494 using namespace MiniModel;
495 ArithNonLinFloatExpr* ae =
503 using namespace MiniModel;
504 ArithNonLinFloatExpr* ae =
510 #ifdef GECODE_HAS_MPFR
514 using namespace MiniModel;
515 ArithNonLinFloatExpr* ae =
523 using namespace MiniModel;
524 ArithNonLinFloatExpr* ae =
532 using namespace MiniModel;
533 ArithNonLinFloatExpr* ae =
541 using namespace MiniModel;
542 ArithNonLinFloatExpr* ae =
550 using namespace MiniModel;
551 ArithNonLinFloatExpr* ae =
559 using namespace MiniModel;
560 ArithNonLinFloatExpr* ae =
568 using namespace MiniModel;
569 ArithNonLinFloatExpr* ae =
577 using namespace MiniModel;
578 ArithNonLinFloatExpr* ae =
~ArithNonLinFloatExpr(void)
Destructor.
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Post propagator for SetVar x
@ ANLFE_SQRT
Square root expression.
Post propagator for SetVar SetOpType SetVar y
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0)
Constructors.
FloatVal val(void) const
Return assigned value.
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
virtual void post(Home home, FloatRelType frt, FloatVal c) const
Post expression to be in relation frt with c.
FloatRelType
Relation types for floats.
@ ANLFE_LOG
Logarithm root expression.
bool assigned(void) const
Test whether view is assigned.
@ ANLFE_EXP
Exponential expression.
FloatNum max(void) const
Return maximum of domain.
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ ANLFE_POW
Pow expression.
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
@ ANLFE_SQR
Square expression.
Gecode toplevel namespace
FloatVal operator*(const FloatVal &x, const FloatVal &y)
ArithNonLinFloatExprType
The expression type.
NonLinFloatExpr * nlfe(void) const
Return non-linear expression inside, or null if not non-linear.
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Home class for posting propagators
int n
Size of variable array.
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Boolean integer variables.
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatNum min(void) const
Return minimum of domain.
FloatVal operator/(const FloatVal &x, const FloatVal &y)
virtual void post(Home home, FloatRelType frt, FloatVal c, BoolVar b) const
Post reified expression to be in relation frt with c.
@ ANLFE_ABS
Absolute value expression.
@ FRT_LQ
Less or equal ( )
virtual FloatVar post(Home home, FloatVar *ret) const
Post expression.
#define GECODE_NEVER
Assert that this command is never executed.
ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0, int a0)
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Heap heap
The single global heap.
@ ANLFE_MAX
Maximum expression.
int aInt
Integer argument (used in nroot for example)
@ ANLFE_DIV
Division expression.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
@ FRT_GQ
Greater or equal ( )
void free(T *b, long unsigned int n)
Delete n objects starting at b.
Non-linear float arithmetic expressions.
#define GECODE_MINIMODEL_EXPORT
LinFloatExpr * a
Expressions.
@ ANLFE_MIN
Minimum expression.
Base class for non-linear float expressions.
bool hasType(const LinFloatExpr &e, ArithNonLinFloatExpr::ArithNonLinFloatExprType t)
Check if e is of type t.
@ ANLFE_MULT
Multiplication expression.
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Gecode::FloatVal c(-8, 8)
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
int n
Number of negative literals for node type.
@ ANLFE_NROOT
Nth root expression.
Gecode::IntArgs i({1, 2, 3, 4})
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .