42 namespace Test {
namespace Int {
45 namespace MiniModelArithmetic {
57 :
Test(
"MiniModel::Mult::"+s,3,
d) {
62 double d0 =
static_cast<double>(
x[0]);
63 double d1 =
static_cast<double>(
x[1]);
64 double d2 =
static_cast<double>(
x[2]);
79 :
Test(
"MiniModel::Div::"+s,3,
d) {
84 return (
x[1] != 0) && (
x[0] /
x[1] ==
x[2]);
98 :
Test(
"MiniModel::Mod::"+s,3,
d) {
103 return (
x[1] != 0) && (
x[0] %
x[1] ==
x[2]);
117 :
Test(
"MiniModel::Plus::"+s,3,
d) {
122 double d0 =
static_cast<double>(
x[0]);
123 double d1 =
static_cast<double>(
x[1]);
124 double d2 =
static_cast<double>(
x[2]);
141 :
Test(
"MiniModel::Minus::"+s,3,
d) {
146 double d0 =
static_cast<double>(
x[0]);
147 double d1 =
static_cast<double>(
x[1]);
148 double d2 =
static_cast<double>(
x[2]);
165 :
Test(
"MiniModel::Sqr::"+s,2,
d) {
170 double d0 =
static_cast<double>(
x[0]);
171 double d1 =
static_cast<double>(
x[1]);
186 :
Test(
"MiniModel::Sqrt::"+s,2,
d) {
191 double d0 =
static_cast<double>(
x[0]);
192 double d1 =
static_cast<double>(
x[1]);
193 return (d0 >= 0) && (d0 >=
d1*
d1) && (d0 < (
d1+1)*(
d1+1));
213 double d0 =
static_cast<double>(
x[0]);
214 double d1 =
static_cast<double>(
x[1]);
215 return (d0<0.0 ? -d0 : d0) ==
d1;
229 :
Test(
"MiniModel::Min::Bin::"+s,3,
d) {
248 :
Test(
"MiniModel::Max::Bin::"+s,3,
d) {
277 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
297 m[0]=
x[0]; m[1]=
x[1]; m[2]=
x[2];
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 Preferences: prefer speed or memory.
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