Go to the documentation of this file.
47 namespace Test {
namespace Float {
79 if (curPb->extendAssignement(*
this))
return;
94 for (
int i =
n;
i--; )
105 for (
int i=0;
i<
n;
i++)
106 os <<
"[" <<
a[
i].
min() <<
"," <<
a[
i].max() <<
"]" << ((
i!=
n-1) ?
"," :
"}");
110 namespace Test {
namespace Float {
160 olog <<
ind(2) <<
"Initial: x[]=" <<
x
170 olog <<
ind(2) <<
"Initial: x[]=" <<
x
180 b.update(*
this, share, sr);
227 olog <<
ind(3) <<
"Posting reified propagator" << std::endl;
231 olog <<
ind(3) <<
"Posting propagator" << std::endl;
238 olog <<
ind(3) <<
"Fixpoint: " <<
x;
240 olog << std::endl <<
ind(3) <<
" --> " <<
x << std::endl;
250 olog <<
ind(4) <<
"x[" <<
i <<
"] ";
259 olog <<
" [" <<
n.min() <<
"," <<
n.max() <<
"]" << std::endl;
269 olog <<
ind(4) <<
"b = " <<
n << std::endl;
276 int i = skip ?
static_cast<int>(
Base::rand(
a.size())) : -1;
278 for (
int j=
a.size(); j--; )
280 if ((
x[j].
min() ==
a[j].
max()) || (
x[j].max() ==
a[j].min()))
313 for (
int j=
x.
size(); j--; ) {
317 if (cutDirections[
i]) {
394 olog <<
ind(3) <<
"Testing fixpoint on copy" << std::endl;
397 delete c;
return false;
400 if (
x[
i].
size() !=
c->x[
i].size()) {
401 delete c;
return false;
404 delete c;
return false;
407 olog <<
ind(3) <<
"Finished testing fixpoint on copy" << std::endl;
425 switch (assigmentType) {
446 if (!testsubsumed)
return true;
453 #define CHECK_TEST(T,M) \
455 olog << ind(3) << "Check: " << (M) << std::endl; \
457 problem = (M); delete s; goto failed; \
461 #define START_TEST(T) \
464 olog << ind(2) << "Testing: " << (T) << std::endl; \
480 const char*
test =
"NONE";
481 const char* problem =
"NONE";
489 post(*search_s,search_s->
x);
497 olog <<
ind(1) <<
"Assignment: " <<
a;
513 olog <<
ind(3) <<
"No copy" << std::endl;
519 olog <<
ind(3) <<
"Unshared copy" << std::endl;
528 olog <<
ind(3) <<
"Shared copy" << std::endl;
535 default: assert(
false);
546 START_TEST(
"Partial assignment (after posting)");
561 START_TEST(
"Assignment (after posting, disable)");
576 START_TEST(
"Partial assignment (after posting, disable)");
606 START_TEST(
"Partial assignment (before posting)");
626 if (!s->
prune(
a,testfix)) {
627 problem =
"No fixpoint";
642 START_TEST(
"Assignment reified (rewrite after post, <=>)");
652 START_TEST(
"Assignment reified (rewrite after post, =>)");
662 START_TEST(
"Assignment reified (rewrite after post, <=)");
672 START_TEST(
"Assignment reified (immediate rewrite, <=>)");
682 START_TEST(
"Assignment reified (immediate rewrite, =>)");
692 START_TEST(
"Assignment reified (immediate rewrite, <=)");
702 START_TEST(
"Assignment reified (before posting, <=>)");
718 START_TEST(
"Assignment reified (before posting, =>)");
732 START_TEST(
"Assignment reified (before posting, <=)");
748 START_TEST(
"Assignment reified (after posting, <=>)");
764 START_TEST(
"Assignment reified (after posting, =>)");
778 START_TEST(
"Assignment reified (after posting, <=)");
799 if (!s->
prune(
a,testfix)) {
800 problem =
"No fixpoint";
822 if (!s->
prune(
a,testfix)) {
823 problem =
"No fixpoint";
843 if (!s->
prune(
a,testfix)) {
844 problem =
"No fixpoint";
862 if (!search_s->
failed()) {
872 for (
int i=
a.size();
i--; ) {
885 if (!search_s->
failed()) {
892 if (e_s->
next() != NULL) {
893 problem =
"Excess solutions";
905 olog <<
"FAILURE" << std::endl
906 <<
ind(1) <<
"Test: " <<
test << std::endl
907 <<
ind(1) <<
"Problem: " << problem << std::endl;
909 olog <<
ind(1) <<
"Assignment: " <<
a << std::endl;
void disable(void)
Disable propagators in space and compute fixpoint (make all idle)
virtual Assignment * assignment(void) const
Create assignment.
virtual void operator++(void)
Move to next assignment.
Gecode::FloatNum cut(int *cutDirections)
Cut the bigger variable to an half sized interval. It returns the new size of the cut interval....
const Gecode::FloatNum step
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Gecode::Reify r
Reification information.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
#define START_TEST(T)
Start new test.
@ RM_PMI
Inverse implication for reification.
Gecode::FloatNum randFValDown(Gecode::FloatNum l, Gecode::FloatNum u)
Space * clone(bool share_data=true, bool share_info=true, CloneStatistics &stat=unused_clone) const
Clone space.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
unsigned int size(I &i)
Size of all ranges of range iterator i.
Reify eqv(BoolVar x)
Use equivalence for reification.
bool matchAssignment(const Assignment &a) const
Test whether all variables match assignment a.
unsigned int size(Space &home) const
Return number of propagators in a group.
Gecode::FloatVal * dsv
Iterator for each variable.
bool reified
Does the constraint also exist as reified constraint.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
@ RM_IMP
Implication for reification.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
virtual bool extendAssignement(Assignment &a) const
Complete the current assignment to get a feasible one (which satisfies all constraint)....
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
void disable(Space &home)
Disable all propagators in a group.
const FloatNum min
Smallest allowed float value.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
bool assigned(void) const
Test whether all variables are assigned.
ExecStatus subsumed(Space &home, Propagator &p, int c, TaskArray< Task > &t)
Check for subsumption (all tasks must be assigned)
Depth-first search engine.
bool reified
Whether the test is for a reified propagator.
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)=0
Post constraint.
FloatRelType
Relation types for floats.
bool assigned(void) const
Test whether view is assigned.
static Gecode::Support::RandomGenerator rand
Random number generator.
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
int size(void) const
Return size of array (number of elements)
bool failed(void)
Compute a fixpoint and check for failure.
virtual bool run(void)
Perform test.
void prune(int i)
Prune some random values from variable i.
Test * test
The test currently run.
Gecode::FloatNum randFValUp(Gecode::FloatNum l, Gecode::FloatNum u)
bool assigned(void) const
Test if all variables are assigned.
bool subsumed(const TestSpace &ts) const
Test if ts is subsumed or not (i.e. if there is no more propagator unless the assignment is an extend...
Gecode toplevel namespace
void enable(Space &home, bool s=true)
Enable all propagators in a group.
Reify pmi(BoolVar x)
Use reverse implication for reification.
Gecode::FloatVarArray x
Variables to be tested.
unsigned int propagators(void)
Return the number of propagators.
Generate all assignments.
Node * x
Pointer to corresponding Boolean expression node.
Gecode::FloatVal d
Initial domain.
static PropagatorGroup all
Group of all propagators.
Reification specification.
TestSpace(int n, Gecode::FloatVal &d, Gecode::FloatNum s, Test *t)
Create test space.
@ RM_EQV
Equivalence for reification (default)
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
FloatValBranch FLOAT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
bool log
Whether to log the tests.
std::ostream & operator<<(std::ostream &os, const Test::Float::Assignment &a)
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
double FloatNum
Floating point number base type.
Boolean integer variables.
Floating point rounding policy.
void rel(int i, Gecode::FloatRelType frt, Gecode::FloatVal n)
Perform integer tell operation on x[i].
@ FRT_LQ
Less or equal ( )
static bool fixpoint(void)
Throw a coin whether to compute a fixpoint.
Gecode::FloatVal d
Domain for each variable.
#define GECODE_NEVER
Assert that this command is never executed.
Gecode::FloatNum step
Step for going to next solution.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
virtual void operator++(void)
Move to next assignment.
void bound(void)
Assing a random variable to a random bound.
BoolVar var(void) const
Return Boolean control variable.
Generate random selection of assignments.
virtual bool ignore(const Assignment &a) const
Whether to ignore assignment for reification.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
bool overlap(const FloatVal &x, const FloatVal &y)
@ FRT_GQ
Greater or equal ( )
Gecode::FloatNum step
Step for going to next solution.
Space for executing tests.
ReifyMode
Mode for reification.
virtual void operator++(void)
Move to next assignment.
Simple class for describing identation.
void threads(double n)
Set number of parallel threads.
MaybeType
Type for comparisons and solutions.
struct Gecode::Space::@56::@58 c
Data available only during copying.
void enable(void)
Enable propagators in space.
ReifyMode mode(void) const
Return reification mode.
void post(void)
Post propagator.
Generate all assignments except the last variable and complete it to get a solution.
Base class for assignments
Reify imp(BoolVar x)
Use implication for reification.
int val(void) const
Return assigned value.
virtual void dropUntil(const Assignment &a)
Add constraints to skip solutions to the a assignment.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Gecode::FloatNum step
Step for next assignment.
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
#define CHECK_TEST(T, M)
Check the test result and handle failed test.
int n
Number of negative literals for node type.
void assign(const Assignment &a, MaybeType &sol, bool skip=false)
Assign all (or all but one, if skip is true) variables to values in a If assignment of a variable is ...
void prune(void)
Prune some random values for some random variable.
int n
Number of variables.
std::ostringstream olog
Stream used for logging.
@ SS_FAILED
Space is failed
const FloatNum max
Largest allowed float value.
unsigned int size(void) const
Return size (cardinality) of domain.