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 const char* bool_assign_name[] = {
167 const int n_bool_assign =
168 sizeof(bool_assign_name)/
sizeof(
const char*);
176 :
Base(
"Int::Assign::"+s), arity(a),
dom(d) {
183 post(*root, root->
x);
209 delete s; solutions++;
211 if (solutions != 1) {
212 std::cout <<
"FAILURE" << std::endl
213 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
214 <<
"\t" << int_assign_name[val] << std::endl;
224 :
Base(
"Bool::Assign::"+s), arity(a) {
231 post(*root, root->
x);
234 for (
int val = n_bool_assign; val--; ) {
255 delete s; solutions++;
257 if (solutions != 1) {
258 std::cout <<
"FAILURE" << std::endl
259 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
260 <<
"\t" << int_assign_name[val] << std::endl;
269 #ifdef GECODE_HAS_SET_VARS 276 const char* set_assign_name[] = {
278 "SET_ASSIGN_MIN_INC",
279 "SET_ASSIGN_MIN_EXC",
280 "SET_ASSIGN_MED_INC",
281 "SET_ASSIGN_MED_EXC",
282 "SET_ASSIGN_MAX_INC",
283 "SET_ASSIGN_MAX_EXC",
284 "SET_ASSIGN_RND_INC",
285 "SET_ASSIGN_RND_EXC",
289 const int n_set_assign =
290 sizeof(set_assign_name)/
sizeof(
const char*);
306 post(*root, root->
x);
309 for (
int val = n_int_assign; val--; ) {
337 delete s; solutions++;
339 if (solutions != 1) {
340 std::cout <<
"FAILURE" << std::endl
341 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
342 <<
"\t" << set_assign_name[val] << std::endl;
353 #ifdef GECODE_HAS_FLOAT_VARS 360 const char* float_assign_name[] = {
368 const int n_float_assign =
369 sizeof(float_assign_name)/
sizeof(
const char*);
386 post(*root, root->
x);
389 for (
int val = n_float_assign; val--; ) {
412 delete s; solutions++;
414 if (solutions != 1) {
415 std::cout <<
"FAILURE" << std::endl
416 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
417 <<
"\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.
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.
BoolAssign BOOL_ASSIGN_MIN(void)
Select smallest value.
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.
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
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 .
Which values to select for assignment.
BoolTestSpace(bool share, BoolTestSpace &s)
Constructor for cloning s.
BoolAssign BOOL_ASSIGN_MAX(void)
Select largest value.
Space * clone(bool share_data=true, bool share_info=true, CloneStatistics &stat=unused_clone) const
Clone space.
SetTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
int min(void) const
Return smallest value of range.
SetAssign SET_ASSIGN_RND_INC(Rnd r)
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.
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.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
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.
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c.
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.
SetAssign SET_ASSIGN_MAX_INC(void)
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 arity
Number of variables.
bool l
Whether to try the lower or upper half first.
Base class for all tests to be run
BoolAssign BOOL_ASSIGN_RND(Rnd r)
Select random value.
BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c)
Select value as defined by the value function v and commit function c.
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.
SetAssign SET_ASSIGN_MED_INC(void)
Space for executing integer tests.
Boolean integer variables.
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
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_MIN_INC(void)
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
SetAssign SET_ASSIGN_MED_EXC(void)
Which values to select for assignment.
Gecode::BoolVarArray x
Variables to be tested.
int bool_val(const Gecode::Space &, Gecode::BoolVar x, int)
Test function for branch value function.
BoolTestSpace(int n)
Initialize test space.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Which values to select for assignment.
SetAssign SET_ASSIGN_MAX_EXC(void)
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.
SetAssign SET_ASSIGN_MIN_EXC(void)
Gecode toplevel namespace
Gecode::IntVarArray x
Variables to be tested.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
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.