53 root->subscribe(home,*
this);
n++;
54 bool notice =
root->notice();
56 while ((l != NULL) && l->
leaf()) {
57 l->subscribe(home,*this); n++;
58 notice = notice || l->notice();
64 while (!notice && (l != NULL)) {
65 notice = notice || l->
notice();
75 assert(p.
root != NULL);
78 for (
NGL* pc = p.
root; pc != NULL; pc = pc->
next()) {
79 NGL*
n = pc->copy(home);
92 int n = std::min(p.ds.entries(),
static_cast<int>(p.ngdl()));
94 unsigned long int n_nogood = 0;
97 while ((
n > s) && (p.ds[
n-1].truealt() == 0U))
106 while ((s <
n) && (p.ds[s].truealt() > 0U))
108 if (p.ds[s].rightmost()) {
110 home.
trycommit(*p.ds[s].choice(),p.ds[s].truealt());
114 for (
unsigned int a=0U; a<p.ds[s].truealt(); a++) {
115 NGL* l = home.
ngl(*p.ds[s].choice(),a);
122 if (
NGL* l = home.
ngl(*p.ds[s].choice(),p.ds[s].truealt())) {
136 ((
n-s == 1) && (c != &nn)));
142 for (
int i=s; i<
n; i++) {
144 for (
unsigned int a=0U; a<p.ds[i].truealt(); a++) {
145 NGL* l = home.
ngl(*p.ds[i].choice(),a);
153 c = c->add(l,
true); ll = c;
157 if (
NGL* l = home.
ngl(*p.ds[i].choice(),p.ds[i].truealt())) {
159 }
else if (!p.ds[i].rightmost()) {
168 const_cast<Path&
>(p).ng(n_nogood);
Home class for posting propagators
No-good literal recorded during search.
bool leaf(void) const
Test whether literal is a leaf.
virtual ExecStatus prune(Space &home)=0
Propagate the negation of the no-good literal.
virtual void subscribe(Space &home, Propagator &p)=0
Subscribe propagator p to all views of the no-good literal.
NGL(void)
Constructor for creation.
NGL * next(void) const
Return pointer to next literal.
virtual bool notice(void) const
Whether dispose must always be called (returns false)
Propagator(Home home)
Constructor for posting.
static ExecStatus post(Space &home, const Path &p)
Post propagator for path p.
unsigned int n
Number of no-good literals with subscriptions.
NoGoodsProp(Space &home, NGL *root)
Constructor for creation.
NGL * root
Root of no-good literal tree.
Class for a sentinel no-good literal.
NoNGL(void)
Constructor for creation.
bool failed(void) const
Check whether space is failed.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
@ AP_DISPOSE
Actor must always be disposed.
void trycommit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
If possible, commit choice c for alternative a.
NGL * ngl(const Choice &c, unsigned int a)
Create no-good literal for choice c and alternative a.
Gecode toplevel namespace
@ ES_OK
Execution is okay.
@ ES_FAILED
Execution has resulted in failure.