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]);
65 using namespace Gecode;
75 :
Test(
"MiniModel::Div::"+s,3,
d) {
80 return (
x[1] != 0) && (
x[0] /
x[1] ==
x[2]);
84 using namespace Gecode;
94 :
Test(
"MiniModel::Mod::"+s,3,
d) {
99 return (
x[1] != 0) && (
x[0] %
x[1] ==
x[2]);
103 using namespace Gecode;
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]);
127 using namespace Gecode;
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]);
151 using namespace Gecode;
161 :
Test(
"MiniModel::Sqr::"+s,2,
d) {
166 double d0 =
static_cast<double>(
x[0]);
167 double d1 =
static_cast<double>(
x[1]);
172 using namespace Gecode;
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));
193 using namespace Gecode;
209 double d0 =
static_cast<double>(
x[0]);
210 double d1 =
static_cast<double>(
x[1]);
211 return (d0<0.0 ? -d0 : d0) ==
d1;
215 using namespace Gecode;
225 :
Test(
"MiniModel::Min::Bin::"+s,3,
d) {
234 using namespace Gecode;
244 :
Test(
"MiniModel::Max::Bin::"+s,3,
d) {
253 using namespace Gecode;
271 using namespace Gecode;
273 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
291 using namespace Gecode;
293 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
Node * x
Pointer to corresponding Boolean expression node.
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 sqr(Home home, FloatVar x0, FloatVar x1)
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 rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_BND
Bounds propagation.
const FloatNum max
Largest allowed float value.
const FloatNum min
Smallest allowed float value.
const int min
Smallest allowed integer value.
const int max
Largest allowed integer value.
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)