43 IntSet::IntSetObject::allocate(
int n) {
44 IntSetObject* o =
new IntSetObject;
51 IntSet::IntSetObject::copy(
void)
const {
52 IntSetObject* o = allocate(
n);
60 IntSet::IntSetObject::in(
int n)
const {
65 int m =
l + (
r -
l) / 2;
66 if ((this->r[m].
min <=
n) && (
n <= this->r[m].max)) {
70 }
else if (n < this->
r[m].
min) {
79 IntSet::IntSetObject::~IntSetObject(
void) {
95 IntSet::normalize(Range*
r,
int n) {
100 Support::quicksort<Range>(
r,
n, lt_mi);
110 r[j].min =
min;
r[j].max =
max; j++;
119 IntSetObject* o = IntSetObject::allocate(
n);
121 for (
int i=
n;
i--; ) {
122 s += static_cast<unsigned int>(
r[
i].
max-
r[
i].
min+1);
131 IntSet::init(
const int r[],
int n) {
133 for (
int i=
n;
i--; ) {
134 dr[
i].min=
r[
i]; dr[
i].max=
r[
i];
141 IntSet::init(
const int r[][2],
int n) {
145 if (
r[
i][0] <=
r[
i][1]) {
146 dr[j].min=
r[
i][0]; dr[j].max=
r[
i][1]; j++;
153 IntSet::init(
int n,
int m) {
155 IntSetObject* o = IntSetObject::allocate(1);
156 o->r[0].min =
n; o->r[0].max = m;
157 o->size = static_cast<unsigned int>(m -
n + 1);
int max(void) const
Return maximum of entire set.
const FloatNum max
Largest allowed float value.
bool operator()(const Range &x, const Range &y)
Heap heap
The single global heap.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
SharedHandle::Object * object(void) const
Access to the shared object.
unsigned int size(I &i)
Size of all ranges of range iterator i.
static const IntSet empty
Empty set.
IntSet(void)
Initialize as empty set.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void free(T *b, long unsigned int n)
Delete n objects starting at b.
Node * x
Pointer to corresponding Boolean expression node.
int min(void) const
Return minimum of entire set.
Sort ranges according to increasing minimum.
Gecode toplevel namespace