Go to the documentation of this file.
39 namespace Gecode {
namespace Int {
namespace Cumulative {
55 template<
class TaskView>
65 template<
class TaskView>
68 leaf(
i).e = tasks[
i].e();
70 static_cast<long long int>(
c)*tasks[
i].est()+tasks[
i].e();
74 template<
class TaskView>
81 template<
class TaskView>
103 template<
class TaskView>
void
106 for (
int i=0;
i<tasks.
size();
i++) {
113 template<
class TaskView>
template<
class Node>
118 template<
class TaskView>
122 leaf(
i).e = tasks[
i].e();
124 static_cast<long long int>(
c)*tasks[
i].est()+tasks[
i].e();
126 static_cast<long long int>(
c-
ci)*tasks[
i].est()+tasks[
i].e();
133 while (!n_leaf(met)) {
134 if (
plus(node[n_right(met)].cenv,e) >
135 static_cast<long long int>(
c-
ci) * tasks[
i].lct()) {
138 e += node[n_right(met)].e; met = n_left(met);
150 long long int a_e = node[met].e;
151 long long int a_env = node[met].env;
152 long long int b_e = 0;
154 while (!n_root(met)) {
156 b_e += node[n_right(n_parent(met))].e;
158 a_env =
std::max(a_env,
plus(node[n_left(n_parent(met))].env,a_e));
159 a_e += node[n_left(n_parent(met))].e;
164 return plus(a_env,b_e);
183 if (
l.le +
r.e >
l.e +
r.le) {
190 if ((
r.lenv >=
plus(
l.env,
r.le)) && (
r.lenv >=
plus(
l.lenv,
r.e))) {
193 assert(
plus(
l.env,
r.le) >
r.lenv);
196 assert((
plus(
l.lenv,
r.e) >
r.lenv) &&
203 template<
class TaskView>
208 for (
int i=0;
i<
tasks.size();
i++) {
219 template<
class TaskView>
224 leaf(
i).le = leaf(
i).e;
226 leaf(
i).lenv = leaf(
i).env;
233 template<
class TaskView>
246 template<
class TaskView>
249 return root().resLenv < 0;
252 template<
class TaskView>
255 return root().resLenv;
258 template<
class TaskView>
264 template<
class TaskView>
void init(const OmegaNode &l, const OmegaNode &r)
Initialize node from left child l and right child r.
long long int lenv(void) const
Return energy envelope of all tasks excluding lambda tasks.
OmegaNode & leaf(int i)
Return leaf for task i.
long long int le
Energy for subtree.
void init(const ExtOmegaNode &l, const ExtOmegaNode &r)
Initialize node from left child l and right child r.
static const int undef
Undefined task.
void remove(int i)
Remove task with index i.
int responsible(void) const
Return responsible task.
long long int e
Energy for subtree.
const long long int llinfinity
Infinity for long long integers.
int plus(int x, int y)
Safe addition in case x is -Int::Limits::infinity.
void update(const OmegaNode &l, const OmegaNode &r)
Update node from left child l and right child r.
OmegaTree(Region &r, int c, const TaskViewArray< TaskView > &t)
Initialize tree for tasks t and capacity c.
long long int env(void) const
Return energy envelope of all tasks.
OmegaLambdaTree(Region &r, int c, const TaskViewArray< TaskView > &t)
Initialize tree for tasks t and capcity c with all tasks included in omega.
Gecode toplevel namespace
void update(const ExtOmegaNode &l, const ExtOmegaNode &r)
Update node from left child l and right child r.
long long int lenv
Energy envelope for subtree.
void update(IntSet &y, Space &home, IntSet &py)
void insert(int i)
Insert task with index i.
Task trees for task views with node type Node.
Post propagator for SetVar SetOpType SetVar SetRelType r
void init(const OmegaLambdaNode &l, const OmegaLambdaNode &r)
Initialize node from left child l and right child r.
void update(const OmegaLambdaNode &l, const OmegaLambdaNode &r)
Update node from left child l and right child r.
void lremove(int i)
Remove task with index i from lambda.
bool lempty(void) const
Whether has responsible task.
void init(void)
Initialize tree after leaves have been initialized.
void shift(int i)
Shift task with index i from omega to lambda.
Node for an omega lambda tree.
ExtOmegaTree(Region &r, int c, const TaskTree< TaskView, Node > &t)
Initialize tree for tasks t and capacity c.
long long int env
Energy envelope for subtree.
Node for an extended omega tree.
void update(void)
Update all inner nodes of tree after leaves have been initialized.
long long int env(void) const
Return energy envelope of all tasks.
int size(void) const
Return size of array (number of elements)
long long int cenv
Energy envelope for subtree.
Gecode::FloatVal c(-8, 8)
int resLe
Node which is responsible for le.
const TaskViewArray< TaskView > & tasks
The tasks from which the tree is computed.
Gecode::IntArgs i({1, 2, 3, 4})
int resLenv
Node which is responsible for lenv.
const FloatNum max
Largest allowed float value.
long long int env(int i)
Compute update for task with index i.