38 namespace Test {
namespace Int {
41 namespace MiniModelArithmetic {
53 :
Test(
"MiniModel::Mult::"+s,3,d) {
58 double d0 =
static_cast<double>(x[0]);
59 double d1 =
static_cast<double>(x[1]);
60 double d2 =
static_cast<double>(x[2]);
75 :
Test(
"MiniModel::Div::"+s,3,d) {
80 return (x[1] != 0) && (x[0] / x[1] == x[2]);
94 :
Test(
"MiniModel::Mod::"+s,3,d) {
99 return (x[1] != 0) && (x[0] % x[1] == x[2]);
113 :
Test(
"MiniModel::Plus::"+s,3,d) {
118 double d0 =
static_cast<double>(x[0]);
119 double d1 =
static_cast<double>(x[1]);
120 double d2 =
static_cast<double>(x[2]);
137 :
Test(
"MiniModel::Minus::"+s,3,d) {
142 double d0 =
static_cast<double>(x[0]);
143 double d1 =
static_cast<double>(x[1]);
144 double d2 =
static_cast<double>(x[2]);
161 :
Test(
"MiniModel::Sqr::"+s,2,d) {
166 double d0 =
static_cast<double>(x[0]);
167 double d1 =
static_cast<double>(x[1]);
182 :
Test(
"MiniModel::Sqrt::"+s,2,d) {
187 double d0 =
static_cast<double>(x[0]);
188 double d1 =
static_cast<double>(x[1]);
189 return (d0 >= 0) && (d0 >= d1*
d1) && (d0 < (d1+1)*(d1+1));
203 :
Test(
"MiniModel::Abs::"+
str(ipl)+
"::"+s,
209 double d0 =
static_cast<double>(x[0]);
210 double d1 =
static_cast<double>(x[1]);
211 return (d0<0.0 ? -d0 : d0) ==
d1;
225 :
Test(
"MiniModel::Min::Bin::"+s,3,d) {
244 :
Test(
"MiniModel::Max::Bin::"+s,3,d) {
273 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
293 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
306 static_cast<int>(
sqrt(static_cast<double>(Gecode::Int::Limits::max)))
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Test for subtraction constraint
Plus(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
const FloatNum max
Largest allowed float value.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Abs abs_bnd_min("C", d3, Gecode::IPL_BND)
Abs abs_dom_max("A", d1, Gecode::IPL_DOM)
Test for addition constraint
Abs abs_bnd_max("A", d1, Gecode::IPL_BND)
Mod(const std::string &s, const Gecode::IntSet &d)
Create and register test.
const int max
Largest allowed integer value.
const int min
Smallest allowed integer value.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
const FloatNum min
Smallest allowed float value.
Test for multiplication constraint
Test for binary minimum constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for n-ary minimmum constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for division constraint
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Test for division constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Max(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Abs abs_dom_min("C", d3, Gecode::IPL_DOM)
Gecode::IntPropLevel ipl
Propagation level.
Passing integer variables.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
bool testfix
Whether to perform fixpoint test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
IntPropLevel
Propagation levels for integer propagators.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Node * x
Pointer to corresponding Boolean expression node.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Abs abs_bnd_med("B", d2, Gecode::IPL_BND)
Base class for assignments
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Minus(const std::string &s, const Gecode::IntSet &d)
Create and register test.
Domain propagation Options: basic versus advanced propagation.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
MinNary(void)
Create and register test.
Mult(const std::string &s, const Gecode::IntSet &d)
Create and register test.
MaxNary(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode toplevel namespace
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for absolute value constraint
Abs(const std::string &s, const Gecode::IntSet &d, Gecode::IntPropLevel ipl)
Create and register test.
Sqrt(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for binary maximum constraint
Div(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for n-ary maximum constraint
Sqr(const std::string &s, const Gecode::IntSet &d)
Create and register test.
Abs abs_dom_med("B", d2, Gecode::IPL_DOM)
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Min(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution