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));
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) {
230 return std::min(
x[0],
x[1]) ==
x[2];
244 :
Test(
"MiniModel::Max::Bin::"+s,3,d) {
249 return std::max(
x[0],
x[1]) ==
x[2];
267 return std::min(std::min(
x[0],
x[1]),
x[2]) ==
x[3];
273 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
287 return std::max(std::max(
x[0],
x[1]),
x[2]) ==
x[3];
293 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
Passing integer variables.
Base class for assignments
Test for absolute value constraint
Abs(const std::string &s, const Gecode::IntSet &d, Gecode::IntPropLevel ipl)
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
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
Div(const std::string &s, const Gecode::IntSet &d)
Create and register test.
Test for n-ary maximum 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
MaxNary(void)
Create and register test.
Test for binary maximum constraint
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.
Max(const std::string &s, const Gecode::IntSet &d)
Create and register test.
Test for n-ary minimmum constraint
virtual bool solution(const Assignment &x) const
Test whether x is solution
MinNary(void)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for binary minimum constraint
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
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for subtraction constraint
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.
Minus(const std::string &s, const Gecode::IntSet &d)
Create and register test.
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
Mod(const std::string &s, const Gecode::IntSet &d)
Create and register test.
Test for multiplication constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Mult(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 addition constraint
Plus(const std::string &s, const Gecode::IntSet &d)
Create and register test.
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.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Sqr(const std::string &s, const Gecode::IntSet &d)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Sqrt(const std::string &s, const Gecode::IntSet &d)
Create and register test.
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.
bool testfix
Whether to perform fixpoint test.
Gecode::IntPropLevel ipl
Propagation level.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_BND
Bounds propagation.
const int min
Smallest allowed integer value.
const int max
Largest allowed integer value.
Gecode toplevel namespace
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntVar expr(Home home, const LinIntExpr &e, const IntPropLevels &ipls=IntPropLevels::def)
Post linear expression and return its value.
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 sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar x
Tests for minimal modelling constraints (arithmetic)
Abs abs_dom_min("C", d3, Gecode::IPL_DOM)
Abs abs_bnd_max("A", d1, Gecode::IPL_BND)
Abs abs_dom_med("B", d2, Gecode::IPL_DOM)
Abs abs_bnd_med("B", d2, Gecode::IPL_BND)
Abs abs_bnd_min("C", d3, Gecode::IPL_BND)
Abs abs_dom_max("A", d1, Gecode::IPL_DOM)
Testing finite domain integers.