42 namespace Test {
namespace Assign {
70 :
x(*this,
n, 0, 1) {}
82 #ifdef GECODE_HAS_SET_VARS
91 :
x(*this,
n, Gecode::IntSet::empty,
d) {}
105 #ifdef GECODE_HAS_FLOAT_VARS
134 const char* int_assign_name[] = {
142 const int n_int_assign =
143 sizeof(int_assign_name)/
sizeof(
const char*);
156 const char* bool_assign_name[] = {
163 const int n_bool_assign =
164 sizeof(bool_assign_name)/
sizeof(
const char*);
172 :
Base(
"Int::Assign::"+s), arity(
a), dom(
d) {
177 using namespace Gecode;
178 IntTestSpace* root =
new IntTestSpace(
arity,
dom);
179 post(*root, root->x);
180 (void) root->status();
182 for (
int val = 0; val<n_int_assign; val++) {
183 IntTestSpace*
clone =
static_cast<IntTestSpace*
>(root->clone());
205 while (
Space* s = e_s.next()) {
209 std::cout <<
"FAILURE" << std::endl
210 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
211 <<
"\t" << int_assign_name[val] << std::endl;
226 using namespace Gecode;
227 BoolTestSpace* root =
new BoolTestSpace(
arity);
228 post(*root, root->x);
229 (void) root->status();
231 for (
int val = n_bool_assign; val--; ) {
232 BoolTestSpace*
clone =
static_cast<BoolTestSpace*
>(root->clone());
252 while (
Space* s = e_s.next()) {
256 std::cout <<
"FAILURE" << std::endl
257 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
258 <<
"\t" << int_assign_name[val] << std::endl;
267 #ifdef GECODE_HAS_SET_VARS
275 const char* set_assign_name[] = {
276 "SET_ASSIGN_MIN_INC",
277 "SET_ASSIGN_MIN_EXC",
278 "SET_ASSIGN_MED_INC",
279 "SET_ASSIGN_MED_EXC",
280 "SET_ASSIGN_MAX_INC",
281 "SET_ASSIGN_MAX_EXC",
282 "SET_ASSIGN_RND_INC",
283 "SET_ASSIGN_RND_EXC",
287 const int n_set_assign =
288 sizeof(set_assign_name)/
sizeof(
const char*);
302 using namespace Gecode;
303 SetTestSpace* root =
new SetTestSpace(
arity,
dom);
304 post(*root, root->x);
305 (void) root->status();
307 for (
int val = n_set_assign; val--; ) {
308 SetTestSpace*
clone =
static_cast<SetTestSpace*
>(root->clone());
335 while (
Space* s = e_s.next()) {
339 std::cout <<
"FAILURE" << std::endl
340 <<
"\tc_d=" << o.
c_d <<
", a_d=" << o.
a_d << std::endl
341 <<
"\t" << set_assign_name[val] << std::endl;
352 #ifdef GECODE_HAS_FLOAT_VARS
360 const char* float_assign_name[] = {
367 const int n_float_assign =
368 sizeof(float_assign_name)/
sizeof(
const char*);
383 using namespace Gecode;
384 FloatTestSpace* root =
new FloatTestSpace(
arity,
dom);
385 post(*root, root->x);
386 (void) root->status();
388 for (
int val = n_float_assign; val--; ) {
389 FloatTestSpace*
clone =
static_cast<FloatTestSpace*
>(root->clone());
411 while (
Space* s = e_s.next()) {
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;
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Which values to select for assignment.
Boolean integer variables.
Depth-first search engine.
Which values to select for assignment.
Value description class for branching.
bool l
Whether to try the lower or upper half first.
FloatNum n
The middle value for branching.
Which values to select for assignment.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
Which value to select for assignment.
Iterator for the unknown ranges of a set variable.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Space for executing Boolean tests.
virtual Gecode::Space * copy(void)
Copy space during cloning.
BoolTestSpace(int n)
Initialize test space.
Gecode::BoolVarArray x
Variables to be tested.
BoolTestSpace(BoolTestSpace &s)
Constructor for cloning s.
int bool_val(const Gecode::Space &, Gecode::BoolVar x, int)
Test function for branch value function.
virtual bool run(void)
Perform test.
BoolTest(const std::string &s, int a)
Construct and register test.
int arity
Number of variables.
virtual void post(Gecode::Space &home, Gecode::BoolVarArray &x)=0
Post assignment on variables x.
Space for executing Boolean tests.
Gecode::FloatNumBranch float_val(const Gecode::Space &, Gecode::FloatVar x, int)
Test function for branch value function.
Gecode::FloatVarArray x
Variables to be tested.
virtual Gecode::Space * copy(void)
Copy space during cloning.
FloatTestSpace(FloatTestSpace &s)
Constructor for cloning s.
FloatTestSpace(int n, const Gecode::FloatVal &d)
Initialize test space.
FloatTest(const std::string &s, int a, const Gecode::FloatVal &d)
Construct and register test.
Gecode::FloatVal dom
Domain of variables.
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)=0
Post assignment on variables x.
int arity
Number of variables.
virtual bool run(void)
Perform test.
Space for executing integer tests.
IntTestSpace(int n, Gecode::IntSet &d)
Initialize test space.
IntTestSpace(IntTestSpace &s)
Constructor for cloning s.
int int_val(const Gecode::Space &, Gecode::IntVar x, int)
Test function for branch value function.
virtual Gecode::Space * copy(void)
Copy space during cloning.
Gecode::IntVarArray x
Variables to be tested.
virtual bool run(void)
Perform test.
IntTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
Gecode::IntSet dom
Domain of variables.
int arity
Number of variables.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)=0
Post assignment on variables x.
Space for executing Boolean tests.
virtual Gecode::Space * copy(void)
Copy space during cloning.
SetTestSpace(int n, const Gecode::IntSet &d)
Initialize test space.
int set_val(const Gecode::Space &, Gecode::SetVar x, int)
Test function for branch value function.
Gecode::SetVarArray x
Variables to be tested.
SetTestSpace(SetTestSpace &s)
Constructor for cloning s.
int arity
Number of variables.
Gecode::IntSet dom
Upper bound of variable domains.
virtual bool run(void)
Perform test.
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x)=0
Post assignment on variables x.
SetTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
Base class for all tests to be run
static Gecode::Support::RandomGenerator rand
Random number generator.
Base(const std::string &s)
Create and register test with name s.
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with variable selection vars and value selection vals.
Space(void)
Default constructor.
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c.
IntAssign INT_ASSIGN_RND(Rnd r)
Select random value.
BoolAssign BOOL_ASSIGN_MAX(void)
Select largest value.
BoolAssign BOOL_ASSIGN_RND(Rnd r)
Select random value.
IntAssign INT_ASSIGN_MED(void)
Select greatest value not greater than the median.
BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c)
Select value as defined by the value function v and commit function c.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
BoolAssign BOOL_ASSIGN_MIN(void)
Select smallest value.
IntAssign INT_ASSIGN_MAX(void)
Select largest value.
const FloatNum max
Largest allowed float value.
const FloatNum min
Smallest allowed float value.
const bool clone
Whether engines create a clone when being initialized.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
SetAssign SET_ASSIGN_RND_INC(Rnd r)
SetAssign SET_ASSIGN_MIN_INC(void)
SetAssign SET_ASSIGN_MED_EXC(void)
SetAssign SET_ASSIGN_MED_INC(void)
SetAssign SET_ASSIGN_MAX_INC(void)
SetAssign SET_ASSIGN_MAX_EXC(void)
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
SetAssign SET_ASSIGN_MIN_EXC(void)
#define GECODE_NEVER
Assert that this command is never executed.