34 namespace Gecode {
namespace Search {
namespace Seq {
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()) {
143 stat.
stack_depth(static_cast<unsigned long int>(ds.entries()));
147 template<
class Tracer>
151 if (ds.top().rightmost()) {
159 template<
class Tracer>
166 template<
class Tracer>
172 template<
class Tracer>
175 const Edge&
n = ds[
i];
176 s->
commit(*n.choice(),n.alt());
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();
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()) {
233 Space* s = ds.top().space();
234 s->
commit(*ds.top().choice(),ds.top().alt());
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);
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>
299 if ((ds.top().space() != NULL) && ds.top().rightmost()) {
300 Space* s = ds.top().space();
301 s->
commit(*ds.top().choice(),ds.top().alt());
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>
unsigned int alternatives(void) const
Return number of alternatives.
Support::DynamicStack< Edge, Heap > ds
Stack to store edge information.
unsigned int _ngdl
Depth limit for no-good generation.
unsigned int alt(void) const
Return number for alternatives.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
const Choice * choice(void) const
Return choice.
bool empty(void) const
Test whether path is empty.
unsigned long int fail
Number of failed nodes in search tree.
unsigned int nid(void) const
Return node identifier.
void * mark(void *p)
Return marked pointer for unmarked pointer p.
Search tree edge for recomputation
unsigned int nid(void) const
Return node identifier.
unsigned int truealt(void) const
Return true number for alternatives (excluding lao optimization)
int entries(void) const
Return number of entries on stack.
Gecode::FloatVal c(-8, 8)
bool lao(void) const
Test whether current alternative was LAO.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Path(unsigned int l)
Initialize with no-good depth limit l.
Space * clone(CloneStatistics &stat=unused_clone) const
Clone space.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
const Choice * _choice
Choice.
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
virtual void constrain(const Space &best)
Constrain function for best solution search.
Space * _space
Space corresponding to this edge (might be NULL)
const Choice * choice(void) const
Return choice.
unsigned int alt(void) const
Return number for alternatives.
Depth-first path (stack of edges) supporting recomputation.
void next(void)
Move to next alternative.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Choice for performing commit
Heap heap
The single global heap.
bool leftmost(void) const
Test whether current alternative is leftmost.
unsigned int _alt
Current alternative.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
void stack_depth(unsigned long int d)
Record stack depth d.
bool rightmost(void) const
Test whether current alternative is rightmost.
Edge(void)
Default constructor.
Gecode toplevel namespace
Space * space(void) const
Return space for edge.
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
void dispose(void)
Free memory for edge.
Edge & top(void) const
Provide access to topmost edge.