Generated on Sat Feb 7 2015 02:01:27 for Gecode by doxygen 1.8.9.1
core.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2002
8  *
9  * Last modified:
10  * $Date: 2015-01-05 07:32:41 +0100 (Mon, 05 Jan 2015) $ by $Author: tack $
11  * $Revision: 14336 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include <gecode/kernel.hh>
39 
40 namespace Gecode {
41 
42  /*
43  * Variable type disposer
44  *
45  */
46  void
48 
50 
51 
52 
53  /*
54  * Actor
55  *
56  */
57  Actor* Actor::sentinel;
58 
59 #ifdef __GNUC__
60  Actor::~Actor(void) {}
62 #endif
63 
64 
65 
66  /*
67  * Propagator
68  *
69  */
72  assert(false);
73  return ES_FAILED;
74  }
75 
76 
77  /*
78  * No-goods
79  *
80  */
81  void
82  NoGoods::post(Space&) const {
83  }
84 
86 
87  /*
88  * Brancher
89  *
90  */
91  NGL*
92  Brancher::ngl(Space&, const Choice&, unsigned int) const {
93  return NULL;
94  }
95 
96  void
97  Brancher::print(const Space&, const Choice&, unsigned int,
98  std::ostream&) const {
99  }
100 
101 
102  /*
103  * Space: Misc
104  *
105  */
106  StatusStatistics Space::unused_status;
107  CloneStatistics Space::unused_clone;
108  CommitStatistics Space::unused_commit;
109 
110 #ifdef GECODE_HAS_VAR_DISPOSE
112 #endif
113 
115  : sm(new SharedMemory), mm(sm), _wmp_afc(0U) {
116 #ifdef GECODE_HAS_VAR_DISPOSE
117  for (int i=0; i<AllVarConf::idx_d; i++)
118  _vars_d[i] = NULL;
119 #endif
120  // Initialize propagator and brancher links
121  pl.init();
122  bl.init();
123  b_status = b_commit = Brancher::cast(&bl);
124  // Initialize array for forced deletion to be empty
125  d_fst = d_cur = d_lst = NULL;
126  // Initialize space as stable but not failed
127  pc.p.active = &pc.p.queue[0]-1;
128  // Initialize propagator queues
129  for (int i=0; i<=PropCost::AC_MAX; i++)
130  pc.p.queue[i].init();
131  pc.p.branch_id = reserved_branch_id+1;
132  pc.p.n_sub = 0;
133  }
134 
135  void
136  Space::notice(Actor& a, ActorProperty p, bool duplicate) {
137  if (p & AP_DISPOSE) {
138  if (duplicate && (d_fst != NULL)) {
139  for (Actor** f = d_fst; f < d_cur; f++)
140  if (&a == *f)
141  return;
142  }
143  if (d_cur == d_lst) {
144  // Resize
145  if (d_fst == NULL) {
146  // Create new array
147  d_fst = alloc<Actor*>(4);
148  d_cur = d_fst;
149  d_lst = d_fst+4;
150  } else {
151  // Resize existing array
152  unsigned int n = static_cast<unsigned int>(d_lst - d_fst);
153  assert(n != 0);
154  d_fst = realloc<Actor*>(d_fst,n,2*n);
155  d_cur = d_fst+n;
156  d_lst = d_fst+2*n;
157  }
158  }
159  *(d_cur++) = &a;
160  } else if (p & AP_WEAKLY) {
161  if (wmp() == 0)
162  wmp(2);
163  else
164  wmp(wmp()+1);
165  }
166  }
167 
168  void
169  Space::ignore(Actor& a, ActorProperty p, bool duplicate) {
170  if (p & AP_DISPOSE) {
171  // Check wether array has already been discarded as space
172  // deletion is already in progress
173  if (d_fst == NULL)
174  return;
175  Actor** f = d_fst;
176  if (duplicate) {
177  while (f < d_cur)
178  if (&a == *f)
179  break;
180  else
181  f++;
182  if (f == d_cur)
183  return;
184  } else {
185  while (&a != *f)
186  f++;
187  }
188  *f = *(--d_cur);
189  } else if (p & AP_WEAKLY) {
190  assert(wmp() > 1U);
191  wmp(wmp()-1);
192  }
193  }
194 
195  unsigned int
196  Space::propagators(void) const {
197  unsigned int n = 0;
198  for (Propagators p(*this); p(); ++p)
199  n++;
200  return n;
201  }
202 
203  unsigned int
204  Space::branchers(void) const {
205  unsigned int n = 0;
206  for (Branchers b(*this); b(); ++b)
207  n++;
208  return n;
209  }
210 
211  void
212  Space::flush(void) {
213  // Flush malloc cache
214  sm->flush();
215  }
216 
218  // Mark space as failed
219  fail();
220  // Delete actors that must be deleted
221  {
222  Actor** a = d_fst;
223  Actor** e = d_cur;
224  // So that d_unforce knows that deletion is in progress
225  d_fst = NULL;
226  while (a < e) {
227  (void) (*a)->dispose(*this);
228  a++;
229  }
230  }
231 #ifdef GECODE_HAS_VAR_DISPOSE
232  // Delete variables that were registered for disposal
233  for (int i=AllVarConf::idx_d; i--;)
234  if (_vars_d[i] != NULL)
235  vd[i]->dispose(*this, _vars_d[i]);
236 #endif
237  // Release memory from memory manager
238  mm.release(sm);
239  // Release shared memory
240  if (sm->release())
241  delete sm;
242  }
243 
244 
245 
246  /*
247  * Space: propagation
248  *
249  */
250 
254  // Check whether space is failed
255  if (failed()) {
256  s = SS_FAILED; goto exit;
257  }
258  assert(pc.p.active <= &pc.p.queue[PropCost::AC_MAX+1]);
259  // Check whether space is stable but not failed
260  if (pc.p.active >= &pc.p.queue[0]) {
261  Propagator* p;
262  ModEventDelta med_o;
263  goto unstable;
264  execute:
265  stat.propagate++;
266  // Keep old modification event delta
267  med_o = p->u.med;
268  // Clear med but leave propagator in queue
269  p->u.med = 0;
270  switch (p->propagate(*this,med_o)) {
271  case ES_FAILED:
272  // Count failure
273  if (afc_enabled())
274  gafc.fail(p->gafc);
275  // Mark as failed
276  fail(); s = SS_FAILED; goto exit;
277  case ES_NOFIX:
278  // Find next, if possible
279  if (p->u.med != 0) {
280  unstable:
281  // There is at least one propagator in a queue
282  do {
283  assert(pc.p.active >= &pc.p.queue[0]);
284  // First propagator or link back to queue
285  ActorLink* fst = pc.p.active->next();
286  if (pc.p.active != fst) {
287  p = Propagator::cast(fst);
288  goto execute;
289  }
290  pc.p.active--;
291  } while (true);
292  GECODE_NEVER;
293  }
294  // Fall through
295  case ES_FIX:
296  // Clear med and put into idle queue
297  p->u.med = 0; p->unlink(); pl.head(p);
298  stable_or_unstable:
299  // There might be a propagator in the queue
300  do {
301  assert(pc.p.active >= &pc.p.queue[0]);
302  // First propagator or link back to queue
303  ActorLink* fst = pc.p.active->next();
304  if (pc.p.active != fst) {
305  p = Propagator::cast(fst);
306  goto execute;
307  }
308  } while (--pc.p.active >= &pc.p.queue[0]);
309  assert(pc.p.active < &pc.p.queue[0]);
310  goto stable;
311  case __ES_SUBSUMED:
312  p->unlink(); rfree(p,p->u.size);
313  goto stable_or_unstable;
314  case __ES_PARTIAL:
315  // Schedule propagator with specified propagator events
316  assert(p->u.med != 0);
317  enqueue(p);
318  goto unstable;
319  default:
320  GECODE_NEVER;
321  }
322  }
323  stable:
324  /*
325  * Find the next brancher that has still alternatives left
326  *
327  * It is important to note that branchers reporting to have no more
328  * alternatives left cannot be deleted. They cannot be deleted
329  * as there might be choices to be used in commit
330  * that refer to one of these branchers. This e.g. happens when
331  * we combine branch-and-bound search with adaptive recomputation: during
332  * recomputation, a copy is constrained to be better than the currently
333  * best solution, then the first half of the choices are posted,
334  * and a fixpoint computed (for storing in the middle of the path). Then
335  * the remaining choices are posted, and because of the additional
336  * constraints that the space must be better than the previous solution,
337  * the corresponding Branchers may already have no alternatives left.
338  *
339  * The same situation may arise due to weakly monotonic propagators.
340  *
341  * A brancher reporting that no more alternatives exist is exhausted.
342  * All exhausted branchers will be left of the current pointer b_status.
343  * Only when it is known that no more choices
344  * can be used for commit an exhausted brancher can actually be deleted.
345  * This becomes known when choice is called.
346  */
347  while (b_status != Brancher::cast(&bl))
348  if (b_status->status(*this)) {
349  // Brancher still has choices to generate
350  s = SS_BRANCH; goto exit;
351  } else {
352  // Brancher is exhausted
353  b_status = Brancher::cast(b_status->next());
354  }
355  // No brancher with alternatives left, space is solved
356  s = SS_SOLVED;
357  exit:
358  stat.wmp = (wmp() > 0U);
359  if (wmp() == 1U)
360  wmp(0U);
361  return s;
362  }
363 
364 
365  const Choice*
367  if (!stable())
368  throw SpaceNotStable("Space::choice");
369  if (failed() || (b_status == Brancher::cast(&bl))) {
370  // There are no more choices to be generated
371  // Delete all branchers
372  Brancher* b = Brancher::cast(bl.next());
373  while (b != Brancher::cast(&bl)) {
374  Brancher* d = b;
375  b = Brancher::cast(b->next());
376  rfree(d,d->dispose(*this));
377  }
378  bl.init();
379  b_status = b_commit = Brancher::cast(&bl);
380  return NULL;
381  }
382  /*
383  * The call to choice() says that no older choices
384  * can be used. Hence, all branchers that are exhausted can be deleted.
385  */
386  Brancher* b = Brancher::cast(bl.next());
387  while (b != b_status) {
388  Brancher* d = b;
389  b = Brancher::cast(b->next());
390  d->unlink();
391  rfree(d,d->dispose(*this));
392  }
393  // Make sure that b_commit does not point to a deleted brancher!
394  b_commit = b_status;
395  return b_status->choice(*this);
396  }
397 
398  const Choice*
399  Space::choice(Archive& e) const {
400  unsigned int id; e >> id;
401  Brancher* b_cur = Brancher::cast(bl.next());
402  while (b_cur != Brancher::cast(&bl)) {
403  if (id == b_cur->id())
404  return b_cur->choice(*this,e);
405  b_cur = Brancher::cast(b_cur->next());
406  }
407  throw SpaceNoBrancher("Space::choice");
408  }
409 
410  void
411  Space::_commit(const Choice& c, unsigned int a) {
412  if (a >= c.alternatives())
413  throw SpaceIllegalAlternative("Space::commit");
414  if (failed())
415  return;
416  if (Brancher* b = brancher(c._id)) {
417  // There is a matching brancher
418  if (b->commit(*this,c,a) == ES_FAILED)
419  fail();
420  } else {
421  // There is no matching brancher!
422  throw SpaceNoBrancher("Space::commit");
423  }
424  }
425 
426  void
427  Space::_trycommit(const Choice& c, unsigned int a) {
428  if (a >= c.alternatives())
429  throw SpaceIllegalAlternative("Space::commit");
430  if (failed())
431  return;
432  if (Brancher* b = brancher(c._id)) {
433  // There is a matching brancher
434  if (b->commit(*this,c,a) == ES_FAILED)
435  fail();
436  }
437  }
438 
439  NGL*
440  Space::ngl(const Choice& c, unsigned int a) {
441  if (a >= c.alternatives())
442  throw SpaceIllegalAlternative("Space::ngl");
443  if (failed())
444  return NULL;
445  if (Brancher* b = brancher(c._id)) {
446  // There is a matching brancher
447  return b->ngl(*this,c,a);
448  } else {
449  return NULL;
450  }
451  }
452 
453  void
454  Space::print(const Choice& c, unsigned int a, std::ostream& o) const {
455  if (a >= c.alternatives())
456  throw SpaceIllegalAlternative("Space::print");
457  if (failed())
458  return;
459  if (Brancher* b = const_cast<Space&>(*this).brancher(c._id)) {
460  // There is a matching brancher
461  b->print(*this,c,a,o);
462  } else {
463  // There is no matching brancher!
464  throw SpaceNoBrancher("Space::print");
465  }
466  }
467 
468  void
469  Space::kill_brancher(unsigned int id) {
470  if (failed())
471  return;
472  for (Brancher* b = Brancher::cast(bl.next());
473  b != Brancher::cast(&bl); b = Brancher::cast(b->next()))
474  if (b->id() == id) {
475  // Make sure that neither b_status nor b_commit does not point to b
476  if (b_commit == b)
477  b_commit = Brancher::cast(b->next());
478  if (b_status == b)
479  b_status = Brancher::cast(b->next());
480  b->unlink();
481  rfree(b,b->dispose(*this));
482  return;
483  }
484  }
485 
486 
487 
488 
489  /*
490  * Space cloning
491  *
492  * Cloning is performed in two steps:
493  * - The space itself is copied by the copy constructor. This
494  * also copies all propagators, branchers, and variables.
495  * The copied variables are recorded.
496  * - In the second step the dependency information of the recorded
497  * variables is updated and their forwarding information is reset.
498  *
499  */
500  Space::Space(bool share, Space& s)
501  : sm(s.sm->copy(share)),
502  mm(sm,s.mm,s.pc.p.n_sub*sizeof(Propagator**)),
503  gafc(s.gafc),
504  d_fst(&Actor::sentinel),
505  _wmp_afc(s._wmp_afc) {
506 #ifdef GECODE_HAS_VAR_DISPOSE
507  for (int i=0; i<AllVarConf::idx_d; i++)
508  _vars_d[i] = NULL;
509 #endif
510  for (int i=0; i<AllVarConf::idx_c; i++)
511  pc.c.vars_u[i] = NULL;
512  pc.c.vars_noidx = NULL;
513  pc.c.shared = NULL;
514  pc.c.local = NULL;
515  // Copy all propagators
516  {
517  ActorLink* p = &pl;
518  ActorLink* e = &s.pl;
519  for (ActorLink* a = e->next(); a != e; a = a->next()) {
520  Actor* c = Actor::cast(a)->copy(*this,share);
521  // Link copied actor
522  p->next(ActorLink::cast(c)); ActorLink::cast(c)->prev(p);
523  // Note that forwarding is done in the constructors
524  p = c;
525  }
526  // Link last actor
527  p->next(&pl); pl.prev(p);
528  }
529  // Copy all branchers
530  {
531  ActorLink* p = &bl;
532  ActorLink* e = &s.bl;
533  for (ActorLink* a = e->next(); a != e; a = a->next()) {
534  Actor* c = Actor::cast(a)->copy(*this,share);
535  // Link copied actor
536  p->next(ActorLink::cast(c)); ActorLink::cast(c)->prev(p);
537  // Note that forwarding is done in the constructors
538  p = c;
539  }
540  // Link last actor
541  p->next(&bl); bl.prev(p);
542  }
543  // Setup brancher pointers
544  if (s.b_status == &s.bl) {
545  b_status = Brancher::cast(&bl);
546  } else {
547  b_status = Brancher::cast(s.b_status->prev());
548  }
549  if (s.b_commit == &s.bl) {
550  b_commit = Brancher::cast(&bl);
551  } else {
552  b_commit = Brancher::cast(s.b_commit->prev());
553  }
554  }
555 
556  Space*
557  Space::_clone(bool share) {
558  if (failed())
559  throw SpaceFailed("Space::clone");
560  if (!stable())
561  throw SpaceNotStable("Space::clone");
562 
563  // Copy all data structures (which in turn will invoke the constructor)
564  Space* c = copy(share);
565 
566  if (c->d_fst != &Actor::sentinel)
567  throw SpaceNotCloned("Space::clone");
568 
569  // Setup array for actor disposal in c
570  {
571  unsigned int n = static_cast<unsigned int>(d_cur - d_fst);
572  if (n == 0) {
573  // No actors
574  c->d_fst = c->d_cur = c->d_lst = NULL;
575  } else {
576  // Leave one entry free
577  c->d_fst = c->alloc<Actor*>(n+1);
578  c->d_cur = c->d_fst;
579  c->d_lst = c->d_fst+n+1;
580  for (Actor** d_fst_iter = d_fst; d_fst_iter != d_cur; d_fst_iter++) {
581  if ((*d_fst_iter)->prev())
582  *(c->d_cur++) = Actor::cast((*d_fst_iter)->prev());
583  }
584  }
585  }
586 
587  // Update variables without indexing structure
588  VarImp<NoIdxVarImpConf>* x =
589  static_cast<VarImp<NoIdxVarImpConf>*>(c->pc.c.vars_noidx);
590  while (x != NULL) {
591  VarImp<NoIdxVarImpConf>* n = x->next();
592  x->b.base = NULL; x->u.idx[0] = 0;
593  if (sizeof(ActorLink**) > sizeof(unsigned int))
594  *(1+&x->u.idx[0]) = 0;
595  x = n;
596  }
597  // Update variables with indexing structure
598  c->update(static_cast<ActorLink**>(c->mm.subscriptions()));
599 
600  // Re-establish prev links (reset forwarding information)
601  {
602  ActorLink* p_a = &pl;
603  ActorLink* c_a = p_a->next();
604  // First update propagators and advisors
605  while (c_a != &pl) {
606  Propagator* p = Propagator::cast(c_a);
607  if (p->u.advisors != NULL) {
608  ActorLink* a = p->u.advisors;
609  p->u.advisors = NULL;
610  do {
611  a->prev(p); a = a->next();
612  } while (a != NULL);
613  }
614  c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
615  }
616  }
617  {
618  ActorLink* p_a = &bl;
619  ActorLink* c_a = p_a->next();
620  // Update branchers
621  while (c_a != &bl) {
622  c_a->prev(p_a); p_a = c_a; c_a = c_a->next();
623  }
624  }
625 
626  // Reset links for shared objects
627  for (SharedHandle::Object* s = c->pc.c.shared; s != NULL; s = s->next)
628  s->fwd = NULL;
629 
630  // Reset links for local objects
631  for (ActorLink* l = c->pc.c.local; l != NULL; l = l->next())
632  l->prev(NULL);
633 
634  // Initialize propagator queue
635  c->pc.p.active = &c->pc.p.queue[0]-1;
636  for (int i=0; i<=PropCost::AC_MAX; i++)
637  c->pc.p.queue[i].init();
638  // Copy propagation only data
639  c->pc.p.n_sub = pc.p.n_sub;
640  c->pc.p.branch_id = pc.p.branch_id;
641  return c;
642  }
643 
644  void
645  Space::constrain(const Space&) {
646  }
647 
648  bool
649  Space::master(const CRI& cri) {
650  if (cri.last() != NULL)
651  constrain(*cri.last());
652  cri.nogoods().post(*this);
653  // Perform a restart even if a solution has been found
654  return true;
655  }
656 
657  bool
658  Space::slave(const CRI&) {
659  return true;
660  }
661 
662  void
663  LocalObject::fwdcopy(Space& home, bool share) {
664  ActorLink::cast(this)->prev(copy(home,share));
665  next(home.pc.c.local);
666  home.pc.c.local = this;
667  }
668 
669  void
670  Choice::archive(Archive& e) const {
671  e << id();
672  }
673 
674  void
675  Space::afc_decay(double d) {
676  afc_enable();
677  // Commit outstanding decay operations
678  if (gafc.decay() != 1.0)
679  for (Propagators p(*this); p(); ++p)
680  (void) gafc.afc(p.propagator().gafc);
681  gafc.decay(d);
682  }
683 
684  void
685  Space::afc_set(double a) {
686  afc_enable();
687  for (Propagators p(*this); p(); ++p)
688  gafc.set(p.propagator().gafc,a);
689  }
690 
691 
692  bool
693  NGL::notice(void) const {
694  return false;
695  }
696 
697 }
698 
699 // STATISTICS: kernel-core
Space must be branched (at least one brancher left)
Definition: core.hpp:1303
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
virtual Actor * copy(Space &home, bool share)=0
Create copy.
Actor must always be disposed.
Definition: core.hpp:610
void id(CArray t1, int w1, int h1, Array t2, int &w2, int &h2)
Identity symmetry.
SpaceStatus
Space status
Definition: core.hpp:1300
Statistics for execution of commit
Definition: core.hpp:1346
unsigned int branchers(void) const
Return number of branchers.
Definition: core.cpp:204
Base-class for propagators.
Definition: core.hpp:755
Internal: propagator is subsumed, do not use.
Definition: core.hpp:524
Exception: Commit with illegal alternative
Definition: exception.hpp:76
Base-class for advisors.
Definition: core.hpp:926
bool wmp
Whether a weakly monotonic propagator might have been executed.
Definition: core.hpp:1315
unsigned int alternatives(void) const
Return number of alternatives.
Definition: core.hpp:3173
Base-class for variable implementations.
Definition: core.hpp:243
unsigned long int propagate
Number of propagator executions.
Definition: core.hpp:1313
Propagation has computed fixpoint.
Definition: core.hpp:528
Current restart information during search.
Definition: core.hpp:1265
Computation spaces.
Definition: core.hpp:1362
virtual bool status(const Space &home) const =0
Check status of brancher, return true if alternatives left.
bool failed(void) const
Check whether space is failed.
Definition: core.hpp:3442
Base-class for both propagators and branchers.
Definition: core.hpp:666
Statistics for execution of status
Definition: core.hpp:1310
void fail(Counter &c)
Increment failure count.
Definition: global-afc.hpp:317
Gecode::IntSet d(v, 7)
virtual void post(Space &home) const
Post no-goods.
Definition: core.cpp:82
Gecode::FloatVal c(-8, 8)
unsigned int propagators(void) const
Return number of propagators.
Definition: core.cpp:196
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Class to iterate over branchers of a space.
Definition: core.hpp:2290
Gecode::IntArgs i(4, 1, 2, 3, 4)
Base-class for branchers.
Definition: core.hpp:1071
const Space * last(void) const
Return last solution found (possibly NULL)
Definition: core.hpp:2721
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Exception: Operation on not stable space invoked
Definition: exception.hpp:55
void release(SharedMemory *sm)
Release all allocated heap chunks.
Execution has resulted in failure.
Definition: core.hpp:525
Statistics for execution of clone
Definition: core.hpp:1330
virtual NGL * ngl(Space &home, const Choice &c, unsigned int a) const
Create no-good literal for choice c and alternative a.
Definition: core.cpp:92
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
void fail(void)
Fail space.
Definition: core.hpp:3428
virtual ~Space(void)
Destructor.
Definition: core.cpp:217
void print(const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
Definition: core.cpp:454
bool stable(void) const
Return if space is stable (at fixpoint or failed)
Definition: core.hpp:3451
virtual const Choice * choice(Space &home)=0
Return choice.
void flush(void)
Flush cached memory blocks.
Definition: core.cpp:212
size_t size
The size of the propagator (used during subsumption)
Definition: core.hpp:766
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Advise function.
Definition: core.cpp:71
struct Gecode::Space::@52::@53 p
Data only available during propagation.
struct Gecode::Space::@52::@54 c
Data available only during copying.
Class to iterate over propagators of a space.
Definition: core.hpp:2264
friend class Brancher
Definition: core.hpp:1365
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
Space(void)
Default constructor.
Definition: core.cpp:114
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Definition: core.cpp:169
static const int idx_c
Index for cloning.
Definition: var-type.hpp:459
Choice for performing commit
Definition: core.hpp:1036
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Definition: core.cpp:136
No-goods recorded from restarts.
Definition: core.hpp:1240
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:2877
Archive representation
Definition: archive.hpp:45
Exception: Commit when no brancher present
Definition: exception.hpp:69
ExecStatus
Definition: core.hpp:523
static NoGoods eng
Empty no-goods.
Definition: core.hpp:1258
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Definition: core.cpp:252
Internal: propagator has computed partial fixpoint, do not use.
Definition: core.hpp:530
Propagation has not computed fixpoint.
Definition: core.hpp:526
Maximal cost value.
Definition: core.hpp:556
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)=0
Propagation function.
virtual void dispose(Space &home, VarImpBase *x)
Dispose list of variable implementations starting at x.
Definition: core.cpp:47
unsigned int id(void) const
Return unsigned brancher id.
Definition: core.hpp:3036
virtual void print(const Space &home, const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
Definition: core.cpp:97
const NoGoods & nogoods(void) const
Return no-goods recorded from restart.
Definition: core.hpp:2725
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
ActorProperty
Actor properties.
Definition: core.hpp:601
virtual ~VarImpDisposerBase(void)
Destructor (not used)
Definition: core.cpp:49
Space is failed
Definition: core.hpp:1301
const Choice * choice(void)
Create new choice for current brancher.
Definition: core.cpp:366
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
static const int idx_d
Index for dispose.
Definition: var-type.hpp:461
Shared object for several memory areas.
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
NGL * ngl(const Choice &c, unsigned int a)
Create no-good literal for choice c and alternative a.
Definition: core.cpp:440
void flush(void)
Flush all cached memory.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
Base class for Variable type disposer.
Definition: core.hpp:251
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later)
Definition: core.hpp:2363
bool release(void)
Release by one space.
Space is solved (no brancher left)
Definition: core.hpp:1302
No-good literal recorded during search.
Definition: core.hpp:971