38 namespace Test {
namespace Int {
43 namespace Test {
namespace Int {
namespace Unary {
65 :
Test(
"Unary::Man::Fix::"+
str(o)+
"::"+
str(p0)+
"::"+
str(ipl0),
66 p0.
size(),o,o+
st(p0),false,ipl0),
77 for (
int i=0;
i<
x.size();
i++)
78 for (
int j=
i+1; j<
x.size(); j++)
79 if ((
x[
i]+
p[
i] >
x[j]) && (
x[j]+
p[j] >
x[
i]))
85 Gecode::unary(home,
x,
p,
ipl);
106 :
Test(
"Unary::Opt::Fix::"+
str(o)+
"::"+
str(p0)+
"::"+
str(ipl0),
107 2*p0.
size(),o,o+
st(p0),false,ipl0),
p(p0),
l(o+
st(
p)/2) {
117 int n =
x.size() / 2;
118 for (
int i=0;
i<
n;
i++)
120 for (
int j=
i+1; j<
n; j++)
122 if ((
x[
i]+
p[
i] >
x[j]) && (
x[j]+
p[j] >
x[
i]))
131 for (
int i=0;
i<
n;
i++) {
133 m[
i]=Gecode::expr(home, (
x[
n+
i] >
l));
135 Gecode::unary(home, s,
p, m,
ipl);
151 :
Test(
"Unary::Man::Flex::"+
str(o)+
"::"+
str(
n)+
"::"
152 +
str(minP)+
"::"+
str(maxP)+
"::"+
str(ipl0),
166 for (
int i=0;
i<
n;
i++)
167 for (
int j=
i+1; j<
n; j++)
179 for (
int i=s.
size();
i--;) {
180 s[
i] = expr(home,
off+
x[
i]);
181 rel(home, s[
i]+px[
i] == e[
i]);
185 Gecode::unary(home, s, px, e,
ipl);
203 for (
int i=
p.size();
i--; )
210 :
Test(
"Unary::Opt::Flex::"+
str(o)+
"::"+
str(
n)+
"::"
211 +
str(minP)+
"::"+
str(maxP)+
"::"+
str(ipl0),
225 int n =
x.size() / 3;
226 for (
int i=0;
i<
n;
i++)
228 for (
int j=
i+1; j<
n; j++)
230 if ((
x[
i]+
x[2*
n+
i] >
x[j]) && (
x[j]+
x[2*
n+j] >
x[
i]))
243 for (
int i=
n;
i--;) {
244 s[
i] = expr(home,
off+
x[
i]);
246 rel(home, s[
i]+px[
i] == e[
i]);
251 for (
int i=0;
i<
n;
i++)
252 m[
i]=Gecode::expr(home, (
x[
n+
i] >
l));
253 Gecode::unary(home, s, px, e, m,
ipl);
262 using namespace Gecode;
268 IntArgs p30({4,0,2,9,3,7,5,0});
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Passing Boolean variables.
Passing integer arguments.
Passing integer variables.
Base class for assignments
Iterator for basic and advanced integer propagation levels.
Generate random selection of assignments.
Generate random selection of assignments.
bool testsearch
Whether to perform search test.
bool testfix
Whether to perform fixpoint test.
Gecode::IntPropLevel ipl
Propagation level.
int arity
Number of variables.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Gecode::IntSet dom
Domain of variables.
ConTestLevel contest
Whether to test for certain consistency.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Test for unary constraint
Gecode::IntArgs p
The processing times.
ManFixPUnary(const Gecode::IntArgs &p0, int o, Gecode::IntPropLevel ipl0)
Create and register test.
virtual Assignment * assignment(void) const
Create and register initial assignment.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
Test for unary constraint
virtual Assignment * assignment(void) const
Create and register initial assignment.
int off
Offset for start times.
int _minP
Minimum processing time.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
int _maxP
Maximum processing time.
virtual bool solution(const Assignment &x) const
Test whether x is solution
ManFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0)
Create and register test.
Test for unary constraint with optional tasks
OptFixPUnary(const Gecode::IntArgs &p0, int o, Gecode::IntPropLevel ipl0)
Create and register test.
Gecode::IntArgs p
The processing times.
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
virtual Assignment * assignment(void) const
Create and register initial assignment.
virtual bool solution(const Assignment &x) const
Test whether x is solution
int l
Threshold for taking a task as optional.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for unary constraint with optional tasks
int _minP
Minimum processing time.
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
int off
Offset for start times.
virtual Assignment * assignment(void) const
Create and register initial assignment.
int l
Threshold for taking a task as optional.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
OptFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0)
Create and register test.
int _maxP
Maximum processing time.
virtual bool solution(const Assignment &x) const
Test whether x is solution
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
IntPropLevel
Propagation levels for integer propagators.
const int min
Smallest allowed integer value.
const int max
Largest allowed integer value.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})
@ CTL_NONE
No consistency-test.