38 namespace Test {
namespace Int {
43 namespace Test {
namespace Int {
namespace Unary {
58 for (
int i=p.
size();
i--; )
65 :
Test(
"Unary::Man::Fix::"+str(o)+
"::"+str(p0)+
"::"+str(ipl0),
66 p0.
size(),o,o+st(p0),false,ipl0),
78 for (
int j=
i+1; j<x.
size(); j++)
79 if ((x[
i]+p[
i] > x[j]) && (x[j]+p[j] > x[
i]))
99 for (
int i=p.
size();
i--; )
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++) {
151 :
Test(
"Unary::Man::Flex::"+str(o)+
"::"+str(n)+
"::" 152 +str(minP)+
"::"+str(maxP)+
"::"+str(ipl0),
153 2*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o) {
166 for (
int i=0;
i<
n;
i++)
167 for (
int j=
i+1; j<
n; j++)
168 if ((x[
i]+x[n+
i] > x[j]) && (x[j]+x[n+j] > x[
i]))
179 for (
int i=s.
size();
i--;) {
180 s[
i] =
expr(home, off+x[
i]);
181 rel(home, s[i]+px[i] == e[i]);
182 rel(home, _minP <= px[i]);
183 rel(home, _maxP >= px[i]);
203 for (
int i=p.
size();
i--; )
210 :
Test(
"Unary::Opt::Flex::"+str(o)+
"::"+str(n)+
"::" 211 +str(minP)+
"::"+str(maxP)+
"::"+str(ipl0),
212 3*n,0,n*maxP,false,ipl0), _minP(minP), _maxP(maxP), off(o),
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]);
247 rel(home, _minP <= px[i]);
248 rel(home, _maxP >= px[i]);
251 for (
int i=0;
i<
n;
i++)
268 IntArgs p30(8, 4,0,2,9,3,7,5,0);
int off
Offset for start times.
int _minP
Minimum processing time.
int size(void) const
Return size of array (number of elements)
int size(void) const
Return size of array (number of elements)
int size(void) const
Return number of variables.
Test for unary constraint
int _maxP
Maximum processing time.
virtual bool solution(const Assignment &x) const
Test whether x is solution
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Help class to create and register tests.
virtual Assignment * assignment(void) const
Create and register initial assignment.
int l
Threshold for taking a task as optional.
int _minP
Minimum processing time.
int _maxP
Maximum processing time.
virtual Assignment * assignment(void) const
Create and register initial assignment.
const int max
Largest allowed integer value.
Generate random selection of assignments.
const int min
Smallest allowed integer value.
Iterator for basic and advanced integer propagation levels.
OptFixPUnary(const Gecode::IntArgs &p0, int o, Gecode::IntPropLevel ipl0)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
ManFixPUnary(const Gecode::IntArgs &p0, int o, Gecode::IntPropLevel ipl0)
Create and register test.
int p
Number of positive literals for node type.
Test for unary constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Generate random selection of assignments.
Test for unary constraint with optional tasks
int l
Threshold for taking a task as optional.
unsigned int size(I &i)
Size of all ranges of range iterator i.
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
virtual Assignment * assignment(void) const
Create and register initial assignment.
ArrayTraits< VarArgArray< Var > >::ArgsType slice(int start, int inc=1, int n=-1)
int off
Offset for start times.
Gecode::IntArgs p
The processing times.
OptFlexUnary(int n, int minP, int maxP, int o, Gecode::IntPropLevel ipl0)
Create and register test.
Passing integer variables.
Passing integer arguments.
Passing Boolean variables.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
IntPropLevel
Propagation levels for integer propagators.
Node * x
Pointer to corresponding Boolean expression node.
Test for unary constraint with optional tasks
Base class for assignments
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs p
The processing times.
Gecode toplevel namespace
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.
static int st(const Gecode::IntArgs &p)
Get a reasonable maximal start time.
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntPropLevel ipl)
Post propagators for scheduling tasks on unary resources.
Create(void)
Perform creation and registration.
virtual Assignment * assignment(void) const
Create and register initial assignment.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.