38 namespace Gecode {
namespace Search {
namespace Par {
44 template<
class Tracer>
48 template<
class Tracer>
55 template<
class Tracer>
60 template<
class Tracer>
66 template<
class Tracer>
72 template<
class Tracer>
78 template<
class Tracer>
83 template<
class Tracer>
88 template<
class Tracer>
93 template<
class Tracer>
98 template<
class Tracer>
103 template<
class Tracer>
110 template<
class Tracer>
116 template<
class Tracer>
130 template<
class Tracer>
135 template<
class Tracer>
141 template<
class Tracer>
147 template<
class Tracer>
150 if (!ds.empty() && ds.top().lao()) {
158 stat.
stack_depth(static_cast<unsigned long int>(ds.entries()));
162 template<
class Tracer>
166 if (ds.top().rightmost()) {
169 assert(ds.top().work());
171 if (!ds.top().work())
177 template<
class Tracer>
184 template<
class Tracer>
190 template<
class Tracer>
193 const Edge&
n = ds[
i];
194 s->
commit(*n.choice(),n.alt());
197 template<
class Tracer>
200 int l = ds.entries()-1;
201 while (ds[l].space() == NULL)
206 template<
class Tracer>
212 template<
class Tracer>
215 assert((ds[l].space() == NULL) || ds[l].space()->failed());
216 int n = ds.entries();
218 for (
int i=l;
i<
n;
i++) {
220 unsigned int fa = (
i !=
l) ? top.
alt() + 1 : top.
alt();
230 for (
int i=l;
i<
n;
i++) {
236 assert(ds.entries() ==
l);
239 template<
class Tracer>
248 template<
class Tracer>
254 template<
class Tracer>
259 int n = ds.entries()-1;
268 while (ds[l].space() == NULL)
270 Space*
c = ds[
l].space()->clone();
272 for (
int i=l;
i<
n;
i++)
274 unsigned int a = ds[
n].steal();
275 c->
commit(*ds[n].choice(),a);
279 ngdl(
std::min(ngdl(),static_cast<unsigned int>(n)));
280 d = stat.
steal_depth(static_cast<unsigned long int>(n+1));
282 ot.ei()->init(myt.wid(),ds[
n].nid(),
a, *
c, *ds[
n].choice());
291 template<
class Tracer>
300 if ((ds.top().space() != NULL) && ds.top().rightmost()) {
301 Space* s = ds.top().space();
302 s->
commit(*ds.top().choice(),ds.top().alt());
303 assert(ds.entries()-1 == lc());
304 ds.top().space(NULL);
306 if (static_cast<unsigned int>(ds.entries()) > ngdl())
313 int n = ds.entries();
315 d =
static_cast<unsigned int>(n -
l);
321 for (
int i=l;
i<
n;
i++)
324 int m = l +
static_cast<int>(d >> 1);
330 for (; (i<
n) && ds[i].rightmost(); i++)
348 d =
static_cast<unsigned int>(n-
i);
357 template<
class Tracer>
367 if ((ds.top().space() != NULL) && ds.top().rightmost()) {
368 Space* s = ds.top().space();
369 s->
commit(*ds.top().choice(),ds.top().alt());
370 assert(ds.entries()-1 == lc());
371 if (mark > ds.entries()-1) {
372 mark = ds.entries()-1;
375 ds.top().space(NULL);
377 if (static_cast<unsigned int>(ds.entries()) > ngdl())
384 int n = ds.entries();
386 d =
static_cast<unsigned int>(n -
l);
412 for (
int i=l;
i<
n;
i++)
415 int m = l +
static_cast<int>(d >> 1);
421 for (; (i<
n) && ds[i].rightmost(); i++)
442 d =
static_cast<unsigned int>(n-
i);
451 template<
class Tracer>
unsigned int alternatives(void) const
Return number of alternatives.
unsigned int alt(void) const
Return number for alternatives.
bool work(void) const
Test whether there is an alternative that can be stolen.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
unsigned int n_work
Number of edges that have work for stealing.
unsigned long int steal_depth(unsigned long int d) const
Return steal depth.
unsigned int _alt
Current alternative.
bool rightmost(void) const
Test whether current alternative is rightmost.
bool empty(void) const
Test whether path is empty.
Path(unsigned int l)
Initialize with no-good depth limit l.
unsigned long int fail
Number of failed nodes in search tree.
void dispose(void)
Free memory for edge.
void * mark(void *p)
Return marked pointer for unmarked pointer p.
Support::DynamicStack< Edge, Heap > ds
Stack to store edge information.
Search tree edge for recomputation
unsigned int nid(void) const
Return node identifier.
int entries(void) const
Return number of entries on stack.
Gecode::FloatVal c(-8, 8)
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
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) ...
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
unsigned int steal(void)
Steal rightmost alternative and return its number.
virtual void constrain(const Space &best)
Constrain function for best solution search.
unsigned int _ngdl
Depth limit for no-good generation.
const Choice * choice(void) const
Return choice.
Edge(void)
Default constructor.
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
void next(void)
Move to next alternative.
unsigned int _alt_max
Number of alternatives left.
Heap heap
The single global heap.
bool lao(void) const
Test whether current alternative was LAO.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
void stack_depth(unsigned long int d)
Record stack depth d.
Gecode toplevel namespace
const Choice * _choice
Choice.
unsigned int truealt(void) const
Return true number for alternatives (excluding lao optimization)
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
const unsigned int steal_limit
Minimal number of open nodes for stealing.
Space * space(void) const
Return space for edge.
Space * _space
Space corresponding to this edge (might be NULL)
Edge & top(void) const
Provide access to topmost edge.