64 Actor::~Actor(
void) {}
85 unsigned long int Space::unused_uli;
91 #ifdef GECODE_HAS_VAR_DISPOSE
97 #ifdef GECODE_HAS_VAR_DISPOSE
104 b_status = b_commit = Brancher::cast(&bl);
106 d_fst = d_cur = d_lst = NULL;
108 pc.p.active = &pc.p.queue[0]-1;
111 pc.p.queue[
i].init();
117 Space::d_resize(
void) {
120 d_fst = alloc<Actor*>(4);
125 unsigned int n =
static_cast<unsigned int>(d_lst - d_fst);
127 d_fst = realloc<Actor*>(d_fst,n,2*n);
155 p.propagator().pi.init();
172 #ifdef GECODE_HAS_VAR_DISPOSE
175 if (_vars_d[
i] != NULL)
201 if (pc.p.active >= &pc.p.queue[0]) {
223 assert(pc.p.active >= &pc.p.queue[0]);
226 if (pc.p.active != fst) {
227 p = Propagator::cast(fst);
237 p->u.
med = 0; p->unlink(); pl.
head(p);
241 assert(pc.p.active >= &pc.p.queue[0]);
244 if (pc.p.active != fst) {
245 p = Propagator::cast(fst);
248 }
while (--pc.p.active >= &pc.p.queue[0]);
249 assert(pc.p.active < &pc.p.queue[0]);
253 goto stable_or_unstable;
256 assert(p->u.
med != 0);
287 while (b_status != Brancher::cast(&bl))
288 if (b_status->
status(*
this)) {
293 b_status = Brancher::cast(b_status->next());
298 stat.
wmp = (n_wmp > 0);
299 if (n_wmp == 1) n_wmp = 0;
308 if (
failed() || (b_status == Brancher::cast(&bl))) {
312 while (b != Brancher::cast(&bl)) {
314 b = Brancher::cast(b->next());
318 b_status = b_commit = Brancher::cast(&bl);
326 while (b != b_status) {
328 b = Brancher::cast(b->next());
334 return b_status->
choice(*
this);
339 unsigned int id; e >> id;
341 while (b_cur != Brancher::cast(&bl)) {
342 if (
id == b_cur->
id())
343 return b_cur->
choice(*
this,e);
344 b_cur = Brancher::cast(b_cur->next());
350 Space::_commit(
const Choice&
c,
unsigned int a) {
371 while (b_commit != Brancher::cast(&bl))
372 if (c._id != b_commit->
id())
373 b_commit = Brancher::cast(b_commit->next());
376 if (b_commit == Brancher::cast(&bl)) {
378 b_commit = Brancher::cast(bl.
next());
379 while (b_commit != b_old)
380 if (c._id != b_commit->
id())
381 b_commit = Brancher::cast(b_commit->next());
386 throw SpaceNoBrancher();
407 : sm(s.sm->copy(share)),
408 mm(sm,s.mm,s.pc.p.n_sub*sizeof(
Propagator**)),
411 #ifdef GECODE_HAS_VAR_DISPOSE
416 pc.c.vars_u[
i] = NULL;
417 pc.c.vars_noidx = NULL;
425 Actor* c = Actor::cast(a)->copy(*
this,share);
439 Actor* c = Actor::cast(a)->copy(*
this,share);
449 if (s.b_status == &s.bl) {
450 b_status = Brancher::cast(&bl);
452 b_status = Brancher::cast(s.b_status->prev());
454 if (s.b_commit == &s.bl) {
455 b_commit = Brancher::cast(&bl);
457 b_commit = Brancher::cast(s.b_commit->prev());
462 Space::_clone(
bool share) {
464 throw SpaceFailed(
"Space::clone");
466 throw SpaceNotStable(
"Space::clone");
469 Space* c = copy(share);
473 unsigned int n =
static_cast<unsigned int>(d_cur - d_fst);
476 c->d_fst = c->d_cur = c->d_lst = NULL;
479 c->d_fst = c->alloc<Actor*>(n+1);
481 c->d_lst = c->d_fst+n+1;
482 for (Actor** d_fst_iter = d_fst; d_fst_iter != d_cur; d_fst_iter++) {
483 if ((*d_fst_iter)->prev())
484 *(c->d_cur++) = Actor::cast((*d_fst_iter)->prev());
490 VarImp<NoIdxVarImpConf>* x =
491 static_cast<VarImp<NoIdxVarImpConf>*
>(c->pc.c.vars_noidx);
493 VarImp<NoIdxVarImpConf>* n = x->next();
494 x->b.base = NULL; x->u.idx[0] = 0;
498 c->update(static_cast<ActorLink**>(c->mm.subscriptions()));
502 ActorLink* p_a = &pl;
503 ActorLink* c_a = p_a->next();
506 Propagator* p = Propagator::cast(c_a);
507 if (p->u.advisors != NULL) {
508 ActorLink* a = p->u.advisors;
509 p->u.advisors = NULL;
511 a->prev(p); a = a->next();
514 c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
518 ActorLink* p_a = &bl;
519 ActorLink* c_a = p_a->next();
522 c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
527 for (SharedHandle::Object* s = c->pc.c.shared; s != NULL; s = s->next)
531 for (ActorLink* l = c->pc.c.local; l != NULL; l = l->next())
535 c->pc.p.active = &c->pc.p.queue[0]-1;
536 for (
int i=0;
i<=PropCost::AC_MAX;
i++)
537 c->pc.p.queue[
i].init();
539 c->pc.p.n_sub = pc.p.n_sub;
540 c->pc.p.branch_id = pc.p.branch_id;
550 LocalObject::fwdcopy(
Space& home,
bool share) {
551 ActorLink::cast(
this)->prev(copy(home,share));
552 next(home.pc.
c.local);
553 home.pc.
c.local =
this;