46 namespace Gecode {
namespace Int {
namespace Cumulative {
49 template<
class TaskView,
bool inc>
53 bool operator ()(
const TaskView& t1,
const TaskView& t2)
const {
54 return inc ? (t1.c() < t2.c()) : (t2.c() < t1.c());
66 return prec[
i] > prec[j];
70 template<
class TaskView>
73 sort<TaskView,STO_LCT,false>(
t);
80 int* prec = r.alloc<
int>(t.
size());
81 for (
int i=t.
size();
i--; )
86 for (
int j=0; j<t.
size(); j++) {
88 (ol.
lenv() >
static_cast<long long int>(
c)*t[j].lct())) {
103 int* cap = r.alloc<
int>(t.
size());
104 for (
int i=t.
size();
i--;)
109 int* capacities = r.alloc<
int>(t.
size());
110 int* capInv = r.alloc<
int>(t.
size());
111 for (
int i=t.
size();
i--;) {
112 capacities[cap[
i]] = t[
i].c();
117 for (
int i=0, cur_c=INT_MIN;
i<t.
size();
i++) {
118 if (capacities[
i] != cur_c)
119 capacities[n_c++] = cur_c = capacities[
i];
120 cap[capInv[
i]] = n_c-1;
122 r.free<
int>(capInv, t.
size());
126 int* update = r.alloc<
int>(t.
size()*n_c);
127 for (
int i=t.
size()*n_c;
i--;)
131 for (
int i=0;
i<n_c;
i++) {
132 eo.
init(capacities[
i]);
134 for (
int j=t.
size(); j--;) {
136 static_cast<long long int>(c-capacities[
i])*t[j].lct();
137 long long int eml =
plus(eo.
env(j), -lctj);
138 long long int diff_l;
143 static_cast<long long int>(capacities[i]));
147 update[i*t.
size()+j] =
u;
154 int* precMap = r.alloc<
int>(t.
size());
155 for (
int i=t.
size();
i--;)
161 for (
int i=0;
i<t.
size();
i++) {
163 while (curJ < t.
size() && t[curJ].lct() > prec[precMap[
i]])
165 if (curJ >= t.
size())
170 if (t[locJ].lct() != t[precMap[
i]].lct()) {
174 }
while (t[locJ].lct() == prec[precMap[
i]] && locJ++ < t.
size() - 1);
long long int env(int i)
Compute update for task with index i.
Omega-lambda trees for computing ect of task sets.
const FloatNum max
Largest allowed float value.
void shift(int i)
Shift task with index i from omega to lambda.
PrecOrder(int *prec0)
Constructor.
Omega trees for computing ect of task sets.
int responsible(void) const
Return responsible task.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Gecode::FloatVal c(-8, 8)
bool operator()(int i, int j) const
Sort order.
bool operator()(const TaskView &t1, const TaskView &t2) const
Sort order.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Sorting maps rather than tasks.
bool lempty(void) const
Whether has responsible task.
int plus(int x, int y)
Safe addition in case x is -IntLimits::infinity.
long long int lenv(void) const
Return energy envelope of all tasks excluding lambda tasks.
void init(int ci)
Initialize tasks for current capacity ci.
IntType ceil_div_xx(IntType x, IntType y)
Compute .
int size(void) const
Return size of array (number of elements)
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
const int infinity
Infinity for integers.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
const long long int llinfinity
Infinity for long long integers.
ExecStatus edgefinding(Space &home, int c, TaskViewArray< TaskView > &t)
void lremove(int i)
Remove task with index i from lambda.