132 int size(
void)
const;
148 slice(
int start,
int inc=1,
int n=-1);
153 iterator
begin(
void);
156 const_iterator
begin(
void)
const;
160 const_iterator
end(
void)
const;
162 reverse_iterator
rbegin(
void);
164 const_reverse_iterator
rbegin(
void)
const;
166 reverse_iterator
rend(
void);
168 const_reverse_iterator
rend(
void)
const;
186 static void*
operator new(size_t);
187 static void operator delete(
void*,size_t);
244 bool operator ()(
const X&,
const X&);
247 static void sort(View* x,
int n);
298 x = home.
alloc<View>(n);
316 x = r.
alloc<View>(n);
327 int size(
void)
const;
343 iterator
begin(
void);
346 const_iterator
begin(
void)
const;
350 const_iterator
end(
void)
const;
352 reverse_iterator
rbegin(
void);
354 const_reverse_iterator
rbegin(
void)
const;
356 reverse_iterator
rend(
void);
358 const_reverse_iterator
rend(
void)
const;
473 bool same(
const Space& home,
const View& y)
const;
491 template<
class ViewY>
492 bool shared(
const Space& home,
const ViewY& y)
const;
498 template<
class ViewY>
503 static void*
operator new(size_t);
504 static void operator delete(
void*,size_t);
555 A
slice(
int start,
int inc=1,
int n=-1);
592 template<
class InputIterator>
598 int size(
void)
const;
612 iterator
begin(
void);
615 const_iterator
begin(
void)
const;
619 const_iterator
end(
void)
const;
621 reverse_iterator
rbegin(
void);
623 const_reverse_iterator
rbegin(
void)
const;
625 reverse_iterator
rend(
void);
627 const_reverse_iterator
rend(
void)
const;
636 static void*
operator new(size_t);
637 static void operator delete(
void*,size_t);
695 template<
class InputIterator>
706 slice(
int start,
int inc=1,
int n=-1);
715 operator <<(const PrimArgArray<T>&
x);
780 template<
class InputIterator>
781 ArgArray(InputIterator first, InputIterator last);
787 slice(
int start,
int inc=1,
int n=-1);
796 operator <<(const ArgArray<T>&
x);
867 template<
class InputIterator>
868 VarArgArray(InputIterator first, InputIterator last);
874 slice(
int start,
int inc=1,
int n=-1);
883 operator <<(const VarArgArray<Var>&
x);
924 template<
class Char,
class Traits,
class Var>
925 std::basic_ostream<Char,Traits>&
926 operator <<(std::basic_ostream<Char,Traits>& os,
933 template<
class Char,
class Traits,
class View>
934 std::basic_ostream<Char,Traits>&
941 template<
class Char,
class Traits,
class T>
942 std::basic_ostream<Char,Traits>&
992 assert((i >= 0) && (i <
size()));
999 assert((i >= 0) && (i <
size()));
1006 assert(
n==0 || start <
n);
1013 s = (
n-start)/inc + ((
n-start) % inc == 0 ? 0 : 1);
1015 s = (start+1)/-inc + ((start+1) % -inc == 0 ? 0 : 1);
1017 for (
int i=0;
i<r.size();
i++, start+=inc)
1076 for (
int i =
n;
i--;)
1077 x[
i].update(home, share, a.
x[
i]);
1086 for (
int i =
n;
i--;)
1100 VarArray<Var>::operator
delete(
void*,size_t) {
1104 typename ArrayTraits<VarArray<Var> >::ArgsType
1107 for (
int i=x.
size();
i--;)
1109 for (
int i=y.
size();
i--;)
1115 typename ArrayTraits<VarArray<Var> >::ArgsType
1118 for (
int i=x.
size();
i--;)
1120 for (
int i=y.
size();
i--;)
1126 typename ArrayTraits<VarArray<Var> >::ArgsType
1129 for (
int i=x.
size();
i--;)
1131 for (
int i=y.
size();
i--;)
1137 typename ArrayTraits<VarArray<Var> >::ArgsType
1140 for (
int i=x.
size();
i--;)
1147 typename ArrayTraits<VarArray<Var> >::ArgsType
1151 for (
int i=y.
size();
i--;)
1161 template<
class View>
1165 template<
class View>
1169 x = (n>0) ? home.
alloc<View>(n) : NULL;
1171 template<
class View>
1175 x = (n>0) ? r.
alloc<View>(n) : NULL;
1178 template<
class View>
1182 x = home.
alloc<View>(n);
1183 for (
int i = n;
i--; )
1189 template<
class View>
1193 x = r.
alloc<View>(n);
1194 for (
int i = n;
i--; )
1201 template<
class View>
1206 template<
class View>
1213 template<
class View>
1219 template<
class View>
1225 template<
class View>
1228 assert((i >= 0) && (i <
size()));
1232 template<
class View>
1235 assert((i >= 0) && (i <
size()));
1239 template<
class View>
1245 template<
class View>
1251 template<
class View>
1257 template<
class View>
1263 template<
class View>
1269 template<
class View>
1275 template<
class View>
1281 template<
class View>
1287 template<
class View>
1290 x[
i]=
x[0];
x++;
n--;
1293 template<
class View>
1299 template<
class View>
1306 template<
class View>
1313 template<
class View>
1317 x[
i].cancel(home,p,pc);
1318 x[
i]=
x[0];
x++;
n--;
1321 template<
class View>
1325 x[
i].cancel(home,p,pc);
1329 template<
class View>
1334 for (
int j=i; j--; )
1339 template<
class View>
1344 for (
int j=i+1; j<
n; j++)
1349 template<
class View>
1353 x[
i].cancel(home,a);
1354 x[
i]=
x[0];
x++;
n--;
1357 template<
class View>
1361 x[
i].cancel(home,a);
1365 template<
class View>
1370 for (
int j=i; j--; )
1375 template<
class View>
1380 for (
int j=i+1; j<
n; j++)
1385 template<
class View>
1391 for (
int i =
n;
i--; )
1392 x[
i].update(home, share, y.x[
i]);
1398 template<
class View>
1402 for (
int i =
n;
i--; )
1406 template<
class View>
1409 for (
int i =
n;
i--; )
1413 template<
class View>
1416 for (
int i =
n;
i--; )
1420 template<
class View>
1423 for (
int i =
n;
i--; )
1427 template<
class View>
1430 for (
int i =
n;
i--;)
1436 template<
class View>
1442 template<
class View>
template<
class X>
1444 ViewArray<View>::ViewLess<X>::operator ()(
const X&
a,
const X&
b) {
1448 template<
class View>
1452 Support::quicksort<View,ViewLess<View> >(y,m,vl);
1455 template<
class X,
class Y>
1460 template<
class X,
class Y>
1466 template<
class View>
1472 View* y = r.
alloc<View>(
n);
1473 for (
int i =
n;
i--; )
1476 for (
int i =
n-1;
i--; )
1485 template<
class View>
1490 for (
int i =
n;
i--; )
1496 template<
class View>
1503 for (
int i = 1;
i<
n;
i++)
1509 template<
class View>
1515 View* y = r.
alloc<View>(
n);
1516 for (
int i =
n;
i--; )
1519 for (
int i =
n-1;
i--; )
1528 template<
class View>
template<
class ViewY>
1533 for (
int i =
n;
i--; )
1539 template<
class View>
template<
class ViewY>
1542 if ((
size() < 1) || (y.
size() < 1))
1546 for (
int i=
size();
i--; )
1549 Support::quicksort<View,ViewLess<View> >(xs,
size(),xvl);
1551 for (
int j=y.
size(); j--; )
1553 ViewLess<ViewY> yvl;
1554 Support::quicksort<ViewY,ViewLess<ViewY> >(ys,y.
size(),yvl);
1557 while ((i <
size()) && (j < y.
size()))
1562 }
else if (
before(
x[i],y[j])) {
1573 template<
class View>
1579 template<
class View>
1581 ViewArray<View>::operator
delete(
void*,size_t) {
1593 return (n > onstack_size) ?
1594 heap.
alloc<T>(
static_cast<unsigned int>(
n)) : &onstack[0];
1601 assert(
n+i >= onstack_size);
1603 if (newCapacity <=
n+i)
1605 T* newA = allocate(newCapacity);
1617 :
n(0),
capacity(onstack_size),
a(allocate(0)) {}
1622 :
n(n0),
capacity(
n < onstack_size ? onstack_size :
n),
a(allocate(
n)) {}
1627 :
n(aa.
n),
capacity(
n < onstack_size ? onstack_size :
n),
a(allocate(
n)) {
1634 :
n(static_cast<int>(aa.
size())),
1635 capacity(
n < onstack_size ? onstack_size :
n),
a(allocate(
n)) {
1653 capacity = (
n < onstack_size ? onstack_size :
n);
1669 assert((i>=0) && (i <
n));
1676 assert((i>=0) && (i <
n));
1728 template<
class T>
template<
class A>
1731 assert(
n==0 || start <
n);
1738 s = (
n-start)/inc + ((
n-start) % inc == 0 ? 0 : 1);
1740 s = (start+1)/-inc + ((start+1) % -inc == 0 ? 0 : 1);
1742 for (
int i=0;
i<r.
size();
i++, start+=inc)
1743 new (&r[
i]) T(
a[start]);
1747 template<
class T>
template<
class A>
1752 return static_cast<A&
>(*this);
1756 template<
class InputIterator>
1759 :
n(0),
capacity(onstack_size),
a(allocate(0)) {
1760 while (first != last) {
1767 template<
class T>
template<
class A>
1771 for (
int i=0;
i<x.
size();
i++)
1772 new (&
a[
n++]) T(x[
i]);
1773 return static_cast<A&
>(*this);
1776 template<
class T>
template<
class A>
1781 new (&r[
i]) T(
a[i]);
1782 for (
int i=x.
n; i--;)
1783 new (&r[
n+
i]) T(x.
a[i]);
1787 template<
class T>
template<
class A>
1792 new (&r[
i]) T(
a[i]);
1805 ArgArrayBase<T>::operator
delete(
void*,size_t) {
1827 for (
int i = 1;
i <
n;
i++)
1828 a[
i] = va_arg(args,T);
1835 for (
int i=n;
i--; )
1850 template<
class InputIterator>
1882 return x.template concat
1887 typename ArrayTraits<PrimArgArray<T> >::ArgsType
1889 return x.template concat
1894 typename ArrayTraits<PrimArgArray<T> >::ArgsType
1917 for (
int i=n;
i--; )
1932 template<
class InputIterator>
1964 return x.template concat
1969 typename ArrayTraits<ArgArray<T> >::ArgsType
1971 return x.template concat
1976 typename ArrayTraits<ArgArray<T> >::ArgsType
1980 return xa.template concat
2008 template<
class InputIterator>
2017 for (
int i=x.
size();
i--; )
2048 return x.template concat
2053 typename ArrayTraits<VarArgArray<Var> >::ArgsType
2055 return x.template concat
2060 typename ArrayTraits<VarArgArray<Var> >::ArgsType
2064 return xa.template concat
2071 return a.varimp() < b.varimp();
2077 for (
int i =
n;
i--;)
2090 for (
int i =
n;
i--; )
2093 Support::quicksort<Var,VarLess>(y,
n,vl);
2094 for (
int i = n-1;
i--; )
2095 if (!y[
i].
assigned() && (y[
i+1].varimp() == y[
i].varimp())) {
2111 for (
int i =
n;
i--; )
2113 for (
int i = y.
n;
i--; )
2116 Support::quicksort<Var,VarLess>(z,m,vl);
2117 for (
int i = m-1;
i--; )
2118 if (!z[
i].
assigned() && (z[
i+1].varimp() == z[
i].varimp())) {
2131 for (
int i =
n;
i--; )
2132 if (
a[
i].varimp() == y.varimp())
2165 template<
class Char,
class Traits,
class Var>
2166 std::basic_ostream<Char,Traits>&
2167 operator <<(std::basic_ostream<Char,Traits>& os,
2169 std::basic_ostringstream<Char,Traits> s;
2170 s.copyfmt(os); s.width(0);
2174 for (
int i=1;
i<x.
size();
i++)
2178 return os << s.str();
2181 template<
class Char,
class Traits,
class View>
2182 std::basic_ostream<Char,Traits>&
2183 operator <<(std::basic_ostream<Char,Traits>& os,
2185 std::basic_ostringstream<Char,Traits> s;
2186 s.copyfmt(os); s.width(0);
2190 for (
int i=1;
i<x.
size();
i++)
2194 return os << s.str();
2197 template<
class Char,
class Traits,
class T>
2198 std::basic_ostream<Char,Traits>&
2199 operator <<(std::basic_ostream<Char,Traits>& os,
2201 std::basic_ostringstream<Char,Traits> s;
2202 s.copyfmt(os); s.width(0);
2206 for (
int i=1;
i<x.
size();
i++)
2210 return os << s.str();
A slice(int start, int inc=1, int n=-1)
int capacity
Allocated size of the array.
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
int n
Number of variables (size)
static T * copy(T *d, const T *s, long unsigned int n)
Copy n objects starting at s to d.
reverse_iterator rbegin(void)
Return a reverse iterator at the end of the array.
const T * const_iterator
Type of the iterator used to iterate read-only through this array's elements.
reverse_iterator rbegin(void)
Return a reverse iterator at the end of the array.
bool operator()(const Var &, const Var &)
const ArgArrayBase< T > & operator=(const ArgArrayBase< T > &a)
Initialize from view array a (copy elements)
int size(void) const
Return size of array (number of elements)
iterator end(void)
Return an iterator past the end of the array.
bool assigned(void) const
Test if all variables are assigned.
bool __shared(const X &x, const Y &y)
void cancel(Space &home, Propagator &p, IntSet &y)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
reverse_iterator rend(void)
Return a reverse iterator past the beginning of the array.
VarArray(void)
Default constructor (array of size 0)
std::reverse_iterator< const T * > const_reverse_iterator
Type of the iterator used to iterate backwards and read-only through this array's elements...
VarArgArray(void)
Allocate empty array.
iterator begin(void)
Return an iterator at the beginning of the array.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
ArrayTraits< PrimArgArray< T > >::ArgsType slice(int start, int inc=1, int n=-1)
Base-class for propagators.
Var * x
Array of variables.
const Var & const_reference
Type of a constant reference to the value type.
T * iterator
Type of the iterator used to iterate through this array's elements.
View & operator[](int i)
Return view at position i.
const View & const_reference
Type of a constant reference to the value type.
iterator end(void)
Return an iterator past the end of the array.
void unique(const Space &home)
Remove all duplicate views from array (changes element order)
const ViewArray< View > & operator=(const ViewArray< View > &a)
Initialize from view array a (share elements)
const Var * const_pointer
Type of a read-only pointer to the value type.
View * iterator
Type of the iterator used to iterate through this array's elements.
Heap heap
The single global heap.
Var & operator[](int i)
Return variable at position i.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
View * pointer
Type of a pointer to the value type.
PrimArgArray(void)
Allocate empty array.
void sort(TaskViewArray< TaskView > &t)
Sort task view array t according to sto and inc (increasing or decreasing)
~ArgArrayBase(void)
Destructor.
bool same(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether two views are the same.
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 drop_lst(int i)
Drop views from positions i+1 to size()-1 from array.
int n
Number of negative literals for node type.
Argument array for primtive types.
const int capacity[n_warehouses]
Capacity of a single warehouse.
void resize(int i)
Resize to hold at least i additional elements.
ArrayTraits< ArgArray< T > >::ArgsType & operator<<(const T &x)
Insert a new element x at the end of the array (increase size by 1)
ArrayTraits< PrimArgArray< T > >::ArgsType & operator<<(const T &x)
Insert a new element x at the end of the array (increase size by 1)
const VarArray< Var > & operator=(const VarArray< Var > &a)
Initialize from variable array a (share elements)
const View * const_pointer
Type of a read-only pointer to the value type.
FloatVal operator+(const FloatVal &x)
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
bool shared(const Space &home) const
Test whether array contains shared views.
T onstack[onstack_size]
In-array storage for elements.
int PropCond
Type for propagation conditions.
void subscribe(Space &home, Propagator &p, IntSet &y)
bool before(const ViewA &x, const ViewB &y)
unsigned int size(I &i)
Size of all ranges of range iterator i.
ArgArrayBase(void)
Allocate empty array.
iterator begin(void)
Return an iterator at the beginning of the array.
ViewArray(Region &r, const VarArgArray< Var > &a)
Initialize from variable argument array a (copy elements)
Var value_type
Type of the variable stored in this array.
Argument array for non-primitive types.
T & reference
Type of a reference to the value type.
const Var * const_iterator
Type of the iterator used to iterate read-only through this array's elements.
bool __before(const View &x, const View &y)
struct Gecode::@512::NNF::@54::@55 b
For binary nodes (and, or, eqv)
void drop_fst(int i)
Drop views from positions 0 to i-1 from array.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
bool assigned(void) const
Test if all variables are assigned.
iterator begin(void)
Return an iterator at the beginning of the array.
bool __same(const X &x, const Y &y)
void move_lst(int i)
Move view from position size()-1 to position i (truncate array by one)
int size(void) const
Return size of array (number of elements)
std::reverse_iterator< const Var * > const_reverse_iterator
Type of the iterator used to iterate backwards and read-only through this array's elements...
reverse_iterator rend(void)
Return a reverse iterator past the beginning of the array.
std::reverse_iterator< Var * > reverse_iterator
Type of the iterator used to iterate backwards through this array's elements.
Var * pointer
Type of a pointer to the value type.
T * pointer
Type of a pointer to the value type.
View & reference
Type of a reference to the value type.
Base class for variables.
void free(T *b, long unsigned int n)
Delete n objects starting at b.
Node * x
Pointer to corresponding Boolean expression node.
ArgArray(void)
Allocate empty array.
Var * iterator
Type of the iterator used to iterate through this array's elements.
ArrayTraits< ArgArray< T > >::ArgsType slice(int start, int inc=1, int n=-1)
Return slice of length n such that forall , .
Base-class for argument arrays.
A concat(const ArgArrayBase< T > &x) const
Return this array concatenated with x.
ArrayTraits< VarArgArray< Var > >::ArgsType slice(int start, int inc=1, int n=-1)
Return slice of length n such that forall , .
bool assigned(View x, int v)
Whether x is assigned to value v.
bool same(const Space &home) const
Test whether array contains same variable multiply.
void free(T *b, long unsigned int n)
Delete n objects allocated from the region starting at b.
bool same(const Space &home) const
Test whether array has multiple occurence of the same view.
reverse_iterator rbegin(void)
Return a reverse iterator at the end of the array.
A & append(const T &x)
Insert a new element x at the end of the array (increase size by 1)
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Sort order for variables.
int size(void) const
Return size of array (number of elements)
T value_type
Type of the view stored in this array.
Traits of arrays in Gecode.
const T & const_reference
Type of a constant reference to the value type.
void move_fst(int i)
Move view from position 0 to position i (shift elements to the left)
Gecode toplevel namespace
ArrayTraits< VarArgArray< Var > >::ArgsType slice(int start, int inc=1, int n=-1)
std::reverse_iterator< const View * > const_reverse_iterator
Type of the iterator used to iterate backwards and read-only through this array's elements...
ViewArray(Space &home, const VarArgArray< Var > &a)
Initialize from variable argument array a (copy elements)
std::reverse_iterator< T * > reverse_iterator
Type of the iterator used to iterate backwards through this array's elements.
reverse_iterator rend(void)
Return a reverse iterator past the beginning of the array.
struct Gecode::@512::NNF::@54::@56 a
For atomic nodes.
Var & reference
Type of a reference to the value type.
iterator end(void)
Return an iterator past the end of the array.
View value_type
Type of the view stored in this array.
T & operator[](int i)
Return element at position i.
static const int onstack_size
How many elements are possible inside array.
ArrayTraits< VarArgArray< Var > >::ArgsType & operator<<(const Var &x)
Insert a new element x at the end of the array (increase size by 1)
Argument array for variables.
const View * const_iterator
Type of the iterator used to iterate read-only through this array's elements.
bool assigned(void) const
Test if all variables are assigned.
std::reverse_iterator< View * > reverse_iterator
Type of the iterator used to iterate backwards through this array's elements.
const T * const_pointer
Type of a read-only pointer to the value type.
T * allocate(int n)
Allocate memory for n elements.
ViewArray(void)
Default constructor (array of size 0)