36namespace Gecode {
namespace MiniModel {
86 y = result(home,ret,
x);
95 y = result(home,ret,
a[0].post(home, ipls));
97 IntVar x0 =
a[0].post(home, ipls);
98 IntVar x1 =
a[1].post(home, ipls);
100 y = result(home,ret,x0);
101 else if (x1.
max() <= x0.
min())
102 y = result(home,ret,x1);
104 y = result(home,ret);
105 min(home, x0, x1,
y, ipls.
min2());
110 x[i] =
a[i].post(home, ipls);
111 y = result(home,ret);
112 min(home,
x,
y, ipls.
min());
117 y = result(home,ret,
a[0].post(home, ipls));
119 IntVar x0 =
a[0].post(home, ipls);
120 IntVar x1 =
a[1].post(home, ipls);
122 y = result(home,ret,x1);
123 else if (x1.
max() <= x0.
min())
124 y = result(home,ret,x0);
126 y = result(home,ret);
127 max(home, x0, x1,
y, ipls.
max2());
132 x[i] =
a[i].post(home, ipls);
133 y = result(home,ret);
134 max(home,
x,
y, ipls.
max());
140 IntVar x0 =
a[0].post(home, ipls);
141 IntVar x1 =
a[1].post(home, ipls);
143 y = result(home,ret,x0);
145 y = result(home,ret,x1);
147 y = result(home,ret,x1);
149 y = result(home,ret,x0);
151 y = result(home,ret);
159 IntVar x0 =
a[0].post(home, ipls);
160 IntVar x1 =
a[1].post(home, ipls);
163 y = result(home,ret,x0);
165 y = result(home,ret,x0);
167 y = result(home,ret);
168 div(home, x0, x1,
y, ipls.
div());
175 IntVar x0 =
a[0].post(home, ipls);
176 IntVar x1 =
a[1].post(home, ipls);
177 y = result(home,ret);
178 mod(home, x0, x1,
y, ipls.
mod());
185 if (
x.assigned() && ((
x.val() == 0) || (
x.val() == 1)))
186 y = result(home,ret,
x);
188 y = result(home,ret);
197 if (
x.assigned() && ((
x.val() == 0) || (
x.val() == 1)))
198 y = result(home,ret,
x);
200 y = result(home,ret);
209 if (
x.assigned() && (aInt > 0) &&
210 ((
x.val() == 0) || (
x.val() == 1)))
211 y = result(home,ret,
x);
213 y = result(home,ret);
222 if (
x.assigned() && (aInt > 0) &&
223 ((
x.val() == 0) || (
x.val() == 1)))
224 y = result(home,ret,
x);
226 y = result(home,ret);
235 y = result(home,ret,
a[
z.val()].post(home, ipls));
238 bool assigned =
true;
239 for (
int i=
n-1; i--;) {
240 x[i] =
a[i].post(home, ipls);
241 if (!
x[i].assigned())
244 y = result(home,ret);
247 for (
int i=
n-1; i--;)
260 IntVar x0 =
a[0].post(home, ipls);
261 IntVar x1 =
a[1].post(home, ipls);
262 y = result(home,ret);
263 ite(home, c, x0, x1,
y, ipls.
ite());
277 x[i] =
a[i].post(home, ipls);
278 rel(home,
x, irt, c);
280 rel(home, post(home,
nullptr,ipls), irt, c);
285 rel(home, post(home,
nullptr,ipls), irt, c,
b);
301 using namespace MiniModel;
302 if (hasType(e, ArithNonLinIntExpr::ANLE_ABS))
304 ArithNonLinIntExpr* ae =
305 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_ABS,1);
312 using namespace MiniModel;
314 if (hasType(e0, ArithNonLinIntExpr::ANLE_MIN))
315 n +=
static_cast<ArithNonLinIntExpr*
>(e0.
nle())->n;
318 if (hasType(e1, ArithNonLinIntExpr::ANLE_MIN))
319 n +=
static_cast<ArithNonLinIntExpr*
>(e1.
nle())->n;
322 ArithNonLinIntExpr* ae =
323 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MIN,
n);
325 if (hasType(e0, ArithNonLinIntExpr::ANLE_MIN)) {
326 ArithNonLinIntExpr* e0e =
static_cast<ArithNonLinIntExpr*
>(e0.
nle());
327 for (; i<e0e->
n; i++)
328 ae->a[i] = e0e->a[i];
332 if (hasType(e1, ArithNonLinIntExpr::ANLE_MIN)) {
333 ArithNonLinIntExpr* e1e =
static_cast<ArithNonLinIntExpr*
>(e1.
nle());
335 for (; i<curN+e1e->
n; i++)
336 ae->
a[i] = e1e->a[i-curN];
345 using namespace MiniModel;
347 if (hasType(e0, ArithNonLinIntExpr::ANLE_MAX))
348 n +=
static_cast<ArithNonLinIntExpr*
>(e0.
nle())->n;
351 if (hasType(e1, ArithNonLinIntExpr::ANLE_MAX))
352 n +=
static_cast<ArithNonLinIntExpr*
>(e1.
nle())->n;
355 ArithNonLinIntExpr* ae =
356 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MAX,
n);
358 if (hasType(e0, ArithNonLinIntExpr::ANLE_MAX)) {
359 ArithNonLinIntExpr* e0e =
static_cast<ArithNonLinIntExpr*
>(e0.
nle());
360 for (; i<e0e->
n; i++)
361 ae->a[i] = e0e->a[i];
365 if (hasType(e1, ArithNonLinIntExpr::ANLE_MAX)) {
366 ArithNonLinIntExpr* e1e =
static_cast<ArithNonLinIntExpr*
>(e1.
nle());
368 for (; i<curN+e1e->
n; i++)
369 ae->
a[i] = e1e->a[i-curN];
378 using namespace MiniModel;
379 ArithNonLinIntExpr* ae =
380 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MIN,
x.size());
381 for (
int i=
x.size(); i--;)
388 using namespace MiniModel;
389 ArithNonLinIntExpr* ae =
390 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MAX,
x.size());
391 for (
int i=
x.size(); i--;)
398 using namespace MiniModel;
399 ArithNonLinIntExpr* ae =
400 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MULT,2);
408 using namespace MiniModel;
409 ArithNonLinIntExpr* ae =
410 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_SQR,1);
417 using namespace MiniModel;
418 ArithNonLinIntExpr* ae =
419 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_SQRT,1);
426 using namespace MiniModel;
427 ArithNonLinIntExpr* ae =
428 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_POW,1,
n);
435 using namespace MiniModel;
436 ArithNonLinIntExpr* ae =
437 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_NROOT,1,
n);
444 using namespace MiniModel;
445 ArithNonLinIntExpr* ae =
446 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_DIV,2);
454 using namespace MiniModel;
455 ArithNonLinIntExpr* ae =
456 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MOD,2);
464 using namespace MiniModel;
465 ArithNonLinIntExpr* ae =
466 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_ELMNT,
x.size()+1);
467 for (
int i=
x.size(); i--;)
475 using namespace MiniModel;
476 ArithNonLinIntExpr* ae =
477 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_ELMNT,
x.size()+1);
478 for (
int i=
x.size(); i--;)
486 using namespace MiniModel;
487 ArithNonLinIntExpr* ae =
488 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_ITE,2,
b);
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
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.
Boolean integer variables.
void free(T *b, long unsigned int n)
Delete n objects starting at b.
Home class for posting propagators
Passing integer arguments.
Class for specifying integer propagation levels used by minimodel.
IntPropLevel div(void) const
Return integer propagation level for division constraints.
IntPropLevel element(void) const
Return integer propagation level for element constraints.
IntPropLevel mod(void) const
Return integer propagation level for modulo constraints.
IntPropLevel max2(void) const
Return integer propagation level for binary maximum constraints.
IntPropLevel ite(void) const
Return integer propagation level for if-then-else constraints.
IntPropLevel mult(void) const
Return integer propagation level for multiplication constraints.
IntPropLevel min(void) const
Return integer propagation level for non-binary minimum constraints.
IntPropLevel nroot(void) const
Return integer propagation level for root constraints.
IntPropLevel abs(void) const
Return integer propagation level for absolute value constraints.
IntPropLevel sqrt(void) const
Return integer propagation level for square root constraints.
IntPropLevel min2(void) const
Return integer propagation level for binary minimum constraints.
IntPropLevel pow(void) const
Return integer propagation level for power constraints.
IntPropLevel max(void) const
Return integer propagation level for non-binary maximum constraints.
IntPropLevel sqr(void) const
Return integer propagation level for square constraints.
Passing integer variables.
int min(void) const
Return minimum of domain.
int val(void) const
Return assigned value.
int max(void) const
Return maximum of domain.
Linear expressions over integer variables.
NonLinIntExpr * nle(void) const
Return non-linear expression inside, or null if not non-linear.
Non-linear arithmetic expressions over integer variables.
virtual void post(Home home, IntRelType irt, int c, const IntPropLevels &ipls) const
Post expression to be in relation irt with c.
BoolExpr b
Boolean expression argument (used in ite for example)
ArithNonLinIntExpr(ArithNonLinIntExprType t0, int n0)
Constructor.
int aInt
Integer argument (used in nroot for example)
~ArithNonLinIntExpr(void)
Destructor.
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.
enum Gecode::MiniModel::ArithNonLinIntExpr::ArithNonLinIntExprType t
ArithNonLinIntExpr(ArithNonLinIntExprType t0, int n0, int a0)
Constructor.
ArithNonLinIntExprType
The expression type.
@ ANLE_NROOT
Nroot expression.
@ ANLE_MAX
Maximum expression.
@ ANLE_ELMNT
Element expression.
@ ANLE_MULT
Multiplication expression.
@ ANLE_MOD
Modulo expression.
@ ANLE_DIV
Division expression.
@ ANLE_SQRT
Square root expression.
@ ANLE_MIN
Minimum expression.
@ ANLE_ABS
Absolute value expression.
@ ANLE_SQR
Square expression.
@ ANLE_POW
Pow expression.
virtual IntVar post(Home home, IntVar *ret, const IntPropLevels &ipls) const
Post expression.
LinIntExpr * a
Expressions.
ArithNonLinIntExpr(ArithNonLinIntExprType t0, int n0, const BoolExpr &b0)
Constructor.
int n
Size of variable array.
Base class for non-linear expressions over integer variables.
bool assigned(void) const
Test whether view is assigned.
Heap heap
The single global heap.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
IntRelType
Relation types for integers.
@ IRT_GQ
Greater or equal ( )
@ IRT_LQ
Less or equal ( )
#define GECODE_MINIMODEL_EXPORT
bool hasType(const LinFloatExpr &e, ArithNonLinFloatExpr::ArithNonLinFloatExprType t)
Check if e is of type t.
Gecode toplevel namespace
FloatVal operator/(const FloatVal &x, const FloatVal &y)
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
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 element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Post propagator for SetVar x
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
LinIntExpr operator%(const LinIntExpr &x, const LinIntExpr &y)
Return expression for .
#define GECODE_NEVER
Assert that this command is never executed.