38 namespace Gecode {
namespace Search {
namespace Seq {
44 template<
class Tracer>
48 template<
class Tracer>
53 template<
class Tracer>
58 template<
class Tracer>
64 template<
class Tracer>
69 template<
class Tracer>
74 template<
class Tracer>
79 template<
class Tracer>
84 template<
class Tracer>
89 template<
class Tracer>
95 template<
class Tracer>
101 template<
class Tracer>
107 template<
class Tracer>
121 template<
class Tracer>
126 template<
class Tracer>
132 template<
class Tracer>
138 template<
class Tracer>
141 if (!ds.empty() && ds.top().lao()) {
147 stat.
stack_depth(static_cast<unsigned long int>(ds.entries()));
151 template<
class Tracer>
155 if (ds.top().rightmost()) {
163 template<
class Tracer>
170 template<
class Tracer>
176 template<
class Tracer>
179 const Edge&
n = ds[
i];
180 s->
commit(*n.choice(),n.alt());
183 template<
class Tracer>
186 int l = ds.entries()-1;
187 while (ds[l].space() == NULL)
192 template<
class Tracer>
198 template<
class Tracer>
201 assert((ds[l].space() == NULL) || ds[l].space()->failed());
202 int n = ds.entries();
204 for (
int i=l;
i<
n;
i++) {
206 unsigned int fa = (
i !=
l) ? top.
alt() + 1 : top.
alt();
214 for (
int i=l;
i<
n;
i++)
217 assert(ds.entries() ==
l);
220 template<
class Tracer>
227 template<
class Tracer>
236 if ((ds.top().space() != NULL) && ds.top().rightmost()) {
237 Space* s = ds.top().space();
238 s->
commit(*ds.top().choice(),ds.top().alt());
239 assert(ds.entries()-1 == lc());
240 ds.top().space(NULL);
242 if (static_cast<unsigned int>(ds.entries()) > ngdl())
249 int n = ds.entries();
251 d =
static_cast<unsigned int>(n -
l);
257 for (
int i=l;
i<
n;
i++)
260 int m = l +
static_cast<int>(d >> 1);
266 for (; (i<
n) && ds[i].rightmost(); i++)
284 d =
static_cast<unsigned int>(n-
i);
293 template<
class Tracer>
303 if ((ds.top().space() != NULL) && ds.top().rightmost()) {
304 Space* s = ds.top().space();
305 s->
commit(*ds.top().choice(),ds.top().alt());
306 assert(ds.entries()-1 == lc());
307 if (mark > ds.entries()-1) {
308 mark = ds.entries()-1;
311 ds.top().space(NULL);
313 if (static_cast<unsigned int>(ds.entries()) > ngdl())
320 int n = ds.entries();
322 d =
static_cast<unsigned int>(n -
l);
348 for (
int i=l;
i<
n;
i++)
351 int m = l +
static_cast<int>(d >> 1);
357 for (; (i<
n) && ds[i].rightmost(); i++)
378 d =
static_cast<unsigned int>(n-
i);
387 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.