47 class FullTupleCompare {
54 FullTupleCompare(
int a) : arity(a) {}
57 operator ()(
const Tuple&
a,
const Tuple&
b) {
58 for (
int i = 0;
i < arity;
i++)
73 class TuplePosCompare {
80 TuplePosCompare(
int p) : pos(p) {}
83 operator ()(
const Tuple& a,
const Tuple& b) {
96 TupleSet::TupleSetI::finalize(
void) {
98 assert(tuples == NULL);
102 for (
int i = arity;
i--; )
104 int real_min =
min, real_max =
max;
106 min = real_min;
max = real_max;
109 domsize =
static_cast<unsigned int>(
max -
min) + 1;
114 tuple_data[
size*arity] = NULL;
115 nullpointer = tuple_data+(
size*arity);
118 for (
int i = arity;
i--; )
119 tuples[
i] = tuple_data + (
i *
size);
120 for (
int i = size;
i--; )
121 tuples[0][
i] = data + (
i * arity);
123 FullTupleCompare ftc(arity);
125 assert(tuples[0][size-1][0] == ia[0]);
126 int* new_data =
heap.
alloc<
int>(size*arity);
127 for (
int t = size;
t--; )
128 for (
int i = arity;
i--; )
129 new_data[
t*arity +
i] = tuples[0][
t][
i];
136 for (
int i = arity;
i--; )
137 for (
int t = size;
t--; )
138 tuples[
i][
t] = data + (
t * arity);
139 for (
int i = arity;
i-->1; ) {
140 TuplePosCompare tpc(
i);
145 last =
heap.
alloc<Tuple*>(domsize*arity);
146 for (
int i = arity;
i--; ) {
147 Tuple*
t = tuples[
i];
148 for (
unsigned int d = 0;
d < domsize; ++
d) {
149 while (t && *t && (*t)[
i] <
static_cast<int>(
min+
d)) {
152 if (t && *t && (*t)[
i] ==
static_cast<int>(
min+
d)) {
153 last[(
i*domsize) +
d] = t;
156 last[(
i*domsize) +
d] = nullpointer;
165 TupleSet::TupleSetI::resize(
void) {
167 int ndatasize =
static_cast<int>(1+
size*1.5);
169 excess = ndatasize -
size;
173 TupleSet::TupleSetI::copy(
void)
const {
194 for (
int i = arity;
i--; )
196 for (
int a = arity; a--; ) {
197 for (
int i = size;
i--; ) {
204 for (
int i = static_cast<int>(domsize)*arity;
i--; ) {
211 TupleSet::TupleSetI::~TupleSetI(
void) {
static T * copy(T *d, const T *s, long unsigned int n)
Copy n objects starting at s to d.
const FloatNum max
Largest allowed float value.
void rfree(void *p)
Free memory block starting at p.
int excess
Excess storage.
bool pos(const View &x)
Test whether x is postive.
Heap heap
The single global heap.
int p
Number of positive literals for node type.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Tuple ** last
Initial last structure.
unsigned int size(I &i)
Size of all ranges of range iterator i.
unsigned int domsize
Domain size.
Tuple ** tuples
Tuples index.
int min
Minimum and maximum in domain-values.
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
Tuple * nullpointer
Pointer to NULL-pointer.
Passing integer arguments.
Tuple * tuple_data
Tuple index data.
struct Gecode::@519::NNF::@60::@61 b
For binary nodes (and, or, eqv)
T * realloc(T *b, long unsigned int n, long unsigned int m)
Reallocate block of n objects starting at b to m objects of type T from heap.
int size
Number of Tuples.
Gecode toplevel namespace