56 :
Test(
"Wait::Int::"+
str(n)+
"::"+
57 (sf0 ?
"std::function" :
"funptr"),n,0,n,false),
sf(sf0) {}
60 for (
int i=0; i<x.size(); i++)
61 for (
int j=i+1; j<x.size(); j++)
69 auto f =
static_cast<std::function<
void(
Space&)
>>
70 ([](
Space& home) {
c(home); });
73 Gecode::wait(home, x, f);
75 Gecode::wait(home, x, &c);
78 Gecode::wait(home, x[0], f);
80 Gecode::wait(home, x[0], &c);
86 for (
int i=0; i<home.
x.
size(); i++)
87 for (
int j=i+1; j<home.
x.
size(); j++)
88 if (home.
x[i].val() == home.
x[j].val())
101 :
Test(
"Wait::Bool::"+
str(n)+
"::"+
102 (sf0 ?
"std::function" :
"funptr"),n,0,1,false),
sf(sf0) {}
106 for (
int i=0; i<
x.size(); i++)
114 for (
int i=b.
size(); i--; )
116 auto f =
static_cast<std::function<
void(
Space&)
>>
117 ([](
Space& home) {
c(home); });
120 Gecode::wait(home, b, f);
122 Gecode::wait(home, b, &c);
125 Gecode::wait(home, b[0], f);
127 Gecode::wait(home, b[0], &c);
134 for (
int i=0; i<home.
x.
size(); i++)
135 t += home.
x[i].val();
150 (sf0 ?
"std::function" :
"funptr"),1,0,1,false),
sf(sf0) {}
159 auto sft =
static_cast<std::function<
void(
Space&)
>>
160 ([](
Space& home) {
t(home); });
161 auto sfe =
static_cast<std::function<
void(
Space&)
>>
162 ([](
Space& home) {
e(home); });
Passing Boolean variables.
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
int size(void) const
Return size of array (number of elements)
Base class for assignments
Simple test for wait (Boolean variables)
bool sf
Whether to use std::function.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post wait on x.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
static void c(Gecode::Space &_home)
Continuation to be executed.
BoolWait(int n, bool sf0)
Create and register test.
Simple test for wait (integer variables)
IntWait(int n, bool sf0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post wait on x.
bool sf
Whether to use std::function.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
static void c(Gecode::Space &_home)
Continuation to be executed.
static void t(Gecode::Space &home)
Then-function to be executed.
bool sf
Whether to use std::function.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post when on x.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
When(bool sf0)
Create and register test.
static void e(Gecode::Space &home)
Else-function to be executed.
Space for executing tests.
Gecode::IntVarArray x
Variables to be tested.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
void fail(void)
Fail space.
Gecode toplevel namespace
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
void when(Home home, BoolVar x, std::function< void(Space &home)> t, std::function< void(Space &home)> e, IntPropLevel ipl=IPL_DEF)
Execute t (then) when x is assigned one, and e (else) otherwise.
Post propagator for SetVar x
Tests for synchronized execution
Testing finite domain integers.