42 namespace Test {
namespace Float {
61 dsv(new Gecode::FloatVal[static_cast<unsigned int>(n)]),
63 using namespace Gecode;
73 assert((i>=0) && (i<
n));
78 assert((i>=0) && (i<
n));
89 dsv(new Gecode::
FloatVal[static_cast<unsigned int>(n)]),
91 using namespace Gecode;
92 for (
int i=n-1;
i--; )
102 assert((i>=0) && (i<
n));
107 assert((i>=0) && (i<
n));
117 using namespace Gecode;
118 using namespace Gecode::Float;
146 assert((i>=0) && (i<
n));
151 assert((i>=0) && (i<
n));
179 :
Base(
"Float::"+s), arity(a),
dom(d),
step(st), assigmentType(at),
180 reified(r), rms((1 << Gecode::
RM_EQV) ||
183 testsearch(true), testfix(true), testsubsumed(true) {}
189 :
Base(
"Float::"+s), arity(a),
dom(min,max),
step(st),
190 assigmentType(at), reified(r),
191 rms((1 << Gecode::
RM_EQV) ||
194 testsearch(true), testfix(true), testsubsumed(true) {}
199 using namespace Gecode;
225 s <<
"[" << f.
min() <<
":" << f.
max() <<
"]";
233 for (
int i=0;
i<x.
size()-1;
i++)
234 s +=
str(x[
i]) +
",";
235 return "[" + s +
str(x[x.
size()-1]) +
"]";
240 using namespace Gecode;
static MaybeType eq(Gecode::FloatVal x, Gecode::FloatVal y)
Whether x and y are equal.
const Gecode::FloatNum step
virtual ~RandomAssignment(void)
Destructor.
virtual Gecode::FloatVal operator[](int i) const
Return value for variable i.
AssignmentType
Assignment possible types.
bool operator()(void) const
Test whether iterator is done.
Inverse implication for reification.
void reset(void)
Reset iterator.
const FloatNum max
Largest allowed float value.
virtual bool operator()(void) const
Test whether all assignments have been iterated.
int size(void) const
Return size of array (number of elements)
static Gecode::Support::RandomGenerator rand
Random number generator.
Test(const std::string &s, int a, const Gecode::FloatVal &d, Gecode::FloatNum st, AssignmentType at, bool r)
Constructor.
Gecode::FloatNum step
Step for next assignment.
Base class for tests with float constraints
virtual void set(int i, const Gecode::FloatVal &val)
Set assignment to value val for variable i.
ExtAssignment(int n, const Gecode::FloatVal &d, Gecode::FloatNum s, const Test *pb)
Initialize assignments for n variables and values d with step s.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
static MaybeType cmp(Gecode::FloatVal x, Gecode::FloatRelType r, Gecode::FloatVal y)
Compare x and y with respect to r.
virtual bool operator()(void) const
Test whether all assignments have been iterated.
int n
Number of variables.
static std::string str(Gecode::FloatRelType frt)
Map float relation to string.
bool pmi(void) const
Test whether reverse implication as reification mode is supported.
const int max
Largest allowed integer value.
Gecode::FloatRelType frt(void) const
Return current relation type.
FloatRelTypes(void)
Initialize iterator.
int a
How many assigments still to be generated Generate new value according to do...
bool imp(void) const
Test whether implication as reification mode is supported.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual ~Assignment(void)
Destructor.
CpltAssignment(int n, const Gecode::FloatVal &d, Gecode::FloatNum s)
Initialize assignments for n variables and values d with step s.
Gecode::FloatNum randval(void)
int n
Number of negative literals for node type.
FloatRelType
Relation types for floats.
RandomAssignment(int n, const Gecode::FloatVal &d, int a)
Initialize for a assignments for n variables and values d.
Base class for all tests to be run
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
Floating point rounding policy.
virtual ~ExtAssignment(void)
Destructor.
virtual Gecode::FloatVal operator[](int i) const
Return value for variable i.
struct Gecode::@519::NNF::@60::@61 b
For binary nodes (and, or, eqv)
void operator++(void)
Increment to next relation type.
Node * x
Pointer to corresponding Boolean expression node.
Gecode::FloatVal d
Domain for each variable.
MaybeType
Type for comparisons and solutions.
Gecode::FloatVal * dsv
Iterator for each variable.
MaybeType operator&(MaybeType a, MaybeType b)
Three-valued conjunction of MaybeType.
int size(void) const
Return number of variables.
Gecode::FloatVal * vals
The current values for the variables.
virtual void set(int i, const Gecode::FloatVal &val)
Set assignment to value val for variable i.
virtual Gecode::FloatVal operator[](int i) const
Return value for variable i.
virtual bool operator()(void) const
Test whether all assignments have been iterated.
Implication for reification.
Gecode::FloatVal * dsv
Iterator for each variable.
bool reified
Does the constraint also exist as reified constraint.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
double FloatNum
Floating point number base type.
#define GECODE_NEVER
Assert that this command is never executed.
virtual void set(int i, const Gecode::FloatVal &val)
Set assignment to value val for variable i.
virtual ~CpltAssignment(void)
Destructor.
int rms
Which reification modes are supported.
bool eqv(void) const
Test whether equivalence as reification mode is supported.
Assignment(int n0, const Gecode::FloatVal &d0)
Initialize assignments for n0 variables and values d0.
bool flip(void)
Flip a coin and return true or false randomly.
Base class for assignments
Equivalence for reification (default)