36 namespace Gecode {
namespace Int {
45 plus(
long long int x,
long long int y) {
50 template<
class TaskView,
class Node>
53 return tasks.size()-1;
55 template<
class TaskView,
class Node>
58 return 2*tasks.size() - 1;
61 template<
class TaskView,
class Node>
66 template<
class TaskView,
class Node>
69 return i >= n_inner();
71 template<
class TaskView,
class Node>
76 template<
class TaskView,
class Node>
83 template<
class TaskView,
class Node>
88 template<
class TaskView,
class Node>
95 template<
class TaskView,
class Node>
101 template<
class TaskView,
class Node>
104 return node[_leaf[
i]];
107 template<
class TaskView,
class Node>
113 template<
class TaskView,
class Node>
116 for (
int i=n_inner();
i--; )
117 node[
i].init(node[n_left(
i)],node[n_right(
i)]);
120 template<
class TaskView,
class Node>
123 for (
int i=n_inner();
i--; )
124 node[
i].
update(node[n_left(
i)],node[n_right(
i)]);
127 template<
class TaskView,
class Node>
135 node[
i].update(node[n_left(
i)],node[n_right(
i)]);
136 }
while (!n_root(
i));
139 template<
class TaskView,
class Node>
144 node(
r.alloc<Node>(n_nodes())),
145 _leaf(
r.alloc<int>(tasks.
size())) {
147 int* map =
r.alloc<
int>(
tasks.size());
148 sort<TaskView,STO_EST,true>(map,
tasks);
152 r.free<
int>(map,
tasks.size());
155 while (fst <
tasks.size())
166 template<
class TaskView,
class Node>
template<
class Node2>
171 node(
r.alloc<Node>(n_nodes())),
172 _leaf(
r.alloc<int>(tasks.
size())) {
Node * x
Pointer to corresponding Boolean expression node.
Task trees for task views with node type Node.
int n_nodes(void) const
Return number of nodes for balanced binary tree.
const TaskViewArray< TaskView > & tasks
The tasks from which the tree is computed.
static int n_right(int i)
Return index of right child of node i.
int n_inner(void) const
Return number of inner nodes.
static bool right(int i)
Test whether node i is a right child.
static int n_left(int i)
Return index of left child of node i.
static bool left(int i)
Test whether node i is a left child.
void init(void)
Initialize tree after leaves have been initialized.
bool n_leaf(int i) const
Whether node i is leaf.
const Node & root(void) const
Return root node.
static int n_parent(int i)
Return index of parent of node i.
int * _leaf
Map task number to leaf node number in right order.
Node & leaf(int i)
Return leaf for task i.
void update(void)
Update all inner nodes of tree after leaves have been initialized.
static bool n_root(int i)
Whether node i is index of root.
Post propagator for SetVar SetOpType SetVar y
void update(IntSet &y, Space &home, IntSet &py)
const int infinity
Infinity for integers.
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.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})