57 Actor* Actor::sentinel;
60 Actor::~Actor(
void) {}
97 std::ostream&)
const {
109 #ifdef GECODE_HAS_VAR_DISPOSE
115 #ifdef GECODE_HAS_VAR_DISPOSE
122 b_status = b_commit = Brancher::cast(&bl);
124 d_fst = d_cur = d_lst = NULL;
126 pc.p.active = &pc.p.queue[0]-1;
129 pc.p.queue[
i].init();
130 pc.p.branch_id = reserved_branch_id+1;
137 if (duplicate && (d_fst != NULL)) {
138 for (
Actor** f = d_fst; f < d_cur; f++)
142 if (d_cur == d_lst) {
146 d_fst = alloc<Actor*>(4);
151 unsigned int n =
static_cast<unsigned int>(d_lst - d_fst);
153 d_fst = realloc<Actor*>(d_fst,
n,2*
n);
230 #ifdef GECODE_HAS_VAR_DISPOSE
233 if (_vars_d[
i] != NULL)
259 if (pc.p.active >= &pc.p.queue[0]) {
282 assert(pc.p.active >= &pc.p.queue[0]);
285 if (pc.p.active != fst) {
286 p = Propagator::cast(fst);
296 p->u.
med = 0; p->unlink(); pl.
head(p);
300 assert(pc.p.active >= &pc.p.queue[0]);
303 if (pc.p.active != fst) {
304 p = Propagator::cast(fst);
307 }
while (--pc.p.active >= &pc.p.queue[0]);
308 assert(pc.p.active < &pc.p.queue[0]);
312 goto stable_or_unstable;
315 assert(p->u.
med != 0);
346 while (b_status != Brancher::cast(&bl))
347 if (b_status->
status(*
this)) {
352 b_status = Brancher::cast(b_status->next());
357 stat.
wmp = (wmp() > 0U);
368 if (
failed() || (b_status == Brancher::cast(&bl))) {
372 while (b != Brancher::cast(&bl)) {
374 b = Brancher::cast(b->next());
378 b_status = b_commit = Brancher::cast(&bl);
386 while (b != b_status) {
388 b = Brancher::cast(b->next());
394 return b_status->
choice(*
this);
399 unsigned int id; e >> id;
401 while (b_cur != Brancher::cast(&bl)) {
402 if (
id == b_cur->
id())
403 return b_cur->
choice(*
this,e);
404 b_cur = Brancher::cast(b_cur->next());
410 Space::_commit(
const Choice&
c,
unsigned int a) {
421 throw SpaceNoBrancher(
"Space::commit");
433 return b->ngl(*
this,c,a);
446 if (
Brancher*
b = const_cast<Space&>(*this).brancher(c._id)) {
448 b->print(*
this,c,a,o);
456 Space::kill_brancher(
unsigned int id) {
460 b != Brancher::cast(&bl);
b = Brancher::cast(
b->next()))
464 b_commit = Brancher::cast(
b->next());
466 b_status = Brancher::cast(
b->next());
488 : sm(s.sm->copy(share)),
491 d_fst(&
Actor::sentinel),
492 _wmp_afc(s._wmp_afc) {
493 #ifdef GECODE_HAS_VAR_DISPOSE
498 pc.c.vars_u[
i] = NULL;
499 pc.c.vars_noidx = NULL;
507 Actor* c = Actor::cast(a)->copy(*
this,share);
521 Actor* c = Actor::cast(a)->copy(*
this,share);
531 if (s.b_status == &s.bl) {
532 b_status = Brancher::cast(&bl);
534 b_status = Brancher::cast(s.b_status->prev());
536 if (s.b_commit == &s.bl) {
537 b_commit = Brancher::cast(&bl);
539 b_commit = Brancher::cast(s.b_commit->prev());
544 Space::_clone(
bool share) {
546 throw SpaceFailed(
"Space::clone");
548 throw SpaceNotStable(
"Space::clone");
551 Space* c = copy(share);
553 if (c->d_fst != &Actor::sentinel)
554 throw SpaceNotCloned(
"Space::clone");
558 unsigned int n =
static_cast<unsigned int>(d_cur - d_fst);
561 c->d_fst = c->d_cur = c->d_lst = NULL;
564 c->d_fst = c->alloc<Actor*>(n+1);
566 c->d_lst = c->d_fst+n+1;
567 for (Actor** d_fst_iter = d_fst; d_fst_iter != d_cur; d_fst_iter++) {
568 if ((*d_fst_iter)->prev())
569 *(c->d_cur++) = Actor::cast((*d_fst_iter)->prev());
575 VarImp<NoIdxVarImpConf>*
x =
576 static_cast<VarImp<NoIdxVarImpConf>*
>(c->pc.c.vars_noidx);
578 VarImp<NoIdxVarImpConf>* n = x->next();
579 x->b.base = NULL; x->u.idx[0] = 0;
580 if (
sizeof(ActorLink**) >
sizeof(
unsigned int))
581 *(1+&x->u.idx[0]) = 0;
585 c->update(static_cast<ActorLink**>(c->mm.subscriptions()));
589 ActorLink* p_a = &pl;
590 ActorLink* c_a = p_a->next();
593 Propagator* p = Propagator::cast(c_a);
594 if (p->u.advisors != NULL) {
595 ActorLink* a = p->u.advisors;
596 p->u.advisors = NULL;
598 a->prev(p); a = a->next();
601 c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
605 ActorLink* p_a = &bl;
606 ActorLink* c_a = p_a->next();
609 c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
614 for (SharedHandle::Object* s = c->pc.c.shared; s != NULL; s = s->next)
618 for (ActorLink*
l = c->pc.c.local;
l != NULL;
l =
l->next())
622 c->pc.p.active = &c->pc.p.queue[0]-1;
623 for (
int i=0;
i<=PropCost::AC_MAX;
i++)
624 c->pc.p.queue[
i].init();
626 c->pc.p.n_sub = pc.p.n_sub;
627 c->pc.p.branch_id = pc.p.branch_id;
641 Space::slave(
unsigned long int,
const Space*) {
645 LocalObject::fwdcopy(
Space& home,
bool share) {
646 ActorLink::cast(
this)->prev(copy(home,share));
647 next(home.pc.
c.local);
648 home.pc.
c.local =
this;
657 Space::afc_decay(
double d) {
660 if (gafc.decay() != 1.0)
662 (
void) gafc.afc(p.propagator().gafc);
667 Space::afc_set(
double a) {
670 gafc.set(p.propagator().gafc,
a);
675 NGL::notice(
void)
const {