Go to the documentation of this file.
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
133 const char* int_assign_name[] = {
142 const int n_int_assign =
143 sizeof(int_assign_name)/
sizeof(
const char*);
155 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) {
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;
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
274 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*);
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
359 const char* float_assign_name[] = {
367 const int n_float_assign =
368 sizeof(float_assign_name)/
sizeof(
const char*);
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;
bool l
Whether to try the lower or upper half first.
Gecode::BoolVarArray x
Variables to be tested.
BoolAssign BOOL_ASSIGN_RND(Rnd r)
Select random value.
BoolAssign BOOL_ASSIGN_MIN(void)
Select smallest value.
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
Gecode::IntSet dom
Domain of variables.
virtual Gecode::Space * copy(void)
Copy space during cloning.
BoolTestSpace(int n)
Initialize test space.
FloatTestSpace(FloatTestSpace &s)
Constructor for cloning s.
virtual bool run(void)
Perform test.
SetAssign SET_ASSIGN_MIN_INC(void)
int arity
Number of variables.
IntTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
SetTestSpace(SetTestSpace &s)
Constructor for cloning s.
FloatTestSpace(int n, const Gecode::FloatVal &d)
Initialize test space.
IntTestSpace(int n, Gecode::IntSet &d)
Initialize test space.
virtual Gecode::Space * copy(void)
Copy space during cloning.
virtual Gecode::Space * copy(void)
Copy space during cloning.
const FloatNum min
Smallest allowed float value.
SetAssign SET_ASSIGN_MED_INC(void)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)=0
Post assignment on variables x.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)=0
Post assignment on variables x.
Depth-first search engine.
Gecode::SetVarArray x
Variables to be tested.
int arity
Number of variables.
static Gecode::Support::RandomGenerator rand
Random number generator.
Which value to select for assignment.
FloatTest(const std::string &s, int a, const Gecode::FloatVal &d)
Construct and register test.
const bool clone
Whether engines create a clone when being initialized.
virtual bool run(void)
Perform test.
SetAssign SET_ASSIGN_MAX_EXC(void)
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
Gecode toplevel namespace
Base class for all tests to be run
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
IntTestSpace(IntTestSpace &s)
Constructor for cloning s.
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x)=0
Post assignment on variables x.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
Which values to select for assignment.
int arity
Number of variables.
virtual Gecode::Space * copy(void)
Copy space during cloning.
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
int bool_val(const Gecode::Space &, Gecode::BoolVar x, int)
Test function for branch value function.
BoolTestSpace(BoolTestSpace &s)
Constructor for cloning s.
SetAssign SET_ASSIGN_RND_INC(Rnd r)
BoolTest(const std::string &s, int a)
Construct and register test.
Gecode::IntSet dom
Upper bound of variable domains.
SetAssign SET_ASSIGN_MED_EXC(void)
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Gecode::FloatVarArray x
Variables to be tested.
Boolean integer variables.
Gecode::FloatVal dom
Domain of variables.
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
Value description class for branching.
FloatNum n
The middle value for branching.
SetAssign SET_ASSIGN_MAX_INC(void)
SetAssign SET_ASSIGN_MIN_EXC(void)
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.
IntAssign INT_ASSIGN_MAX(void)
Select largest value.
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
virtual bool run(void)
Perform test.
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c.
Space for executing integer tests.
Gecode::FloatNumBranch float_val(const Gecode::Space &, Gecode::FloatVar x, int)
Test function for branch value function.
IntAssign INT_ASSIGN_RND(Rnd r)
Select random value.
#define GECODE_NEVER
Assert that this command is never executed.
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
Space(void)
Default constructor.
virtual void post(Gecode::Space &home, Gecode::BoolVarArray &x)=0
Post assignment on variables x.
Gecode::IntVarArray x
Variables to be tested.
virtual bool run(void)
Perform test.
Space for executing Boolean tests.
Which values to select for assignment.
int set_val(const Gecode::Space &, Gecode::SetVar x, int)
Test function for branch value function.
int arity
Number of variables.
IntAssign INT_ASSIGN_MED(void)
Select greatest value not greater than the median.
BoolAssign BOOL_ASSIGN_MAX(void)
Select largest value.
SetTest(const std::string &s, int a, const Gecode::IntSet &d)
Construct and register test.
SetTestSpace(int n, const Gecode::IntSet &d)
Initialize test space.
Iterator for the unknown ranges of a set variable.
Space for executing Boolean tests.
Space for executing Boolean tests.
Which values to select for assignment.
int int_val(const Gecode::Space &, Gecode::IntVar x, int)
Test function for branch value function.
int n
Number of negative literals for node type.
BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c)
Select value as defined by the value function v and commit function c.
Base(const std::string &s)
Create and register test with name s.
const FloatNum max
Largest allowed float value.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.