160 template<
class A>
class Council;
162 template<
class VIC>
class VarImp;
199 template<
class VarImp>
251 static const int idx_c = VIC::idx_c;
253 static const int idx_d = VIC::idx_d;
255 static const int free_bits = VIC::free_bits;
257 unsigned int entries;
259 unsigned int free_and_bits;
264 const unsigned var_id;
278 unsigned int idx[pc_max+1];
314 void resize(
Space& home);
332 void _fail(
Space& home);
336#ifdef GECODE_HAS_VAR_DISPOSE
351 unsigned int id(
void)
const;
451 unsigned int&
bits(
void);
462 static void*
operator new(size_t,
Space&);
464 static void operator delete(
void*,
Space&);
466 static void operator delete(
void*);
623 bool empty(
void)
const;
661 static void*
operator new(
size_t s,
Space& home);
663 static void operator delete(
void* p,
Space& home);
669 static void*
operator new(
size_t s);
671 static void operator delete(
void* p);
704 Group(
unsigned int gid0);
716 unsigned int id(
void)
const;
886 operator Space&(void);
1002 unsigned int id(
void)
const;
1027 unsigned int id(
void)
const;
1097 void disable(
Space& home);
1099 void enable(
Space& home);
1200 double afc(
void)
const;
1202#ifdef GECODE_HAS_CBS
1212 typedef std::function<void(
unsigned int prop_id,
unsigned int var_id,
1213 int val,
double dens)> SendMarginal;
1214 virtual void solndistrib(
Space& home, SendMarginal send)
const;
1223 typedef std::function<bool(
unsigned int var_id)> InDecision;
1224 virtual void domainsizesum(InDecision in,
unsigned int&
size,
1225 unsigned int& size_b)
const;
1231 unsigned int id(
void)
const;
1308 bool disposed(
void)
const;
1333 static void*
operator new(
size_t s,
Space& home);
1335 static void operator delete(
void* p,
Space& home);
1340 static void operator delete(
void* p);
1343 static void*
operator new(
size_t s);
1388 bool leaf(
void)
const;
1401 static void*
operator new(
size_t s,
Space& home);
1403 static void operator delete(
void* s,
Space& home);
1405 static void operator delete(
void* p);
1411 static void*
operator new(
size_t s);
1430 unsigned int id(
void)
const;
1500 unsigned int a) = 0;
1525 std::ostream& o)
const;
1530 unsigned int id(
void)
const;
1602 std::atomic<unsigned long int>
n;
1614 unsigned long int ng(
void)
const;
1616 void ng(
unsigned long int n);
1656 const unsigned long int r;
1660 const unsigned long long int s;
1662 const unsigned long long int f;
1671 const unsigned int a;
1679 unsigned long long int s,
1680 unsigned long long int f,
1691 unsigned long int restart(
void)
const;
1695 unsigned long long int solution(
void)
const;
1697 unsigned long long int fail(
void)
const;
1706 unsigned int asset(
void)
const;
1798#ifdef GECODE_HAS_CBS
1800 unsigned int var_id_counter;
1825 Brancher* brancher(
unsigned int id);
1834 void kill_brancher(
unsigned int id);
1837 static const unsigned reserved_bid = 0U;
1840 static const unsigned int sc_bits = 2;
1842 static const unsigned int sc_fast = 0;
1844 static const unsigned int sc_disabled = 1;
1846 static const unsigned int sc_trace = 2;
1891 void enqueue(Propagator* p);
1896#ifdef GECODE_HAS_VAR_DISPOSE
1900 VarImpBase* _vars_d[AllVarConf::idx_d];
1902 template<
class VIC> VarImpBase* vars_d(
void)
const;
1904 template<
class VIC>
void vars_d(VarImpBase* x);
1907 void update(ActorLink** sub);
1911 void recover_noidx(
void);
1914 void recover(Space& source);
1917 bool is_partial_clone(
void)
const;
1981 void _commit(
const Choice& c,
unsigned int a);
2014 void _trycommit(
const Choice& c,
unsigned int a);
2018 TraceRecorder* findtracerecorder(
void);
2021 void post(
const PostInfo&
pi);
2030 void ap_notice_dispose(Actor* a,
bool d);
2038 void ap_ignore_dispose(Actor* a,
bool d);
2496 T*
alloc(
long unsigned int n);
2504 T*
alloc(
long int n);
2512 T*
alloc(
unsigned int n);
2531 void free(T* b,
long unsigned int n);
2542 void free(T* b,
long int n);
2553 void free(T* b,
unsigned int n);
2564 void free(T* b,
int n);
2577 T*
realloc(T* b,
long unsigned int n,
long unsigned int m);
2590 T*
realloc(T* b,
long int n,
long int m);
2603 T*
realloc(T* b,
unsigned int n,
unsigned int m);
2616 T*
realloc(T* b,
int n,
int m);
2625 T**
realloc(T** b,
long unsigned int n,
long unsigned int m);
2634 T**
realloc(T** b,
long int n,
long int m);
2643 T**
realloc(T** b,
unsigned int n,
unsigned int m);
2652 T**
realloc(T** b,
int n,
int m);
2656 void rfree(
void*
p,
size_t s);
2658 void*
rrealloc(
void* b,
size_t n,
size_t m);
2660 template<
size_t>
void*
fl_alloc(
void);
2680 template<
class T,
typename A1>
2687 template<
class T,
typename A1,
typename A2>
2688 T&
construct(A1
const& a1, A2
const& a2);
2694 template<
class T,
typename A1,
typename A2,
typename A3>
2695 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
2701 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
2702 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
2708 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
2709 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
2742 bool operator ()(
void)
const;
2744 void operator ++(
void);
2767 bool operator ()(
void)
const;
2769 void operator ++(
void);
2788 bool operator ()(
void)
const;
2790 void operator ++(
void);
2809 bool operator ()(
void)
const;
2811 void operator ++(
void);
2864 return mm.alloc(ssd.data().sm,s);
2868 return mm.reuse(
p,s);
2872 char* b =
static_cast<char*
>(_b);
2874 char*
p =
static_cast<char*
>(
ralloc(m));
2902 T*
p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
2903 for (
long unsigned int i=0; i<n; i++)
2904 (
void)
new (
p+i) T();
2911 return alloc<T>(
static_cast<long unsigned int>(n));
2916 return alloc<T>(
static_cast<long unsigned int>(n));
2922 return alloc<T>(
static_cast<long unsigned int>(n));
2928 for (
long unsigned int i=0; i<n; i++)
2930 rfree(b,n*
sizeof(T));
2936 free<T>(b,
static_cast<long unsigned int>(n));
2941 free<T>(b,
static_cast<long unsigned int>(n));
2947 free<T>(b,
static_cast<long unsigned int>(n));
2954 T*
p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
2955 for (
long unsigned int i=0; i<n; i++)
2956 (
void)
new (
p+i) T(b[i]);
2957 for (
long unsigned int i=n; i<m; i++)
2958 (
void)
new (
p+i) T();
2969 assert((n >= 0) && (m >= 0));
2970 return realloc<T>(b,
static_cast<long unsigned int>(n),
2971 static_cast<long unsigned int>(m));
2976 return realloc<T>(b,
static_cast<long unsigned int>(n),
2977 static_cast<long unsigned int>(m));
2982 assert((n >= 0) && (m >= 0));
2983 return realloc<T>(b,
static_cast<long unsigned int>(n),
2984 static_cast<long unsigned int>(m));
2987#define GECODE_KERNEL_REALLOC(T) \
2990 Space::realloc<T>(T* b, long unsigned int n, long unsigned int m) { \
2991 return static_cast<T*>(rrealloc(b,n*sizeof(T),m*sizeof(T))); \
2995 Space::realloc<T>(T* b, long int n, long int m) { \
2996 assert((n >= 0) && (m >= 0)); \
2997 return realloc<T>(b,static_cast<long unsigned int>(n), \
2998 static_cast<long unsigned int>(m)); \
3002 Space::realloc<T>(T* b, unsigned int n, unsigned int m) { \
3003 return realloc<T>(b,static_cast<long unsigned int>(n), \
3004 static_cast<long unsigned int>(m)); \
3008 Space::realloc<T>(T* b, int n, int m) { \
3009 assert((n >= 0) && (m >= 0)); \
3010 return realloc<T>(b,static_cast<long unsigned int>(n), \
3011 static_cast<long unsigned int>(m)); \
3026#undef GECODE_KERNEL_REALLOC
3031 return static_cast<T**
>(
rrealloc(b,n*
sizeof(T),m*
sizeof(T*)));
3036 assert((n >= 0) && (m >= 0));
3037 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3038 static_cast<long unsigned int>(m));
3043 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3044 static_cast<long unsigned int>(m));
3049 assert((n >= 0) && (m >= 0));
3050 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3051 static_cast<long unsigned int>(m));
3055#ifdef GECODE_HAS_VAR_DISPOSE
3058 Space::vars_d(
void)
const {
3059 return _vars_d[VIC::idx_d];
3063 Space::vars_d(VarImpBase* x) {
3064 _vars_d[VIC::idx_d] = x;
3069 Space::is_partial_clone(
void)
const {
3070 return d_fst == &Actor::sentinel;
3075 Actor::operator
delete(
void*) {}
3077 Actor::operator
delete(
void*,
Space&) {}
3079 Actor::operator
new(
size_t s,
Space& home) {
3080 return home.ralloc(s);
3092 return home.ralloc(s);
3097 Advisor::operator
delete(
void*) {}
3100 Advisor::operator
delete(
void*,
Space&) {}
3102 Advisor::operator
new(
size_t s,
Space& home) {
3103 return home.ralloc(s);
3107 NGL::operator
delete(
void*) {}
3111 NGL::operator
new(
size_t s,
Space& home) {
3112 return home.ralloc(s);
3131 forceinline
unsigned long int
3133 return n.load(std::memory_order_acquire);
3137 n.store(n0, std::memory_order_release);
3149 unsigned long long int s0,
3150 unsigned long long int f0,
3163 forceinline
unsigned long int
3172 forceinline
unsigned long long int
3177 forceinline
unsigned long long int
3182 forceinline
const Space*
3192 forceinline
unsigned int
3232 p->_next = n; n->_prev = p;
3237 _next =
this; _prev =
this;
3244 this->_next = a; a->_prev =
this;
3245 a->_next = n; n->_prev = a;
3252 a->_next =
this; this->_prev = a;
3253 p->_next = a; a->_prev = p;
3258 return _next ==
this;
3276 return static_cast<const ActorLink*
>(&t);
3289 return static_cast<Actor*
>(&t);
3292 forceinline
const Actor*
3293 Actor::cast(
const ActorLink* al) {
3297 return static_cast<const Actor*
>(&t);
3302 s.notice(a,
p,duplicate);
3322 return const_cast<Space*
>(
this)->_clone();
3349 return ssd.data().gpi.decay();
3354 ssd.data().gpi.decay(d);
3359 return sizeof(*this);
3370 :
s(s0),
p(p0),
pg(pg0),
bg(bg0) {}
3397 return Home(*
this,&
p);
3442 return static_cast<What>(
who & 3);
3466 :
h(home),
pg(home.propagatorgroup()),
3469 h.pc.p.vti.post(
pg);
3475 if (
h.pc.p.bid_sc & Space::sc_trace)
3489 :
i(i0),
g(g0),
p(p0),
s(s0) {}
3490 forceinline
unsigned int
3515 :
b(b0),
c(c0),
a(a0) {}
3516 forceinline
unsigned int
3528 forceinline
const Choice&
3532 forceinline
unsigned int
3544 :
g(g0),
s(s0),
n(n0) {}
3553 forceinline
unsigned int
3571 forceinline
const Propagator*
3572 Propagator::cast(
const ActorLink* al) {
3590 Propagator::disable(
Space& home) {
3591 home.pc.
p.
bid_sc |= Space::sc_disabled;
3596 Propagator::enable(Space& home) {
3608 : gpi_disabled((home.
propagator() != nullptr) ?
3612 static_cast<
Space&>(home).ssd.data().
gpi.allocate
3613 (home.propagatorgroup().gid)) {
3614 u.advisors =
nullptr;
3615 assert((u.med == 0) && (u.size == 0));
3616 static_cast<Space&
>(home).pl.head(
this);
3621 : gpi_disabled(p.gpi_disabled) {
3622 u.advisors =
nullptr;
3623 assert((u.med == 0) && (u.size == 0));
3635 return const_cast<Propagator&
>(*this).gpi().afc;
3638#ifdef GECODE_HAS_CBS
3640 Propagator::solndistrib(
Space&, SendMarginal)
const {}
3643 Propagator::domainsizesum(InDecision,
unsigned int& size,
3644 unsigned int& size_b)
const {
3650 forceinline
unsigned int
3652 return const_cast<Propagator&
>(*this).gpi().pid;
3673 p.u.size =
p.dispose(*
this);
3680 assert(
p.u.med != 0);
3687 assert(
p.u.med != 0);
3705 forceinline
const Brancher*
3706 Brancher::cast(
const ActorLink* al) {
3710 return static_cast<const Brancher*
>(&t);
3715 gid(_home.branchergroup().gid) {
3717 bid = home.pc.
p.
bid_sc >> Space::sc_bits;
3718 home.pc.
p.
bid_sc += (1 << Space::sc_bits);
3719 if ((home.pc.
p.
bid_sc >> Space::sc_bits) == 0U)
3722 if (home.b_status == &
static_cast<Space&
>(home).bl) {
3723 home.b_status = this;
3724 if (home.b_commit == &static_cast<Space&>(home).bl)
3725 home.b_commit = this;
3732 : bid(b.bid), gid(b.gid) {
3737 forceinline
unsigned int
3758 b_commit = Brancher::cast(b.next());
3760 b_status = Brancher::cast(b.next());
3766 Space::kill(Propagator& p) {
3771 if (pc.p.active < &pc.p.queue[0])
3775 assert(pc.p.active >= &pc.p.queue[0]);
3777 if (pc.p.active != pc.p.active->next())
3779 }
while (--pc.p.active >= &pc.p.queue[0]);
3781 assert(pc.p.active < &pc.p.queue[0]);
3785 Space::brancher(
unsigned int id) {
3802 while (b_commit != Brancher::cast(&bl))
3803 if (
id != b_commit->id())
3804 b_commit = Brancher::cast(b_commit->next());
3807 if (b_commit == Brancher::cast(&bl)) {
3809 b_commit = Brancher::cast(bl.next());
3810 while (b_commit != b_old)
3811 if (
id != b_commit->id())
3812 b_commit = Brancher::cast(b_commit->next());
3854 if (
prev() ==
nullptr)
3888 : bid(b.id()), alt(a) {}
3890 forceinline
unsigned int
3895 forceinline
unsigned int
3896 Choice::id(
void)
const {
3943 return sizeof(*this);
3963 Advisor::disposed(
void)
const {
3964 return prev() ==
nullptr;
3967 forceinline Advisor*
3968 Advisor::cast(ActorLink* al) {
3969 return static_cast<Advisor*
>(al);
3974 return static_cast<const Advisor*
>(al);
3979 return static_cast<ActorLink*
>(&a);
3984 assert(!disposed());
3991 assert(!disposed());
3995 if ((n !=
nullptr) && n->disposed())
4001 return home.pc.
p.
vti;
4038 : advisors(nullptr) {}
4044 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4047 return a ==
nullptr;
4056 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4061 if (c.advisors !=
nullptr) {
4065 Propagator* p_t = Propagator::cast(p_f->prev());
4071 assert(p_f->u.
advisors ==
nullptr);
4074 while (*a_f !=
nullptr) {
4075 if (
static_cast<A*
>(*a_f)->disposed()) {
4076 *a_f = (*a_f)->
next();
4079 A* a =
new (home) A(home,*
static_cast<A*
>(*a_f));
4094 for (
ActorLink* a = c.advisors; a !=
nullptr; a = a->
next())
4095 if (!
static_cast<A*
>(a)->disposed())
4110 while (a !=
nullptr) {
4111 if (!
static_cast<A*
>(a)->disposed())
4112 static_cast<A*
>(a)->
dispose(home,*
this);
4127 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4134 return a !=
nullptr;
4142 }
while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed());
4148 return *
static_cast<A*
>(a);
4160 ActorLink*
c = &pc.p.queue[
p->cost(*
this,
p->u.med).ac];
4162 if (
c > pc.p.active)
4191 return ((pc.p.active < &pc.p.queue[0]) ||
4198 ap_notice_dispose(&a,d);
4201 pc.p.bid_sc |= sc_trace;
4204 pc.p.bid_sc |= sc_trace;
4217 ap_ignore_dispose(&a,d);
4239 assert((pc >= 0) && (pc < pc_max+2));
4240 return (pc == 0) ? b.base : b.base+u.idx[pc-1];
4244 forceinline ActorLink**
4245 VarImp<VIC>::actorNonZero(
PropCond pc) {
4246 assert((pc > 0) && (pc < pc_max+2));
4247 return b.base+u.idx[pc-1];
4251 forceinline
unsigned int&
4253 assert((pc > 0) && (pc < pc_max+2));
4258 forceinline
unsigned int
4260 assert((pc > 0) && (pc < pc_max+2));
4267#ifdef GECODE_HAS_CBS
4268 : var_id(++home.var_id_counter)
4271#ifndef GECODE_HAS_CBS
4274 b.base =
nullptr; entries = 0;
4275 for (
PropCond pc=1; pc<pc_max+2; pc++)
4283#ifdef GECODE_HAS_CBS
4287 b.base =
nullptr; entries = 0;
4288 for (
PropCond pc=1; pc<pc_max+2; pc++)
4293#ifdef GECODE_HAS_CBS
4295 forceinline
unsigned int
4302 forceinline
unsigned int
4317 d += Propagator::cast(*a)->afc(); a++;
4326 ->propagator().afc();
4340 forceinline
unsigned int
4342 return free_and_bits;
4346 forceinline
unsigned int&
4348 return free_and_bits;
4351#ifdef GECODE_HAS_VAR_DISPOSE
4355 return static_cast<VarImp<VIC>*
>(home.vars_d<VIC>());
4360 VarImp<VIC>::vars_d(Space& home, VarImp<VIC>* x) {
4361 home.vars_d<VIC>(x);
4388#ifdef GECODE_HAS_CBS
4393 free_and_bits = x.free_and_bits & ((1 << free_bits) - 1);
4394 if (x.b.
base ==
nullptr) {
4399 reg = &home.pc.
c.
vars_u[idx_c];
4403 entries = x.entries;
4404 for (
PropCond pc=1; pc<pc_max+2; pc++)
4416 return static_cast<ModEvent>((
med & VIC::med_mask) >> VIC::med_fst);
4428 return VIC::me_combine(me1,me2);
4435 if (VIC::med_update(p.u.
med,
me) || force)
4442 if (b.base ==
nullptr)
4446 while (end > begin) {
4454 VarImp<VIC>::resize(
Space& home) {
4455 if (b.base ==
nullptr) {
4456 assert((free_and_bits >> free_bits) == 0);
4458 free_and_bits += 4 << free_bits;
4460 for (
int i=0; i<pc_max+1; i++)
4464 unsigned int n = degree();
4468 ActorLink** s =
static_cast<ActorLink**
>(home.mm.
subscriptions());
4470 ((s <= b.base) && (b.base < s+home.pc.
p.
n_sub)) ?
4471 (n+4) : ((n+1)*3>>1);
4472 ActorLink** prop = home.
alloc<ActorLink*>(m);
4473 free_and_bits += (m-n) << free_bits;
4476 home.
free<ActorLink*>(b.base,n);
4484 assert(pc <= pc_max);
4486 home.pc.p.n_sub += 1;
4487 if ((free_and_bits >> free_bits) == 0)
4489 free_and_bits -= 1 << free_bits;
4492 b.base[entries] = *actorNonZero(pc_max+1);
4494 for (
PropCond j = pc_max; j > pc; j--) {
4495 *actorNonZero(j+1) = *actorNonZero(j);
4498 *actorNonZero(pc+1) = *actor(pc);
4504 while (f < (pc == pc_max+1 ? b.base+entries : actorNonZero(pc+1)))
4519 home.pc.p.n_sub += 1;
4520 if ((free_and_bits >> free_bits) == 0)
4522 free_and_bits -= 1 << free_bits;
4525 b.base[entries++] = *actorNonZero(pc_max+1);
4526 *actorNonZero(pc_max+1) = a;
4568 assert(pc <= pc_max);
4573 while (f < actorNonZero(pc+1))
4581 while (*f != a) f++;
4584 *f = *(actorNonZero(pc+1)-1);
4585 for (
PropCond j = pc+1; j< pc_max+1; j++) {
4586 *(actorNonZero(j)-1) = *(actorNonZero(j+1)-1);
4589 *(actorNonZero(pc_max+1)-1) = b.base[entries-1];
4592 free_and_bits += 1 << free_bits;
4599 if ((b.base !=
nullptr) && !home.is_partial_clone())
4610 while (f < b.base+entries)
4618 while (*f != a) f++;
4621 *f = b.base[--entries];
4622 free_and_bits += 1 << free_bits;
4629 if ((b.base !=
nullptr) && !home.is_partial_clone()) {
4639 unsigned int n_sub =
degree();
4640 home.pc.
p.
n_sub -= n_sub;
4641 unsigned int n = (free_and_bits >> free_bits) + n_sub;
4648 for (
PropCond pc=1; pc<pc_max+2; pc++)
4650 free_and_bits &= (1 << free_bits) - 1;
4661 ActorLink** la = actorNonZero(pc_max+1);
4672 assert(!a->disposed());
4674 switch (p.
advise(home,*a,d)) {
4689 }
while (++la < le);
4695 VarImp<VIC>::_fail(
Space& home) {
4701 ActorLink** la = actorNonZero(pc_max+1);
4712 assert(!a->disposed());
4716 }
while (++la < le);
4728#pragma clang diagnostic push
4729#pragma clang diagnostic ignored "-Warray-bounds"
4738 x->u.
idx[0] = u.idx[0];
4739 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4740 x->u.
idx[1] = u.idx[1];
4743 static_cast<unsigned int>(x->actorNonZero(pc_max+1) - x->actor(0));
4745 static_cast<unsigned int >(x->b.
base + x->entries -
4746 x->actorNonZero(pc_max+1));
4747 unsigned int n = na + np;
4748 assert(n == x->
degree());
4761 t[0] = p0; t[1] = p1; t[2] = p2; t[3] = p3;
4762 np -= 4; t += 4; f += 4;
4765 ActorLink* p0 = f[0]->
prev();
4766 ActorLink* p1 = f[1]->
prev();
4767 t[0] = p0; t[1] = p1;
4768 np -= 2; t += 2; f += 2;
4777 ptrdiff_t m0, m1, m2, m3;
4790 na -= 4; t += 4; f += 4;
4800 na -= 2; t += 2; f += 2;
4809#pragma clang diagnostic pop
4815 while (x !=
nullptr) {
4824 while (x !=
nullptr) {
4828 x->b.
base = copy->b.base;
4829 x->u.idx[0] = copy->u.idx[0];
4830 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4831 x->u.idx[1] = copy->u.idx[1];
4845 template<
class VarImp>
4847#ifdef GECODE_HAS_VAR_DISPOSE
4848 Space::vd[VarImp::idx_d] =
this;
4852 template<
class VarImp>
4857 x->dispose(home); x =
static_cast<VarImp*
>(x->next_d());
4858 }
while (x !=
nullptr);
4926 forceinline PropCost
4937 return (m ==
LO) ? lo : hi;
4951 return crazy(m,
static_cast<unsigned int>(n));
4960 return cubic(m,
static_cast<unsigned int>(n));
4969 return quadratic(m,
static_cast<unsigned int>(n));
4978 return linear(m,
static_cast<unsigned int>(n));
4999 : home(home0), q(home.pc.
p.
active) {
5000 while (q >= &home.pc.p.queue[0]) {
5001 if (q->next() != q) {
5002 c = q->next(); e = q; q--;
5008 if (!home.pl.empty()) {
5009 c = Propagator::cast(home.pl.next());
5010 e = Propagator::cast(&home.pl);
5017 return c !=
nullptr;
5026 while (q >= &home.pc.p.queue[0]) {
5027 if (q->next() != q) {
5028 c = q->next(); e = q; q--;
5034 if (!home.pl.empty()) {
5035 c = Propagator::cast(home.pl.next());
5036 e = Propagator::cast(&home.pl);
5045 return *Propagator::cast(c);
5051 : home(home0), q(home.pc.
p.
active) {
5052 while (q >= &home.pc.p.queue[0]) {
5053 if (q->next() != q) {
5054 c = q->next(); e = q; q--;
5059 q =
c = e =
nullptr;
5063 return c !=
nullptr;
5072 while (q >= &home.pc.p.queue[0]) {
5073 if (q->next() != q) {
5074 c = q->next(); e = q; q--;
5079 q = c = e =
nullptr;
5085 return *Propagator::cast(c);
5091 c = Propagator::cast(home.pl.
next());
5092 e = Propagator::cast(&home.pl);
5104 return *Propagator::cast(c);
5110 : c(
Brancher::cast(home.bl.next())), e(&home.bl) {}
5121 return *Brancher::cast(c);
5149 forceinline
unsigned int
5178 return id() == g.
id();
5182 return id() != g.
id();
5216 return id() == g.
id();
5220 return id() != g.
id();
5237 : ps(const_cast<
Space&>(home)), g(g0) {
5238 while (ps() && !g.in(ps.propagator().group()))
5249 while (ps() && !g.in(ps.propagator().group()));
5253 return ps.propagator();
5258 : bs(const_cast<
Space&>(home)), g(g0) {
5259 while (bs() && !g.in(bs.brancher().group()))
5270 while (bs() && !g.in(bs.brancher().group()));
5274 return bs.brancher();
5287 template<
class T,
typename A1>
5290 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5294 template<
class T,
typename A1,
typename A2>
5297 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5301 template<
class T,
typename A1,
typename A2,
typename A3>
5304 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5305 new (&t) T(a1,a2,a3);
5308 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
5311 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5312 new (&t) T(a1,a2,a3,a4);
5315 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
5318 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5319 new (&t) T(a1,a2,a3,a4,a5);
Class for AFC (accumulated failure count) management.
Double-linked list for actors.
ActorLink ** next_ref(void)
ActorLink * next(void) const
void init(void)
Initialize links (self-linked).
void unlink(void)
Remove from predecessor and successor.
void head(ActorLink *al)
Insert al directly after this.
void tail(ActorLink *al)
Insert al directly before this.
ActorLink * prev(void) const
Routines for double-linked list.
bool empty(void) const
Test whether actor link is empty (points to itself).
static ActorLink * cast(T *a)
Static cast for a non-null pointer (to give a hint to optimizer).
Base-class for both propagators and branchers.
virtual ~Actor(void)
To avoid warnings.
virtual Actor * copy(Space &home)=0
Create copy.
virtual size_t dispose(Space &home)
Delete actor and return its size.
friend class SubscribedPropagators
Propagator & propagator(void) const
Return the advisor's propagator.
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
const ViewTraceInfo & operator()(const Space &home) const
Provide access to view trace information.
Class to iterate over advisors of a council.
Advisors(const Council< A > &c)
Initialize.
bool operator()(void) const
Test whether there advisors left.
void operator++(void)
Move iterator to next advisor.
A & advisor(void) const
Return advisor.
static const int idx_c
Index for cloning.
static ModEventDelta med_combine(ModEventDelta med1, ModEventDelta med2)
Combine modification event delta med1 with med2.
unsigned int size(Space &home) const
Return number of branchers in a group.
static BrancherGroup def
Group of branchers not in any user-defined group.
static BrancherGroup all
Group of all branchers.
BrancherGroup & operator=(const BrancherGroup &g)
Assignment operator.
BrancherGroup & move(Space &home, BrancherGroup g)
Move branchers from group g to this group.
BrancherGroup(unsigned int gid)
Initialize with group id gid.
BrancherGroup & move(Space &home, unsigned int id)
Move brancher with id id to this group.
Home operator()(Space &home)
To augment a space argument.
bool operator!=(BrancherGroup g) const
Test whether this group is different from group g.
void kill(Space &home)
Kill all branchers in a group.
bool operator==(BrancherGroup g) const
Test whether this group is equal to group g.
BrancherGroup(void)
Constructor.
Base-class for branchers.
virtual NGL * ngl(Space &home, const Choice &c, unsigned int a) const
Create no-good literal for choice c and alternative a.
virtual const Choice * choice(Space &home)=0
Return choice.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int a)=0
Commit for choice c and alternative a.
unsigned int id(void) const
Return brancher id.
virtual void print(const Space &home, const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
virtual const Choice * choice(const Space &home, Archive &e)=0
Return choice from e.
BrancherGroup group(void) const
Return group brancher belongs to.
virtual bool status(const Space &home) const =0
Check status of brancher, return true if alternatives left.
Brancher(Home home)
Constructor for creation.
void operator++(void)
Move iterator to next brancher.
const Brancher & brancher(void) const
Return propagator.
bool operator()(void) const
Test whether there are branchers left.
Branchers(const Space &home, BrancherGroup g)
Initialize.
Choice for performing commit
Choice(const Brancher &b, const unsigned int a)
Initialize for particular brancher b and alternatives a.
virtual void archive(Archive &e) const
Archive into e.
virtual ~Choice(void)
Destructor.
unsigned int alternatives(void) const
Return number of alternatives.
Statistics for execution of clone
CloneStatistics operator+(const CloneStatistics &s)
Return sum with s.
void reset(void)
Reset information.
CloneStatistics & operator+=(const CloneStatistics &s)
Increment by statistics s.
CloneStatistics(void)
Initialize.
Statistics for execution of commit
CommitStatistics & operator+=(const CommitStatistics &s)
Increment by statistics s.
void reset(void)
Reset information.
CommitStatistics operator+(const CommitStatistics &s)
Return sum with s.
CommitStatistics(void)
Initialize.
Commit trace information.
BrancherGroup group(void) const
Return brancher group.
unsigned int alternative(void) const
Return alternative.
const Brancher & b
Brancher.
CommitTraceInfo(const Brancher &b, const Choice &c, unsigned int a)
Initialize.
unsigned int id(void) const
Return brancher identifier.
unsigned int a
Alternative.
const Choice & choice(void) const
Return choice.
const Brancher & brancher(void) const
Return brancher.
bool empty(void) const
Test whether council has advisor left.
void update(Space &home, Council< A > &c)
Update during cloning (copies all advisors).
void dispose(Space &home)
Dispose council.
Council(void)
Default constructor.
Generic domain change information to be supplied to advisors.
Base-class for freelist-managed objects.
Group baseclass for controlling actors.
static Group all
Group of all actors.
static Group def
Group of actors not in any user-defined group.
static const unsigned int GROUPID_ALL
Fake id for group of all actors.
bool in(void) const
Check whether this is a real group (and not just default).
friend class CommitTraceInfo
static Support::Mutex m
Mutex for protection.
friend class PostTraceInfo
static const unsigned int GROUPID_MAX
The maximal group number.
Group & operator=(const Group &g)
Assignment operator.
unsigned int id(void) const
Return a unique id for the group.
static const unsigned int GROUPID_DEF
Pre-defined default group id.
unsigned int gid
The group id.
static unsigned int next
Next group id.
friend class PropagateTraceInfo
Group(unsigned int gid0)
Construct with predefined group id gid0.
friend class ViewTraceInfo
Base class for heap allocated objects.
static T * copy(T *d, const T *s, long unsigned int n)
Copy n objects starting at s to d.
Home class for posting propagators
PropagatorGroup pg
A propagator group.
BrancherGroup branchergroup(void) const
Return brancher group.
Home(Space &s, Propagator *p=nullptr, PropagatorGroup pg=PropagatorGroup::def, BrancherGroup bg=BrancherGroup::def)
Initialize the home with space s and propagator p and group g.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Propagator * p
A propagator (possibly) that is currently being rewritten.
Space & s
The space where the propagator is to be posted.
void fail(void)
Mark space as failed.
BrancherGroup bg
A brancher group.
Propagator * propagator(void) const
Return propagator (or nullptr) for currently rewritten propagator.
PropagatorGroup propagatorgroup(void) const
Return propagator group.
Home operator()(Propagator &p)
Return a home extended by propagator to be rewritten.
bool failed(void) const
Check whether corresponding space is failed.
Home & operator=(const Home &h)
Assignment operator.
Class for storing propagator information.
unsigned int gid
Group identifier.
void * subscriptions(void) const
Get the memory area for subscriptions.
Class to store data shared among several spaces.
Handles for local (space-shared) objects.
LocalHandle(void)
Create local handle pointing to nullptr object.
~LocalHandle(void)
Destructor.
void update(Space &home, LocalHandle &lh)
Updating during cloning.
LocalHandle & operator=(const LocalHandle &lh)
Assignment operator.
LocalObject * object(void) const
Access to the local object.
Local (space-shared) object.
static LocalObject * cast(ActorLink *al)
Static cast for a non-null pointer (to give a hint to optimizer).
LocalObject * fwd(Space &home)
Return forwarding pointer.
LocalObject(Home home)
Constructor for creation.
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 cancel(Space &home, Propagator &p)=0
Cancel propagator p from all views of the no-good literal.
virtual void subscribe(Space &home, Propagator &p)=0
Subscribe propagator p to all views of the no-good literal.
virtual bool notice(void) const
Whether dispose must always be called (returns false).
virtual NGL::Status status(const Space &home) const =0
Test the status of the no-good literal.
NGL(void)
Constructor for creation.
virtual NGL * copy(Space &home)=0
Create copy.
Status
The status of a no-good literal.
@ SUBSUMED
The literal is subsumed.
@ FAILED
The literal is failed.
@ NONE
The literal is neither failed nor subsumed.
virtual void reschedule(Space &home, Propagator &p)=0
Schedule propagator p for all views of the no-good literal.
virtual ~NGL(void)
To avoid warnings.
NGL * next(void) const
Return pointer to next literal.
virtual size_t dispose(Space &home)
Dispose.
NGL * add(NGL *n, bool l)
Add node n and mark it as leaf l and return n.
No-goods recorded from restarts.
static NoGoods eng
Empty no-goods.
virtual ~NoGoods(void)
Destructor.
std::atomic< unsigned long int > n
Number of no-goods.
unsigned long int ng(void) const
Return number of no-goods posted.
virtual void post(Space &home) const
Post no-goods.
NoGoods & operator=(const NoGoods &ng)
Assignment operator.
Configuration class for variable implementations without index structure.
static bool med_update(ModEventDelta &med, ModEvent me)
Update modification even delta med by me, return true on change.
static const int free_bits
Freely available bits.
static const int idx_c
Index for update.
static const int med_fst
Start of bits for modification event delta.
static const int med_lst
End of bits for modification event delta.
static const PropCond pc_max
Maximal propagation condition.
static const int idx_d
Index for disposal.
static Gecode::ModEvent me_combine(ModEvent me1, ModEvent me2)
Combine modification events me1 and me2.
static const int med_mask
Bitmask for modification event delta.
Class to set group information when a post function is executed.
PostInfo(Home home)
Set information.
bool nested
Whether it is used nested.
unsigned int pid
Next free propagator id.
PropagatorGroup pg
The propagator group.
~PostInfo(void)
Reset information.
unsigned int propagators(void) const
Return number of posted propagators.
PropagatorGroup group(void) const
Return propagator group.
PropagatorGroup g
Propagator group.
@ SUBSUMED
Propagator not posted as already subsumed.
@ POSTED
Propagator was posted.
Status status(void) const
Return post status.
PostTraceInfo(PropagatorGroup g, Status s, unsigned int n)
Initialize.
unsigned int n
Number of posted propagators.
ActualCost ac
Actual cost.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
static PropCost ternary(PropCost::Mod m)
Three variables for modifier pcm.
static PropCost record(void)
For recording information (no propagation allowed).
static PropCost crazy(PropCost::Mod m, unsigned int n)
Exponential complexity for modifier m and size measure n.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Mod
Propagation cost modifier.
ActualCost
The actual cost values that are used.
@ AC_TERNARY_LO
Three variables, cheap.
@ AC_TERNARY_HI
Three variables, expensive.
@ AC_BINARY_LO
Two variables, cheap.
@ AC_CUBIC_LO
Cubic complexity, cheap.
@ AC_UNARY_HI
Only single variable, expensive.
@ AC_RECORD
Reserved for recording information.
@ AC_BINARY_HI
Two variables, expensive.
@ AC_LINEAR_HI
Linear complexity, expensive.
@ AC_CUBIC_HI
Cubic complexity, expensive.
@ AC_MAX
Maximal cost value.
@ AC_CRAZY_LO
Exponential complexity, cheap.
@ AC_LINEAR_LO
Linear complexity, cheap.
@ AC_UNARY_LO
Only single variable, cheap.
@ AC_QUADRATIC_LO
Quadratic complexity, cheap.
@ AC_CRAZY_HI
Exponential complexity, expensive.
@ AC_QUADRATIC_HI
Quadratic complexity, expensive.
Propagate trace information.
unsigned int i
Propagator id.
@ SUBSUMED
Propagator is subsumed.
@ FIX
Propagator computed fixpoint.
@ NOFIX
Propagator did not compute fixpoint.
@ FAILED
Propagator failed.
PropagateTraceInfo(unsigned int i, PropagatorGroup g, const Propagator *p, Status s)
Initialize.
const Propagator * propagator(void) const
Return pointer to non-subsumed propagator.
unsigned int id(void) const
Return propagator identifier.
Status status(void) const
Return propagator status.
const Propagator * p
Propagator.
PropagatorGroup g
Propagator group.
PropagatorGroup group(void) const
Return propagator group.
unsigned int size(Space &home) const
Return number of propagators in a group.
bool operator==(PropagatorGroup g) const
Test whether this group is equal to group g.
static PropagatorGroup def
Group of propagators not in any user-defined group.
PropagatorGroup & move(Space &home, PropagatorGroup g)
Move propagators from group g to this group.
friend class PostTraceInfo
PropagatorGroup(unsigned int gid)
Initialize with group id gid.
bool operator!=(PropagatorGroup g) const
Test whether this group is different from group g.
PropagatorGroup(void)
Constructor.
PropagatorGroup & operator=(const PropagatorGroup &g)
Assignment operator.
void disable(Space &home)
Disable all propagators in a group.
PropagatorGroup & move(Space &home, unsigned int id)
Move propagator with id id to this group.
void enable(Space &home, bool s=true)
Enable all propagators in a group.
Home operator()(Space &home)
To augment a space argument.
friend class PropagateTraceInfo
void kill(Space &home)
Kill all propagators in a group.
friend class ViewTraceInfo
static PropagatorGroup all
Group of all propagators.
Base-class for propagators.
virtual void reschedule(Space &home)=0
Schedule function.
size_t size
The size of the propagator (used during subsumption).
friend class SubscribedPropagators
double afc(void) const
Return the accumulated failure count.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const =0
Cost function.
virtual void advise(Space &home, Advisor &a)
Run advisor a to be run on failure in failed space.
Kernel::GPI::Info & gpi(void)
Provide access to global propagator information.
unsigned int id(void) const
Return propagator id.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Advise function.
PropagatorGroup group(void) const
Return group propagator belongs to.
ModEventDelta modeventdelta(void) const
Return the modification event delta.
Propagator * fwd(void) const
Return forwarding pointer during copying.
friend class PropagatorGroup
bool disabled(void) const
Whether propagator is currently disabled.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)=0
Propagation function.
ModEventDelta med
A set of modification events (used during propagation).
Propagator(Home home)
Constructor for posting.
Gecode::ActorLink * advisors
A list of advisors (used during cloning).
bool operator()(void) const
Test whether there are propagators left.
const Propagator & propagator(void) const
Return propagator.
void operator++(void)
Move iterator to next propagator.
Propagators(const Space &home, PropagatorGroup g)
Initialize.
Class to iterate over branchers of a space.
Brancher & brancher(void) const
Return propagator.
void operator++(void)
Move iterator to next brancher.
Branchers(Space &home)
Initialize.
bool operator()(void) const
Test whether there are branchers left.
void operator++(void)
Move iterator to next propagator.
Propagator & propagator(void) const
Return propagator.
bool operator()(void) const
Test whether there are propagators left.
IdlePropagators(Space &home)
Initialize.
Class to iterate over propagators of a space.
bool operator()(void) const
Test whether there are propagators left.
Propagators(Space &home)
Initialize.
void operator++(void)
Move iterator to next propagator.
Propagator & propagator(void) const
Return propagator.
ScheduledPropagators(Space &home)
Initialize.
Propagator & propagator(void) const
Return propagator.
bool operator()(void) const
Test whether there are propagators left.
void operator++(void)
Move iterator to next propagator.
T * realloc(T *b, long unsigned int n, long unsigned int m)
Reallocate block of n objects starting at b to m objects of type T from the space heap.
Space * source
Source space during clone construction.
friend void trace(Home home, TraceFilter tf, int te, Tracer &t)
Create tracer.
struct Gecode::Space::@055132133326276162005044145100211202071356247106::@275070317317120154232063063134255170030071110047 p
Data only available during propagation or branching.
void * ralloc(size_t s)
Allocate memory on space heap.
double afc_decay(void) const
Return AFC decay factor.
struct Gecode::Space::@055132133326276162005044145100211202071356247106::@155123175027073262103111264343315000271204104107 c
Data available only during copying.
void afc_unshare(void)
Unshare AFC information for all propagators.
T & construct(void)
Construction routines.
ActorLink queue[PropCost::AC_MAX+1]
Scheduled propagators according to cost.
LocalObject * local
Linked list of local objects.
void * rrealloc(void *b, size_t n, size_t m)
Reallocate memory block starting at b from size n to size s.
friend class VarImpDisposer
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later).
VarImpBase * vars_noidx
Keep variables during copying without index structure.
void * fl_alloc(void)
Allocate from freelist-managed memory.
VarImpBase * vars_u[AllVarConf::idx_c]
Entries for updating variables.
void afc_decay(double d)
Set AFC decay factor to d
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
unsigned int n_sub
Number of subscriptions.
friend class PropagatorGroup
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
unsigned int bid_sc
Id of next brancher to be created plus status control.
friend class BrancherGroup
ActorLink * active
Cost level with next propagator to be executed.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
ViewTraceInfo vti
View trace information.
Home operator()(Propagator &p)
Return a home for this space with the information that p is being rewritten.
SpaceStatus status(void)
Query space status without collecting statistics.
Statistics for execution of status
void reset(void)
Reset information.
StatusStatistics(void)
Initialize.
unsigned long long int propagate
Number of propagator executions.
StatusStatistics operator+(const StatusStatistics &s)
Return sum with s.
StatusStatistics & operator+=(const StatusStatistics &s)
Increment by statistics s.
Iterator over subscribed propagators.
A mutex for mutual exclausion among several threads.
Exception: too many branchers
Propagator for recording trace information.
Base-class for variable implementations.
Base class for Variable type disposer.
virtual void dispose(Space &home, VarImpBase *x)
Dispose list of variable implementations starting at x.
virtual ~VarImpDisposerBase(void)
Destructor (not used).
VarImpDisposer(void)
Constructor (registers disposer with kernel).
virtual void dispose(Space &home, VarImpBase *x)
Dispose list of variable implementations starting at x.
Base-class for variable implementations.
void subscribe(Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me, bool schedule)
Subscribe propagator p with propagation condition pc.
ModEvent fail(Space &home)
Run advisors to be run on failure and returns ME_GEN_FAILED.
void cancel(Space &home)
Cancel all subscriptions when variable implementation is assigned.
bool advise(Space &home, ModEvent me, Delta &d)
Run advisors when variable implementation has been modified with modification event me and domain cha...
VarImp(void)
Creation of static instances.
friend class SubscribedPropagators
double afc(void) const
Return accumulated failure count (plus degree).
unsigned int bits(void) const
Provide access to free bits.
ActorLink ** base
Subscribed actors.
bool copied(void) const
Is variable already copied.
friend class VarImpDisposer
static void reschedule(Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me)
Schedule propagator p.
static void schedule(Space &home, Propagator &p, ModEvent me, bool force=false)
unsigned int idx[pc_max+1]
Indices of subscribed actors.
VarImp * forward(void) const
Use forward pointer if variable already copied.
static ModEvent me(const ModEventDelta &med)
VarImp * next(void) const
Return next copied variable.
static ModEvent me_combine(ModEvent me1, ModEvent me2)
Combine modifications events me1 and me2.
unsigned int degree(void) const
Return degree (number of subscribed propagators and advisors).
VarImp(Space &home)
Creation.
static ModEventDelta med(ModEvent me)
VarImp< VIC > * fwd
Forwarding pointer.
VarImp< VIC > * next
During cloning, points to the next copied variable.
static ModEvent modevent(const Delta &d)
Return modification event.
What what(void) const
Return what is currently executing.
const Brancher & brancher(void) const
Return currently executing brancher.
const Propagator & propagator(void) const
Return currently executing propagator.
void other(void)
Record that nothing is known at this point.
What
What is currently executing.
@ BRANCHER
A brancher is executing.
@ POST
A post function is executing.
@ PROPAGATOR
A propagator is currently executing.
PropagatorGroup post(void) const
Return propagator group of currently executing post function.
ptrdiff_t who
Encoding a tagged pointer or a tagged group id.
#define GECODE_KERNEL_REALLOC(T)
ExecStatus ES_NOFIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has not computed partial fixpoint
ExecStatus ES_FIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has computed partial fixpoint
ExecStatus ES_SUBSUMED_DISPOSED(Propagator &p, size_t s)
Propagator p is subsumed
ExecStatus ES_FIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed
ExecStatus ES_NOFIX_DISPOSE_FORCE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be forcefully rescheduled
ExecStatus ES_NOFIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be run
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
int ModEventDelta
Modification event deltas.
bool failed(void) const
Check whether space is failed.
ActorProperty
Actor properties.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
bool stable(void) const
Return if space is stable (at fixpoint or failed).
void fail(void)
Fail space.
@ AP_DISPOSE
Actor must always be disposed.
virtual ~Space(void)
Destructor.
Space(void)
Default constructor.
virtual bool slave(const MetaInfo &mi)
Slave configuration function for meta search engines.
virtual bool master(const MetaInfo &mi)
Master configuration function for meta search engines.
virtual void constrain(const Space &best)
Constrain function for best solution search.
Space(Space &s)
Constructor for cloning.
virtual Space * copy(void)=0
Copying member function.
const Choice * choice(Archive &e) const
Create new choice from e.
void print(const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
Space * clone(void) const
Clone space.
const Choice * choice(void)
Create new choice for current brancher.
SpaceStatus status(StatusStatistics &stat)
Query space status.
NGL * ngl(const Choice &c, unsigned int a)
Create no-good literal for choice c and alternative a.
void trycommit(const Choice &c, unsigned int a)
If possible, commit choice c for alternative a.
void commit(const Choice &c, unsigned int a)
Commit choice c for alternative a.
@ SS_BRANCH
Space must be branched (at least one brancher left)
@ SS_SOLVED
Space is solved (no brancher left)
@ SS_FAILED
Space is failed
#define GECODE_KERNEL_EXPORT
void * ptrjoin(void *p, ptrdiff_t m)
Join unmarked pointer p and m into marked pointer.
void * ptrsplit(void *p, ptrdiff_t &m)
Split possibly marked pointer p into mark m and unmarked pointer.
void * unmark(void *p)
Return unmarked pointer for a marked pointer p.
void * fmark(void *p)
Return marked pointer for p (possibly already marked).
void * funmark(void *p)
Return unmarked pointer for a possibly marked pointer p.
void * mark(void *p)
Return marked pointer for unmarked pointer p.
bool marked(void *p)
Check whether p is marked.
Gecode toplevel namespace
const PropCond PC_GEN_ASSIGNED
Propagation condition for an assigned variable.
const ModEvent ME_GEN_NONE
Generic modification event: no modification.
TFE propagator(PropagatorGroup g)
Only propagators (but not post functions) from g are considered.
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_SUBSUMED_
Internal: propagator is subsumed, do not use.
@ ES_NOFIX_FORCE
Advisor forces rescheduling of propagator.
@ ES_FAILED
Execution has resulted in failure.
@ ES_PARTIAL_
Internal: propagator has computed partial fixpoint, do not use.
@ ES_NOFIX
Propagation has not computed fixpoint.
const ModEvent ME_GEN_FAILED
Generic modification event: failed variable.
int PropCond
Type for propagation conditions.
const ModEvent ME_GEN_ASSIGNED
Generic modification event: variable is assigned a value.
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience).
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.
#define GECODE_NOT_NULL(p)
Assert that a pointer is never nullptr.
#define GECODE_VTABLE_EXPORT