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
229 if (
x.assigned() && (
x.val() == 0.0)) {
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 =
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Boolean integer variables.
FloatNum min(void) const
Return minimum of domain.
FloatVal val(void) const
Return assigned value.
FloatNum max(void) const
Return maximum of domain.
void free(T *b, long unsigned int n)
Delete n objects starting at b.
Home class for posting propagators
NonLinFloatExpr * nlfe(void) const
Return non-linear expression inside, or null if not non-linear.
Non-linear float arithmetic expressions.
virtual void post(Home home, FloatRelType frt, FloatVal c, BoolVar b) const
Post reified expression to be in relation frt with c.
virtual void post(Home home, FloatRelType frt, FloatVal c) const
Post expression to be in relation frt with c.
virtual FloatVar post(Home home, FloatVar *ret) const
Post expression.
ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0)
Constructors.
int aInt
Integer argument (used in nroot for example)
ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0, int a0)
ArithNonLinFloatExprType
The expression type.
@ ANLFE_POW
Pow expression.
@ ANLFE_SQR
Square expression.
@ ANLFE_MULT
Multiplication expression.
@ ANLFE_DIV
Division expression.
@ ANLFE_ABS
Absolute value expression.
@ ANLFE_NROOT
Nth root expression.
@ ANLFE_LOG
Logarithm root expression.
@ ANLFE_EXP
Exponential expression.
@ ANLFE_SQRT
Square root expression.
@ ANLFE_MIN
Minimum expression.
@ ANLFE_MAX
Maximum expression.
~ArithNonLinFloatExpr(void)
Destructor.
LinFloatExpr * a
Expressions.
int n
Size of variable array.
Base class for non-linear float expressions.
bool assigned(void) const
Test whether view is assigned.
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Heap heap
The single global heap.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
FloatRelType
Relation types for floats.
@ FRT_LQ
Less or equal ( )
@ FRT_GQ
Greater or equal ( )
#define GECODE_MINIMODEL_EXPORT
bool hasType(const LinFloatExpr &e, ArithNonLinFloatExpr::ArithNonLinFloatExprType t)
Check if e is of type t.
Gecode::FloatVal c(-8, 8)
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Gecode::IntArgs i({1, 2, 3, 4})
#define GECODE_NEVER
Assert that this command is never executed.