46 namespace Test {
namespace Assign {
74 : x(*this, n, 0, 1) {}
86 #ifdef GECODE_HAS_SET_VARS 95 : x(*this, n,
Gecode::IntSet::empty, d) {}
109 #ifdef GECODE_HAS_FLOAT_VARS 118 : x(*this, n, d.
min(), d.
max()) {}
159 :
Base(
"Int::Assign::"+s), arity(a),
dom(d) {
166 post(*root, root->
x);
192 delete s; solutions++;
194 if (solutions != 1) {
195 std::cout <<
"FAILURE" << std::endl
196 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
197 <<
"\t" << int_assign_name[val] << std::endl;
207 :
Base(
"Bool::Assign::"+s), arity(a) {
214 post(*root, root->
x);
217 for (
int val = n_int_assign; val--; ) {
239 delete s; solutions++;
241 if (solutions != 1) {
242 std::cout <<
"FAILURE" << std::endl
243 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
244 <<
"\t" << int_assign_name[val] << std::endl;
253 #ifdef GECODE_HAS_SET_VARS 260 const char* set_assign_name[] = {
262 "SET_ASSIGN_MIN_INC",
263 "SET_ASSIGN_MIN_EXC",
264 "SET_ASSIGN_MED_INC",
265 "SET_ASSIGN_MED_EXC",
266 "SET_ASSIGN_MAX_INC",
267 "SET_ASSIGN_MAX_EXC",
268 "SET_ASSIGN_RND_INC",
269 "SET_ASSIGN_RND_EXC",
273 const int n_set_assign =
274 sizeof(set_assign_name)/
sizeof(
const char*);
290 post(*root, root->
x);
293 for (
int val = n_int_assign; val--; ) {
321 delete s; solutions++;
323 if (solutions != 1) {
324 std::cout <<
"FAILURE" << std::endl
325 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
326 <<
"\t" << set_assign_name[val] << std::endl;
337 #ifdef GECODE_HAS_FLOAT_VARS 344 const char* float_assign_name[] = {
352 const int n_float_assign =
353 sizeof(float_assign_name)/
sizeof(
const char*);
370 post(*root, root->
x);
373 for (
int val = n_float_assign; val--; ) {
396 delete s; solutions++;
398 if (solutions != 1) {
399 std::cout <<
"FAILURE" << std::endl
400 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
401 <<
"\t" << float_assign_name[val] << std::endl;
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
FloatTestSpace(int n, const Gecode::FloatVal &d)
Initialize test space.
int min(void) const
Return minimum of domain.
const char * int_assign_name[]
Names for integer assignments.
int int_val(const Gecode::Space &, Gecode::IntVar x, int)
Test function for branch value function.
IntTestSpace(bool share, IntTestSpace &s)
Constructor for cloning s.
SetAssign SET_ASSIGN_MIN_EXC(void)
Exclude smallest element.
virtual bool run(void)
Perform test.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
int set_val(const Gecode::Space &, Gecode::SetVar x, int)
Test function for branch value function.
const int n_int_assign
Number of integer value selections.
const FloatNum max
Largest allowed float value.
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
static Gecode::Support::RandomGenerator rand
Random number generator.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
Base(const std::string &s)
Create and register test with name s.
FloatTestSpace(bool share, FloatTestSpace &s)
Constructor for cloning s.
IntAssign INT_ASSIGN_MED(void)
Select greatest value not greater than the median.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
Gecode::FloatNumBranch float_val(const Gecode::Space &, Gecode::FloatVar x, int)
Test function for branch value function.
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
BoolTestSpace(bool share, BoolTestSpace &s)
Constructor for cloning s.
SetTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
SetAssign SET_ASSIGN_MAX_INC(void)
Include largest element.
int min(void) const
Return smallest value of range.
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
Exclude random element.
SetTestSpace(int n, const Gecode::IntSet &d)
Initialize test space.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
Iterator for the unknown ranges of a set variable.
Space for executing Boolean tests.
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
virtual void post(Gecode::Space &home, Gecode::BoolVarArray &x)=0
Post assignment on variables x.
SetAssign SET_ASSIGN_MAX_EXC(void)
Exclude largest element.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
SetTestSpace(bool share, SetTestSpace &s)
Constructor for cloning s.
const FloatNum min
Smallest allowed float value.
FloatNum n
The middle value for branching.
virtual bool run(void)
Perform test.
int n
Number of negative literals for node type.
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
IntAssign INT_ASSIGN_RND(Rnd r)
Select random value.
Value description class for branching.
IntTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
IntAssign INT_ASSIGN_MAX(void)
Select largest value.
int bool_val(const Gecode::Space &, Gecode::BoolVar x, int)
Test function for branch value function.
int arity
Number of variables.
bool l
Whether to try the lower or upper half first.
Base class for all tests to be run
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
virtual bool run(void)
Perform test.
virtual bool run(void)
Perform test.
Space for executing Boolean tests.
FloatNum med(void) const
Return median of domain.
Space for executing integer tests.
Boolean integer variables.
SetAssign SET_ASSIGN_MIN_INC(void)
Include smallest element.
SetAssign SET_ASSIGN_MED_INC(void)
Include median element (rounding downwards)
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c.
Space * clone(bool share=true, CloneStatistics &stat=unused_clone) const
Clone space.
BrancherHandle assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
Node * x
Pointer to corresponding Boolean expression node.
Space(void)
Default constructor.
Gecode::FloatVarArray x
Variables to be tested.
int min(void) const
Return minimum of domain.
SetAssign SET_ASSIGN_MED_EXC(void)
Exclude median element (rounding downwards)
Which values to select for assignment.
Gecode::BoolVarArray x
Variables to be tested.
BoolTestSpace(int n)
Initialize test space.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Which values to select for assignment.
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
Space for executing Boolean tests.
FloatTest(const std::string &s, int a, const Gecode::FloatVal &d)
Construct and register test.
Which value to select for assignment.
Gecode toplevel namespace
Gecode::IntVarArray x
Variables to be tested.
SetAssign SET_ASSIGN_RND_INC(Rnd r)
Include random element.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
Depth-first search engine.
Gecode::SetVarArray x
Variables to be tested.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
BoolTest(const std::string &s, int a)
Construct and register test.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
const bool clone
Whether engines create a clone when being initialized.
IntTestSpace(int n, Gecode::IntSet &d)
Initialize test space.