40 template<
class Tracer>
44 template<
class Tracer>
49 template<
class Tracer>
54 template<
class Tracer>
60 template<
class Tracer>
65 template<
class Tracer>
70 template<
class Tracer>
75 template<
class Tracer>
80 template<
class Tracer>
85 template<
class Tracer>
91 template<
class Tracer>
97 template<
class Tracer>
103 template<
class Tracer>
117 template<
class Tracer>
122 template<
class Tracer>
128 template<
class Tracer>
134 template<
class Tracer>
137 if (!
ds.empty() &&
ds.top().lao()) {
147 template<
class Tracer>
151 if (
ds.top().rightmost()) {
159 template<
class Tracer>
166 template<
class Tracer>
172 template<
class Tracer>
179 template<
class Tracer>
182 int l =
ds.entries()-1;
183 while (
ds[l].space() == NULL)
188 template<
class Tracer>
194 template<
class Tracer>
197 assert((
ds[l].space() == NULL) ||
ds[l].space()->failed());
198 int n =
ds.entries();
200 for (
int i=l; i<
n; i++) {
202 unsigned int fa = (i != l) ?
top.alt() + 1 :
top.alt();
203 for (
unsigned int a = fa; a <
top.choice()->alternatives(); a++) {
210 for (
int i=l; i<
n; i++)
213 assert(
ds.entries() == l);
216 template<
class Tracer>
223 template<
class Tracer>
232 if ((
ds.top().space() != NULL) &&
ds.top().rightmost()) {
235 assert(
ds.entries()-1 ==
lc());
236 ds.top().space(NULL);
238 if (
static_cast<unsigned int>(
ds.entries()) >
ngdl())
245 int n =
ds.entries();
247 d =
static_cast<unsigned int>(
n - l);
249 Space* s =
ds[l].space()->clone();
253 for (
int i=l; i<
n; i++)
256 int m = l +
static_cast<int>(d >> 1);
262 for (; (i<
n) &&
ds[i].rightmost(); i++)
280 d =
static_cast<unsigned int>(
n-i);
289 template<
class Tracer>
292 const Space& best,
int& mark,
299 if ((
ds.top().space() != NULL) &&
ds.top().rightmost()) {
302 assert(
ds.entries()-1 ==
lc());
303 if (mark >
ds.entries()-1) {
304 mark =
ds.entries()-1;
307 ds.top().space(NULL);
309 if (
static_cast<unsigned int>(
ds.entries()) >
ngdl())
316 int n =
ds.entries();
318 d =
static_cast<unsigned int>(
n - l);
344 for (
int i=l; i<
n; i++)
347 int m = l +
static_cast<int>(d >> 1);
353 for (; (i<
n) &&
ds[i].rightmost(); i++)
374 d =
static_cast<unsigned int>(
n-i);
383 template<
class Tracer>
Choice for performing commit
unsigned long int n
Number of no-goods.
static ExecStatus post(Space &home, const Path &p)
Post propagator for path p.
Search tree edge for recomputation
Space * space(void) const
Return space for edge.
Space * _space
Space corresponding to this edge (might be NULL)
unsigned int alt(void) const
Return number for alternatives.
Edge(void)
Default constructor.
bool rightmost(void) const
Test whether current alternative is rightmost.
void next(void)
Move to next alternative.
bool leftmost(void) const
Test whether current alternative is leftmost.
bool lao(void) const
Test whether current alternative was LAO.
void dispose(void)
Free memory for edge.
unsigned int truealt(void) const
Return true number for alternatives (excluding lao optimization)
unsigned int nid(void) const
Return node identifier.
const Choice * _choice
Choice.
const Choice * choice(void) const
Return choice.
unsigned int _alt
Current alternative.
unsigned int _ngdl
Depth limit for no-good generation.
void unwind(int l, Tracer &t)
Unwind the stack up to position l (after failure)
bool empty(void) const
Test whether path is empty.
int entries(void) const
Return number of entries on stack.
int lc(void) const
Return position on stack of last copy.
void next(void)
Generate path for next node.
virtual void post(Space &home) const
Post no-goods.
void commit(Space *s, int i) const
Commit space s as described by stack entry at position i.
unsigned int ngdl(void) const
Return no-good depth limit.
Support::DynamicStack< Edge, Heap > ds
Stack to store edge information.
Path(unsigned int l)
Initialize with no-good depth limit l.
Edge & top(void) const
Provide access to topmost edge.
void reset(void)
Reset stack.
const Choice * push(Worker &stat, Space *s, Space *c, unsigned int nid)
Push space c (a clone of s or NULL)
Space * recompute(unsigned int &d, unsigned int a_d, Worker &s, Tracer &t)
Recompute space according to path.
unsigned long int fail
Number of failed nodes in search tree.
void stack_depth(unsigned long int d)
Record stack depth d.
Heap heap
The single global heap.
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
virtual void constrain(const Space &best)
Constrain function for best solution search.
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Space * clone(CloneStatistics &stat=unused_clone) const
Clone space.
@ SS_FAILED
Space is failed
Gecode toplevel namespace