Go to the documentation of this file.
38 namespace Test {
namespace Int {
41 namespace Cumulative {
61 for (
int i=
p.size();
i--; )
62 e +=
static_cast<double>(
p[
i])*
u[
i];
74 :
Test(
"Cumulative::Man::Fix::"+
str(o0)+
"::"+
76 (c0 >= 0) ? p0.
size():p0.
size()+1,0,
st(c0,p0,u0),false,ipl0),
77 c(c0),
p(p0),
u(u0),
o(o0) {
88 int cmax = (
c >= 0) ?
c :
x[
x.size()-1];
89 int n = (
c >= 0) ?
x.size() :
x.size()-1;
91 if (
c < 0 &&
x[
n] > -
c)
96 for (
int i=0;
i<
n;
i++)
99 int* used =
new int[
t];
100 for (
int i=0;
i<
t;
i++)
102 for (
int i=0;
i<
n;
i++)
103 for (
int t=0;
t<
p[
i];
t++)
104 used[
x[
i]+
t] +=
u[
i];
106 for (
int i=0;
i<
t;
i++)
107 if (used[
i] > cmax) {
112 for (
int i=0;
i<
t;
i++)
114 for (
int i=0;
i<
n;
i++) {
115 for (
int t=1;
t<
p[
i];
t++) {
116 used[
x[
i]+
t] +=
u[
i];
120 for (
int i=0;
i<
n;
i++)
121 if (used[
x[
i]]+
u[
i] > cmax) {
130 int n = (
c >= 0) ?
x.size() :
x.size()-1;
166 for (
int i=
p.size();
i--; )
167 e +=
static_cast<double>(
p[
i])*
u[
i];
177 :
Test(
"Cumulative::Opt::Fix::"+
str(o0)+
"::"+
179 (c0 >= 0) ? 2*p0.
size() : 2*p0.
size()+1,0,
st(c0,p0,u0),
192 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
193 int cmax = (
c >= 0) ?
c :
x[nn];
195 if (
c < 0 &&
x[nn] > -
c)
201 for (
int i=0;
i<
n;
i++)
204 int* used =
new int[
t];
205 for (
int i=0;
i<
t;
i++)
207 for (
int i=0;
i<
n;
i++)
209 for (
int t=0;
t<
p[
i];
t++)
210 used[
x[
i]+
t] +=
u[
i];
212 for (
int i=0;
i<
t;
i++) {
213 if (used[
i] > cmax) {
219 for (
int i=0;
i<
t;
i++)
221 for (
int i=0;
i<
n;
i++)
223 for (
int t=1;
t<
p[
i];
t++)
224 used[
x[
i]+
t] +=
u[
i];
227 for (
int i=0;
i<
n;
i++)
229 if (used[
x[
i]]+
u[
i] > cmax) {
238 int nn=(
c >= 0) ?
x.size() :
x.size()-1;
243 for (
int i=0;
i<
n;
i++) {
271 for (
int i=
u.size();
i--; )
272 e +=
static_cast<double>(maxP)*
u[
i];
283 :
Test(
"Cumulative::Man::Flex::"+
str(o0)+
"::"+
286 (c0 >= 0) ? 2*u0.
size() : 2*u0.
size()+1,
287 0,
std::
max(maxP,
st(c0,maxP,u0)),false,ipl0),
301 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
303 int cmax = (
c >= 0) ?
c :
x[
n];
304 int pstart = (
c >= 0) ?
n :
n+1;
306 if (c < 0 && cmax > -
c)
311 for (
int i=0;
i<
n;
i++) {
315 int* used =
new int[
t];
316 for (
int i=0;
i<
t;
i++)
318 for (
int i=0;
i<
n;
i++)
319 for (
int t=0;
t<
x[pstart+
i];
t++)
320 used[
x[
i]+
t] +=
u[
i];
322 for (
int i=0;
i<
t;
i++)
323 if (used[
i] > cmax) {
328 for (
int i=0;
i<
t;
i++)
330 for (
int i=0;
i<
n;
i++) {
331 for (
int t=1;
t<
x[pstart+
i];
t++)
332 used[
x[
i]+
t] +=
u[
i];
335 for (
int i=0;
i<
n;
i++)
336 if (used[
x[
i]]+
u[
i] > cmax) {
345 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
347 int pstart = (
c >= 0) ?
n :
n+1;
353 for (
int i=s.size();
i--;) {
355 rel(home, s[
i]+px[
i] == e[
i]);
386 for (
int i=
u.size();
i--; )
387 e +=
static_cast<double>(maxP)*
u[
i];
396 :
Test(
"Cumulative::Opt::Flex::"+
str(o0)+
"::"+
399 (c0 >= 0) ? 3*u0.
size() : 3*u0.
size()+1,
400 0,
std::
max(maxP,
st(c0,maxP,u0)), false,ipl0),
415 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
417 int cmax = (
c >= 0) ?
c :
x[2*
n];
418 int pstart = (
c >= 0) ? 2*
n : 2*
n+1;
420 if (c < 0 && cmax > -
c)
425 for (
int i=0;
i<
n;
i++)
428 int* used =
new int[
t];
429 for (
int i=0;
i<
t;
i++)
431 for (
int i=0;
i<
n;
i++)
433 for (
int t=0;
t<
x[pstart+
i];
t++)
434 used[
x[
i]+
t] +=
u[
i];
436 for (
int i=0;
i<
t;
i++)
437 if (used[
i] > cmax) {
442 for (
int i=0;
i<
t;
i++)
444 for (
int i=0;
i<
n;
i++)
446 for (
int t=1;
t<
x[pstart+
i];
t++)
447 used[
x[
i]+
t] +=
u[
i];
449 for (
int i=0;
i<
n;
i++)
450 if (
x[
n+
i] >
l && used[
x[
i]]+
u[
i] > cmax) {
459 int nn = (
c >= 0) ?
x.size() :
x.size()-1;
461 int pstart= (
c >= 0) ? 2*
n : 2*
n+1;
468 for (
int i=
n;
i--;) {
471 rel(home, s[
i]+px[
i] == e[
i]);
476 for (
int i=0;
i<
n;
i++)
509 for (
int c=-7;
c<8;
c++) {
511 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.
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.
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.
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
Passing Boolean variables.
Gecode::IntArgs p
The processing times.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
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.
Gecode::IntArgs i({1, 2, 3, 4})
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.