cumulative.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2009
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "test/int.hh"
#include <gecode/minimodel.hh>
namespace Test { namespace Int {
namespace Cumulative {
class ManFixPCumulative : public Test {
protected:
int c;
Gecode::IntArgs p;
Gecode::IntArgs u;
static int st(int c,
const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
double e = 0;
for (int i=p.size(); i--; )
e += static_cast<double>(p[i])*u[i];
return e / std::max(1,std::abs(c));
}
int o;
public:
ManFixPCumulative(int c0,
const Gecode::IntArgs& p0,
const Gecode::IntArgs& u0,
int o0,
Gecode::IntPropLevel ipl0)
: Test("Cumulative::Man::Fix::"+str(o0)+"::"+
str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0),
(c0 >= 0) ? p0.size():p0.size()+1,0,st(c0,p0,u0),false,ipl0),
c(c0), p(p0), u(u0), o(o0) {
testsearch = false;
testfix = false;
contest = CTL_NONE;
}
virtual Assignment* assignment(void) const {
return new RandomAssignment(arity,dom,500);
}
virtual bool solution(const Assignment& x) const {
int cmax = (c >= 0) ? c : x[x.size()-1];
int n = (c >= 0) ? x.size() : x.size()-1;
if (c < 0 && x[n] > -c)
return false;
// Compute maximal time
int t = 0;
for (int i=0; i<n; i++)
t = std::max(t,x[i]+std::max(1,p[i]));
// Compute resource usage (including at start times)
int* used = new int[t];
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
for (int t=0; t<p[i]; t++)
used[x[i]+t] += u[i];
// Check resource usage
for (int i=0; i<t; i++)
if (used[i] > cmax) {
delete [] used;
return false;
}
// Compute resource usage (only internal)
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++) {
for (int t=1; t<p[i]; t++) {
used[x[i]+t] += u[i];
}
}
// Check resource usage at start times
for (int i=0; i<n; i++)
if (used[x[i]]+u[i] > cmax) {
delete [] used;
return false;
}
delete [] used;
return true;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
int n = (c >= 0) ? x.size() : x.size()-1;
Gecode::IntVarArgs xx;
if (o==0) {
xx=x.slice(0,1,n);
} else {
xx=Gecode::IntVarArgs(n);
for (int i=n; i--;)
xx[i]=Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
}
if (c >= 0) {
Gecode::cumulative(home, c, xx, p, u, ipl);
} else {
Gecode::rel(home, x[n] <= -c);
Gecode::cumulative(home, x[n], xx, p, u, ipl);
}
}
};
class OptFixPCumulative : public Test {
protected:
int c;
Gecode::IntArgs p;
Gecode::IntArgs u;
int l;
int o;
static int st(int c,
const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
double e = 0;
for (int i=p.size(); i--; )
e += static_cast<double>(p[i])*u[i];
return e / std::max(1,std::abs(c));
}
public:
OptFixPCumulative(int c0,
const Gecode::IntArgs& p0,
const Gecode::IntArgs& u0,
int o0,
Gecode::IntPropLevel ipl0)
: Test("Cumulative::Opt::Fix::"+str(o0)+"::"+
str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0),
(c0 >= 0) ? 2*p0.size() : 2*p0.size()+1,0,st(c0,p0,u0),
false,ipl0),
c(c0), p(p0), u(u0), l(st(c,p,u)/2), o(o0) {
testsearch = false;
testfix = false;
contest = CTL_NONE;
}
virtual Assignment* assignment(void) const {
return new RandomAssignment(arity,dom,500);
}
virtual bool solution(const Assignment& x) const {
int nn = (c >= 0) ? x.size() : x.size()-1;
int cmax = (c >= 0) ? c : x[nn];
if (c < 0 && x[nn] > -c)
return false;
int n = nn / 2;
// Compute maximal time
int t = 0;
for (int i=0; i<n; i++)
t = std::max(t,x[i]+std::max(1,p[i]));
// Compute resource usage (including at start times)
int* used = new int[t];
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
if (x[n+i] > l)
for (int t=0; t<p[i]; t++)
used[x[i]+t] += u[i];
// Check resource usage
for (int i=0; i<t; i++) {
if (used[i] > cmax) {
delete [] used;
return false;
}
}
// Compute resource usage (only internal)
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
if (x[n+i] > l) {
for (int t=1; t<p[i]; t++)
used[x[i]+t] += u[i];
}
// Check resource usage at start times
for (int i=0; i<n; i++)
if (x[n+i] > l)
if (used[x[i]]+u[i] > cmax) {
delete [] used;
return false;
}
delete [] used;
return true;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
int nn=(c >= 0) ? x.size() : x.size()-1;
int n=nn / 2;
Gecode::IntVarArgs s(n);
Gecode::BoolVarArgs m(n);
for (int i=0; i<n; i++) {
s[i]=(c >= 0) ? x[i] : Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
m[i]=Gecode::expr(home, x[n+i] > l);
}
if (c >= 0) {
Gecode::cumulative(home, c, s, p, u, m, ipl);
} else {
Gecode::rel(home, x[nn] <= -c);
Gecode::cumulative(home, x[nn], s, p, u, m, ipl);
}
}
};
class ManFlexCumulative : public Test {
protected:
int c;
int _minP;
int _maxP;
Gecode::IntArgs u;
static int st(int c, int maxP, const Gecode::IntArgs& u) {
double e = 0;
for (int i=u.size(); i--; )
e += static_cast<double>(maxP)*u[i];
return e / std::max(1,std::abs(c));
}
int o;
public:
ManFlexCumulative(int c0, int minP, int maxP,
const Gecode::IntArgs& u0,
int o0,
Gecode::IntPropLevel ipl0)
: Test("Cumulative::Man::Flex::"+str(o0)+"::"+
str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+
"::"+str(ipl0),
(c0 >= 0) ? 2*u0.size() : 2*u0.size()+1,
0,std::max(maxP,st(c0,maxP,u0)),false,ipl0),
c(c0), _minP(minP), _maxP(maxP), u(u0), o(o0) {
testsearch = false;
testfix = false;
contest = CTL_NONE;
}
virtual Assignment* assignment(void) const {
return new RandomMixAssignment((c >= 0) ? arity/2 : arity/2+1,
dom,arity/2,
Gecode::IntSet(_minP,_maxP),500);
}
virtual bool solution(const Assignment& x) const {
int nn = (c >= 0) ? x.size() : x.size()-1;
int n = nn/2;
int cmax = (c >= 0) ? c : x[n];
int pstart = (c >= 0) ? n : n+1;
if (c < 0 && cmax > -c)
return false;
// Compute maximal time
int t = 0;
for (int i=0; i<n; i++) {
t = std::max(t,x[i]+std::max(1,x[pstart+i]));
}
// Compute resource usage (including at start times)
int* used = new int[t];
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
for (int t=0; t<x[pstart+i]; t++)
used[x[i]+t] += u[i];
// Check resource usage
for (int i=0; i<t; i++)
if (used[i] > cmax) {
delete [] used;
return false;
}
// Compute resource usage (only internal)
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++) {
for (int t=1; t<x[pstart+i]; t++)
used[x[i]+t] += u[i];
}
// Check resource usage at start times
for (int i=0; i<n; i++)
if (used[x[i]]+u[i] > cmax) {
delete [] used;
return false;
}
delete [] used;
return true;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
int nn = (c >= 0) ? x.size() : x.size()-1;
int n = nn/2;
int pstart = (c >= 0) ? n : n+1;
Gecode::IntVarArgs s(n);
Gecode::IntVarArgs px(x.slice(pstart,1,n));
Gecode::IntVarArgs e(home,n,
Gecode::Int::Limits::min,
Gecode::Int::Limits::max);
for (int i=s.size(); i--;) {
s[i] = expr(home, o+x[i], Gecode::IPL_DOM);
rel(home, s[i]+px[i] == e[i]);
rel(home, _minP <= px[i]);
rel(home, _maxP >= px[i]);
}
if (c >= 0) {
Gecode::cumulative(home, c, s, px, e, u, ipl);
} else {
rel(home, x[n] <= -c);
Gecode::cumulative(home, x[n], s, px, e, u, ipl);
}
}
};
class OptFlexCumulative : public Test {
protected:
int c;
int _minP;
int _maxP;
Gecode::IntArgs u;
int l;
int o;
static int st(int c, int maxP, const Gecode::IntArgs& u) {
double e = 0;
for (int i=u.size(); i--; )
e += static_cast<double>(maxP)*u[i];
return e / std::max(1,std::abs(c));
}
public:
OptFlexCumulative(int c0, int minP, int maxP,
const Gecode::IntArgs& u0,
int o0,
Gecode::IntPropLevel ipl0)
: Test("Cumulative::Opt::Flex::"+str(o0)+"::"+
str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+
"::"+str(ipl0),
(c0 >= 0) ? 3*u0.size() : 3*u0.size()+1,
0,std::max(maxP,st(c0,maxP,u0)), false,ipl0),
c(c0), _minP(minP), _maxP(maxP), u(u0),
l(std::max(maxP,st(c0,maxP,u0))/2), o(o0) {
testsearch = false;
testfix = false;
contest = CTL_NONE;
}
virtual Assignment* assignment(void) const {
return new RandomMixAssignment((c >= 0) ? 2*(arity/3) : 2*(arity/3)+1,
dom,arity/3,
Gecode::IntSet(_minP,_maxP),500);
}
virtual bool solution(const Assignment& x) const {
int nn = (c >= 0) ? x.size() : x.size()-1;
int n = nn / 3;
int cmax = (c >= 0) ? c : x[2*n];
int pstart = (c >= 0) ? 2*n : 2*n+1;
if (c < 0 && cmax > -c)
return false;
// Compute maximal time
int t = 0;
for (int i=0; i<n; i++)
t = std::max(t,x[i]+std::max(1,x[pstart+i]));
// Compute resource usage (including at start times)
int* used = new int[t];
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
if (x[n+i] > l)
for (int t=0; t<x[pstart+i]; t++)
used[x[i]+t] += u[i];
// Check resource usage
for (int i=0; i<t; i++)
if (used[i] > cmax) {
delete [] used;
return false;
}
// Compute resource usage (only internal)
for (int i=0; i<t; i++)
used[i] = 0;
for (int i=0; i<n; i++)
if (x[n+i] > l)
for (int t=1; t<x[pstart+i]; t++)
used[x[i]+t] += u[i];
// Check resource usage at start times
for (int i=0; i<n; i++)
if (x[n+i] > l && used[x[i]]+u[i] > cmax) {
delete [] used;
return false;
}
delete [] used;
return true;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
int nn = (c >= 0) ? x.size() : x.size()-1;
int n=nn / 3;
int pstart= (c >= 0) ? 2*n : 2*n+1;
Gecode::IntVarArgs s(n);
Gecode::IntVarArgs px(n);
Gecode::IntVarArgs e(home,n,
Gecode::Int::Limits::min,
Gecode::Int::Limits::max);
for (int i=n; i--;) {
s[i] = expr(home, o+x[i]);
px[i] = x[pstart+i];
rel(home, s[i]+px[i] == e[i]);
rel(home, _minP <= px[i]);
rel(home, _maxP >= px[i]);
}
Gecode::BoolVarArgs m(n);
for (int i=0; i<n; i++)
m[i]=Gecode::expr(home, (x[n+i] > l));
if (c >= 0) {
Gecode::cumulative(home, c, s, px, e, u, m, ipl);
} else {
Gecode::rel(home, x[2*n] <= -c);
Gecode::cumulative(home, x[2*n], s, px, e, u, m, ipl);
}
}
};
class Create {
public:
Create(void) {
using namespace Gecode;
IntArgs p1({1,1,1,1});
IntArgs p2({2,2,2,2});
IntArgs p3({4,3,3,5});
IntArgs p4({4,0,3,5});
IntArgs p5({1,1,1});
IntArgs u1({1,1,1,1});
IntArgs u2({2,2,2,2});
IntArgs u3({2,3,4,5});
IntArgs u4({2,3,0,5});
IntArgs u5({1,3,2});
for (IntPropBasicAdvanced ipba; ipba(); ++ipba) {
// Regression test: check correct detection of disjunctive case
(void) new ManFixPCumulative(3,p5,u5,0,ipba.ipl());
for (int c=-7; c<8; c++) {
int off = 0;
for (int coff=0; coff<2; coff++) {
(void) new ManFixPCumulative(c,p1,u1,off,ipba.ipl());
(void) new ManFixPCumulative(c,p1,u2,off,ipba.ipl());
(void) new ManFixPCumulative(c,p1,u3,off,ipba.ipl());
(void) new ManFixPCumulative(c,p1,u4,off,ipba.ipl());
(void) new ManFixPCumulative(c,p2,u1,off,ipba.ipl());
(void) new ManFixPCumulative(c,p2,u2,off,ipba.ipl());
(void) new ManFixPCumulative(c,p2,u3,off,ipba.ipl());
(void) new ManFixPCumulative(c,p2,u4,off,ipba.ipl());
(void) new ManFixPCumulative(c,p3,u1,off,ipba.ipl());
(void) new ManFixPCumulative(c,p3,u2,off,ipba.ipl());
(void) new ManFixPCumulative(c,p3,u3,off,ipba.ipl());
(void) new ManFixPCumulative(c,p3,u4,off,ipba.ipl());
(void) new ManFixPCumulative(c,p4,u1,off,ipba.ipl());
(void) new ManFixPCumulative(c,p4,u2,off,ipba.ipl());
(void) new ManFixPCumulative(c,p4,u3,off,ipba.ipl());
(void) new ManFixPCumulative(c,p4,u4,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,1,u1,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,1,u2,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,1,u3,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,1,u4,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,2,u1,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,2,u2,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,2,u3,off,ipba.ipl());
(void) new ManFlexCumulative(c,0,2,u4,off,ipba.ipl());
(void) new ManFlexCumulative(c,3,5,u1,off,ipba.ipl());
(void) new ManFlexCumulative(c,3,5,u2,off,ipba.ipl());
(void) new ManFlexCumulative(c,3,5,u3,off,ipba.ipl());
(void) new ManFlexCumulative(c,3,5,u4,off,ipba.ipl());
(void) new OptFixPCumulative(c,p1,u1,off,ipba.ipl());
(void) new OptFixPCumulative(c,p1,u2,off,ipba.ipl());
(void) new OptFixPCumulative(c,p1,u3,off,ipba.ipl());
(void) new OptFixPCumulative(c,p1,u4,off,ipba.ipl());
(void) new OptFixPCumulative(c,p2,u1,off,ipba.ipl());
(void) new OptFixPCumulative(c,p2,u2,off,ipba.ipl());
(void) new OptFixPCumulative(c,p2,u3,off,ipba.ipl());
(void) new OptFixPCumulative(c,p2,u4,off,ipba.ipl());
(void) new OptFixPCumulative(c,p3,u1,off,ipba.ipl());
(void) new OptFixPCumulative(c,p3,u2,off,ipba.ipl());
(void) new OptFixPCumulative(c,p3,u3,off,ipba.ipl());
(void) new OptFixPCumulative(c,p3,u4,off,ipba.ipl());
(void) new OptFixPCumulative(c,p4,u1,off,ipba.ipl());
(void) new OptFixPCumulative(c,p4,u2,off,ipba.ipl());
(void) new OptFixPCumulative(c,p4,u3,off,ipba.ipl());
(void) new OptFixPCumulative(c,p4,u4,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,1,u1,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,1,u2,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,1,u3,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,1,u4,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,2,u1,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,2,u2,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,2,u3,off,ipba.ipl());
(void) new OptFlexCumulative(c,0,2,u4,off,ipba.ipl());
(void) new OptFlexCumulative(c,3,5,u1,off,ipba.ipl());
(void) new OptFlexCumulative(c,3,5,u2,off,ipba.ipl());
(void) new OptFlexCumulative(c,3,5,u3,off,ipba.ipl());
(void) new OptFlexCumulative(c,3,5,u4,off,ipba.ipl());
off = Gecode::Int::Limits::min;
}
}
}
}
};
Create c;
}
}}
// STATISTICS: test-int
Gecode::ArgArrayBase::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:1607
Gecode::BoolVarArgs
Passing Boolean variables.
Definition int.hh:712
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntSet
Integer sets.
Definition int.hh:174
Gecode::IntVarArgs
Passing integer variables.
Definition int.hh:656
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarArray::slice
ArrayTraits< VarArgArray< Var > >::ArgsType slice(int start, int inc=1, int n=-1)
Definition array.hpp:946
Gecode::VarArray::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:926
Test::Int::Assignment
Base class for assignments
Definition int.hh:59
Test::Int::Assignment::size
int size(void) const
Return number of variables.
Definition int.hpp:46
Test::Int::Cumulative::Create
Help class to create and register tests.
Definition cumulative.cpp:488
Test::Int::Cumulative::Create::Create
Create(void)
Perform creation and registration.
Definition cumulative.cpp:491
Test::Int::Cumulative::ManFixPCumulative
Test for cumulative constraint with mandatory tasks.
Definition cumulative.cpp:49
Test::Int::Cumulative::ManFixPCumulative::assignment
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition cumulative.cpp:83
Test::Int::Cumulative::ManFixPCumulative::ManFixPCumulative
ManFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Definition cumulative.cpp:69
Test::Int::Cumulative::ManFixPCumulative::u
Gecode::IntArgs u
The resource usage.
Definition cumulative.cpp:56
Test::Int::Cumulative::ManFixPCumulative::o
int o
Offset.
Definition cumulative.cpp:66
Test::Int::Cumulative::ManFixPCumulative::p
Gecode::IntArgs p
The processing times.
Definition cumulative.cpp:54
Test::Int::Cumulative::ManFixPCumulative::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition cumulative.cpp:129
Test::Int::Cumulative::ManFixPCumulative::c
int c
Capacity of resource.
Definition cumulative.cpp:52
Test::Int::Cumulative::ManFixPCumulative::st
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition cumulative.cpp:58
Test::Int::Cumulative::ManFixPCumulative::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition cumulative.cpp:87
Test::Int::Cumulative::ManFlexCumulative
Test for cumulative constraint with flexible mandatory tasks.
Definition cumulative.cpp:258
Test::Int::Cumulative::ManFlexCumulative::assignment
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition cumulative.cpp:294
Test::Int::Cumulative::ManFlexCumulative::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition cumulative.cpp:344
Test::Int::Cumulative::ManFlexCumulative::o
int o
Offset.
Definition cumulative.cpp:276
Test::Int::Cumulative::ManFlexCumulative::u
Gecode::IntArgs u
The resource usage.
Definition cumulative.cpp:267
Test::Int::Cumulative::ManFlexCumulative::c
int c
Capacity of resource.
Definition cumulative.cpp:261
Test::Int::Cumulative::ManFlexCumulative::st
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition cumulative.cpp:269
Test::Int::Cumulative::ManFlexCumulative::_maxP
int _maxP
Maximum processing time.
Definition cumulative.cpp:265
Test::Int::Cumulative::ManFlexCumulative::ManFlexCumulative
ManFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Definition cumulative.cpp:279
Test::Int::Cumulative::ManFlexCumulative::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition cumulative.cpp:300
Test::Int::Cumulative::ManFlexCumulative::_minP
int _minP
Minimum processing time.
Definition cumulative.cpp:263
Test::Int::Cumulative::OptFixPCumulative
Test for cumulative constraint with optional tasks.
Definition cumulative.cpp:150
Test::Int::Cumulative::OptFixPCumulative::l
int l
Limit for optional tasks.
Definition cumulative.cpp:159
Test::Int::Cumulative::OptFixPCumulative::p
Gecode::IntArgs p
The processing times.
Definition cumulative.cpp:155
Test::Int::Cumulative::OptFixPCumulative::u
Gecode::IntArgs u
The resource usage.
Definition cumulative.cpp:157
Test::Int::Cumulative::OptFixPCumulative::o
int o
Offset.
Definition cumulative.cpp:161
Test::Int::Cumulative::OptFixPCumulative::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition cumulative.cpp:237
Test::Int::Cumulative::OptFixPCumulative::c
int c
Capacity of resource.
Definition cumulative.cpp:153
Test::Int::Cumulative::OptFixPCumulative::assignment
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition cumulative.cpp:187
Test::Int::Cumulative::OptFixPCumulative::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition cumulative.cpp:191
Test::Int::Cumulative::OptFixPCumulative::st
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition cumulative.cpp:163
Test::Int::Cumulative::OptFixPCumulative::OptFixPCumulative
OptFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Definition cumulative.cpp:172
Test::Int::Cumulative::OptFlexCumulative
Test for cumulative constraint with optional flexible tasks.
Definition cumulative.cpp:369
Test::Int::Cumulative::OptFlexCumulative::_maxP
int _maxP
Maximum processing time.
Definition cumulative.cpp:376
Test::Int::Cumulative::OptFlexCumulative::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition cumulative.cpp:414
Test::Int::Cumulative::OptFlexCumulative::u
Gecode::IntArgs u
The resource usage.
Definition cumulative.cpp:378
Test::Int::Cumulative::OptFlexCumulative::OptFlexCumulative
OptFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0, Gecode::IntPropLevel ipl0)
Create and register test.
Definition cumulative.cpp:392
Test::Int::Cumulative::OptFlexCumulative::st
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition cumulative.cpp:384
Test::Int::Cumulative::OptFlexCumulative::_minP
int _minP
Minimum processing time.
Definition cumulative.cpp:374
Test::Int::Cumulative::OptFlexCumulative::o
int o
Offset.
Definition cumulative.cpp:382
Test::Int::Cumulative::OptFlexCumulative::c
int c
Capacity of resource.
Definition cumulative.cpp:372
Test::Int::Cumulative::OptFlexCumulative::l
int l
Limit for optional tasks.
Definition cumulative.cpp:380
Test::Int::Cumulative::OptFlexCumulative::assignment
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition cumulative.cpp:408
Test::Int::Cumulative::OptFlexCumulative::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition cumulative.cpp:458
Test::Int::IntPropBasicAdvanced
Iterator for basic and advanced integer propagation levels.
Definition int.hh:350
Test::Int::RandomAssignment
Generate random selection of assignments.
Definition int.hh:96
Test::Int::RandomMixAssignment
Generate random selection of assignments.
Definition int.hh:116
Test::Int::Test::testsearch
bool testsearch
Whether to perform search test.
Definition int.hh:238
Test::Int::Test::testfix
bool testfix
Whether to perform fixpoint test.
Definition int.hh:240
Test::Int::Test::ipl
Gecode::IntPropLevel ipl
Propagation level.
Definition int.hh:234
Test::Int::Test::arity
int arity
Number of variables.
Definition int.hh:226
Test::Int::Test::str
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Definition int.hpp:209
Test::Int::Test::dom
Gecode::IntSet dom
Domain of variables.
Definition int.hh:228
Test::Int::Test::contest
ConTestLevel contest
Whether to test for certain consistency.
Definition int.hh:236
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::IntPropLevel
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
Gecode::IPL_DOM
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:979
minimodel.hh
Gecode::Int::Limits::min
const int min
Smallest allowed integer value.
Definition int.hh:118
Gecode::Int::Limits::max
const int max
Largest allowed integer value.
Definition int.hh:116
Gecode
Gecode toplevel namespace
Gecode::expr
IntVar expr(Home home, const LinIntExpr &e, const IntPropLevels &ipls=IntPropLevels::def)
Post linear expression and return its value.
Definition int-expr.cpp:915
Gecode::cumulative
void cumulative(Home home, int c, const TaskTypeArgs &t, const IntVarArgs &flex, const IntArgs &fix, const IntArgs &u, IntPropLevel ipl=IPL_DEF)
Post propagators for scheduling tasks on cumulative resources.
Definition cumulative.cpp:354
Test::Int::Cumulative
Tests for cumulative scheduling constraints.
Definition cumulative.cpp:41
Test::Int::Cumulative::c
Create c
Definition cumulative.cpp:579
Test::Int
Testing finite domain integers.
Definition int.cpp:40
Test::Int::CTL_NONE
@ CTL_NONE
No consistency-test.
Definition int.hh:140
Test
General test support.
Definition afc.cpp:39
std
Definition flatzinc.cpp:52
int.hh