Go to the documentation of this file.
42 namespace Test {
namespace Int {
45 namespace Cumulative {
65 for (
int i=
p.size();
i--; )
66 e +=
static_cast<double>(
p[
i])*
u[
i];
78 :
Test(
"Cumulative::Man::Fix::"+
str(o0)+
"::"+
80 (c0 >= 0) ? p0.
size():p0.
size()+1,0,
st(c0,p0,u0),false,ipl0),
81 c(c0),
p(p0),
u(u0),
o(o0) {
92 int cmax = (
c >= 0) ?
c :
x[
x.size()-1];
93 int n = (
c >= 0) ?
x.size() :
x.size()-1;
95 if (
c < 0 &&
x[
n] > -
c)
100 for (
int i=0;
i<
n;
i++)
103 int* used =
new int[
t];
104 for (
int i=0;
i<
t;
i++)
106 for (
int i=0;
i<
n;
i++)
107 for (
int t=0;
t<
p[
i];
t++)
108 used[
x[
i]+
t] +=
u[
i];
110 for (
int i=0;
i<
t;
i++)
111 if (used[
i] > cmax) {
116 for (
int i=0;
i<
t;
i++)
118 for (
int i=0;
i<
n;
i++) {
119 for (
int t=1;
t<
p[
i];
t++) {
120 used[
x[
i]+
t] +=
u[
i];
124 for (
int i=0;
i<
n;
i++)
125 if (used[
x[
i]]+
u[
i] > cmax) {
134 int n = (
c >= 0) ?
x.size() :
x.size()-1;
170 for (
int i=
p.size();
i--; )
171 e +=
static_cast<double>(
p[
i])*
u[
i];
181 :
Test(
"Cumulative::Opt::Fix::"+
str(o0)+
"::"+
183 (c0 >= 0) ? 2*p0.
size() : 2*p0.
size()+1,0,
st(c0,p0,u0),
196 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
197 int cmax = (
c >= 0) ?
c :
x[nn];
199 if (
c < 0 &&
x[nn] > -
c)
205 for (
int i=0;
i<
n;
i++)
208 int* used =
new int[
t];
209 for (
int i=0;
i<
t;
i++)
211 for (
int i=0;
i<
n;
i++)
213 for (
int t=0;
t<
p[
i];
t++)
214 used[
x[
i]+
t] +=
u[
i];
216 for (
int i=0;
i<
t;
i++) {
217 if (used[
i] > cmax) {
223 for (
int i=0;
i<
t;
i++)
225 for (
int i=0;
i<
n;
i++)
227 for (
int t=1;
t<
p[
i];
t++)
228 used[
x[
i]+
t] +=
u[
i];
231 for (
int i=0;
i<
n;
i++)
233 if (used[
x[
i]]+
u[
i] > cmax) {
242 int nn=(
c >= 0) ?
x.size() :
x.size()-1;
247 for (
int i=0;
i<
n;
i++) {
275 for (
int i=
u.size();
i--; )
276 e +=
static_cast<double>(maxP)*
u[
i];
287 :
Test(
"Cumulative::Man::Flex::"+
str(o0)+
"::"+
290 (c0 >= 0) ? 2*u0.
size() : 2*u0.
size()+1,
291 0,std::
max(maxP,
st(c0,maxP,u0)),false,ipl0),
305 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
307 int cmax = (
c >= 0) ?
c :
x[
n];
308 int pstart = (
c >= 0) ?
n :
n+1;
310 if (c < 0 && cmax > -
c)
315 for (
int i=0;
i<
n;
i++) {
319 int* used =
new int[
t];
320 for (
int i=0;
i<
t;
i++)
322 for (
int i=0;
i<
n;
i++)
323 for (
int t=0;
t<
x[pstart+
i];
t++)
324 used[
x[
i]+
t] +=
u[
i];
326 for (
int i=0;
i<
t;
i++)
327 if (used[
i] > cmax) {
332 for (
int i=0;
i<
t;
i++)
334 for (
int i=0;
i<
n;
i++) {
335 for (
int t=1;
t<
x[pstart+
i];
t++)
336 used[
x[
i]+
t] +=
u[
i];
339 for (
int i=0;
i<
n;
i++)
340 if (used[
x[
i]]+
u[
i] > cmax) {
349 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
351 int pstart = (
c >= 0) ?
n :
n+1;
357 for (
int i=s.size();
i--;) {
359 rel(home, s[
i]+px[
i] == e[
i]);
390 for (
int i=
u.size();
i--; )
391 e +=
static_cast<double>(maxP)*
u[
i];
400 :
Test(
"Cumulative::Opt::Flex::"+
str(o0)+
"::"+
403 (c0 >= 0) ? 3*u0.
size() : 3*u0.
size()+1,
404 0,std::
max(maxP,
st(c0,maxP,u0)), false,ipl0),
406 l(std::
max(maxP,
st(c0,maxP,u0))/2),
o(o0) {
419 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
421 int cmax = (
c >= 0) ?
c :
x[2*
n];
422 int pstart = (
c >= 0) ? 2*
n : 2*
n+1;
424 if (c < 0 && cmax > -
c)
429 for (
int i=0;
i<
n;
i++)
432 int* used =
new int[
t];
433 for (
int i=0;
i<
t;
i++)
435 for (
int i=0;
i<
n;
i++)
437 for (
int t=0;
t<
x[pstart+
i];
t++)
438 used[
x[
i]+
t] +=
u[
i];
440 for (
int i=0;
i<
t;
i++)
441 if (used[
i] > cmax) {
446 for (
int i=0;
i<
t;
i++)
448 for (
int i=0;
i<
n;
i++)
450 for (
int t=1;
t<
x[pstart+
i];
t++)
451 used[
x[
i]+
t] +=
u[
i];
453 for (
int i=0;
i<
n;
i++)
454 if (
x[
n+
i] >
l && used[
x[
i]]+
u[
i] > cmax) {
463 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
465 int pstart= (
c >= 0) ? 2*
n : 2*
n+1;
472 for (
int i=
n;
i--;) {
475 rel(home, s[
i]+px[
i] == e[
i]);
480 for (
int i=0;
i<
n;
i++)
513 for (
int c=-7;
c<8;
c++) {
515 for (
int coff=0; coff<2; coff++) {
Gecode::IntArgs u
The resource usage.
int c
Capacity of resource.
bool testsearch
Whether to perform search test.
ConTestLevel contest
Whether to test for certain consistency.
Test for cumulative constraint with optional tasks.
int c
Capacity of resource.
ManFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Help class to create and register tests.
Gecode::IntPropLevel ipl
Propagation level.
Generate random selection of assignments.
Passing integer variables.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
unsigned int size(I &i)
Size of all ranges of range iterator i.
void cumulative(Home home, int c, const TaskTypeArgs &t, const IntVarArgs &s, const IntArgs &p, const IntArgs &u, IntPropLevel ipl)
Post propagators for scheduling tasks on cumulative resources.
@ CTL_NONE
No consistency-test.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int c
Capacity of resource.
int _minP
Minimum processing time.
virtual bool solution(const Assignment &x) const
Test whether x is solution.
IntPropLevel
Propagation levels for integer propagators.
virtual Assignment * assignment(void) const
Create and register initial assignment.
OptFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution.
int l
Limit for optional tasks.
Test for cumulative constraint with optional flexible tasks.
virtual bool solution(const Assignment &x) const
Test whether x is solution.
virtual Assignment * assignment(void) const
Create and register initial assignment.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Gecode toplevel namespace
bool testfix
Whether to perform fixpoint test.
OptFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Gecode::IntArgs u
The resource usage.
Node * x
Pointer to corresponding Boolean expression node.
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.
Passing Boolean variables.
Gecode::IntArgs p
The processing times.
@ IPL_DOM
Domain propagation Preferences: prefer speed or memory.
virtual Assignment * assignment(void) const
Create and register initial assignment.
int c
Capacity of resource.
int _minP
Minimum processing time.
Gecode::IntArgs u
The resource usage.
const int max
Largest allowed integer value.
Test for cumulative constraint with mandatory tasks.
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
ManFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
int arity
Number of variables.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Base class for assignments
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
const int min
Smallest allowed integer value.
Gecode::IntArgs u
The resource usage.
Create(void)
Perform creation and registration.
Test for cumulative constraint with flexible mandatory tasks.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Generate random selection of assignments.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs p
The processing times.
int _maxP
Maximum processing time.
int l
Limit for optional tasks.
int n
Number of negative literals for node type.
Passing integer arguments.
virtual Assignment * assignment(void) const
Create and register initial assignment.
const FloatNum max
Largest allowed float value.
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
int _maxP
Maximum processing time.
Gecode::IntSet dom
Domain of variables.
Iterator for basic and advanced integer propagation levels.
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.