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;
1102 bool local_info(
void)
const;
1104 void disable(
Space& home);
1106 void enable(
Space& home);
1207 double afc(
void)
const;
1209#ifdef GECODE_HAS_CBS
1219 typedef std::function<void(
unsigned int prop_id,
unsigned int var_id,
1220 int val,
double dens)> SendMarginal;
1221 virtual void solndistrib(
Space& home, SendMarginal send)
const;
1230 typedef std::function<bool(
unsigned int var_id)> InDecision;
1231 virtual void domainsizesum(InDecision in,
unsigned int&
size,
1232 unsigned int& size_b)
const;
1238 unsigned int id(
void)
const;
1315 bool disposed(
void)
const;
1340 static void*
operator new(
size_t s,
Space& home);
1342 static void operator delete(
void* p,
Space& home);
1347 static void operator delete(
void* p);
1350 static void*
operator new(
size_t s);
1389 virtual bool notice(
void)
const;
1395 bool leaf(
void)
const;
1408 static void*
operator new(
size_t s,
Space& home);
1410 static void operator delete(
void* s,
Space& home);
1412 static void operator delete(
void* p);
1418 static void*
operator new(
size_t s);
1437 unsigned int id(
void)
const;
1507 unsigned int a) = 0;
1532 std::ostream& o)
const;
1537 unsigned int id(
void)
const;
1609 std::atomic<unsigned long int>
n;
1621 unsigned long int ng(
void)
const;
1623 void ng(
unsigned long int n);
1663 const unsigned long int r;
1667 const unsigned long long int s;
1669 const unsigned long long int f;
1678 const unsigned int a;
1686 unsigned long long int s,
1687 unsigned long long int f,
1698 unsigned long int restart(
void)
const;
1702 unsigned long long int solution(
void)
const;
1704 unsigned long long int fail(
void)
const;
1718 unsigned int asset(
void)
const;
1812#ifdef GECODE_HAS_CBS
1814 unsigned int var_id_counter;
1841 Brancher* brancher(
unsigned int id);
1850 void kill_brancher(
unsigned int id);
1853 static const unsigned reserved_bid = 0U;
1856 static const unsigned int sc_bits = 2;
1858 static const unsigned int sc_fast = 0;
1860 static const unsigned int sc_disabled = 1;
1862 static const unsigned int sc_trace = 2;
1907 void enqueue(Propagator* p);
1912#ifdef GECODE_HAS_VAR_DISPOSE
1916 VarImpBase* _vars_d[AllVarConf::idx_d];
1918 template<
class VIC> VarImpBase* vars_d(
void)
const;
1920 template<
class VIC>
void vars_d(VarImpBase* x);
1923 void update(ActorLink** sub);
1927 void recover_noidx(
void);
1930 void recover(Space& source);
1933 bool is_partial_clone(
void)
const;
1997 void _commit(
const Choice& c,
unsigned int a);
2030 void _trycommit(
const Choice& c,
unsigned int a);
2034 TraceRecorder* findtracerecorder(
void);
2037 void post(
const PostInfo&
pi);
2046 void ap_notice_dispose(Actor* a,
bool d);
2054 void ap_ignore_dispose(Actor* a,
bool d);
2076 NoGPI(
const NoGPI&) =
delete;
2077 NoGPI& operator =(
const NoGPI&) =
delete;
2080 explicit NoGPI(
Space& home);
2098 UseGPI(
const UseGPI&) =
delete;
2099 UseGPI& operator =(
const UseGPI&) =
delete;
2102 explicit UseGPI(
Space& home);
2413 void print(
const Choice&
c,
unsigned int a, std::ostream& o)
const;
2568 T*
alloc(
long unsigned int n);
2576 T*
alloc(
long int n);
2584 T*
alloc(
unsigned int n);
2603 void free(T* b,
long unsigned int n);
2614 void free(T* b,
long int n);
2625 void free(T* b,
unsigned int n);
2636 void free(T* b,
int n);
2649 T*
realloc(T* b,
long unsigned int n,
long unsigned int m);
2662 T*
realloc(T* b,
long int n,
long int m);
2675 T*
realloc(T* b,
unsigned int n,
unsigned int m);
2688 T*
realloc(T* b,
int n,
int m);
2697 T**
realloc(T** b,
long unsigned int n,
long unsigned int m);
2706 T**
realloc(T** b,
long int n,
long int m);
2715 T**
realloc(T** b,
unsigned int n,
unsigned int m);
2724 T**
realloc(T** b,
int n,
int m);
2728 void rfree(
void*
p,
size_t s);
2730 void*
rrealloc(
void* b,
size_t n,
size_t m);
2732 template<
size_t>
void*
fl_alloc(
void);
2752 template<
class T,
typename A1>
2759 template<
class T,
typename A1,
typename A2>
2760 T&
construct(A1
const& a1, A2
const& a2);
2766 template<
class T,
typename A1,
typename A2,
typename A3>
2767 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
2773 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
2774 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
2780 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
2781 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
2814 bool operator ()(
void)
const;
2816 void operator ++(
void);
2839 bool operator ()(
void)
const;
2841 void operator ++(
void);
2860 bool operator ()(
void)
const;
2862 void operator ++(
void);
2881 bool operator ()(
void)
const;
2883 void operator ++(
void);
2936 return mm.alloc(ssd.data().sm,s);
2940 return mm.reuse(
p,s);
2944 char* b =
static_cast<char*
>(_b);
2946 char*
p =
static_cast<char*
>(
ralloc(m));
2974 T*
p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
2975 for (
long unsigned int i=0; i<n; i++)
2976 (
void)
new (
p+i) T();
2983 return alloc<T>(
static_cast<long unsigned int>(n));
2988 return alloc<T>(
static_cast<long unsigned int>(n));
2994 return alloc<T>(
static_cast<long unsigned int>(n));
3000 for (
long unsigned int i=0; i<n; i++)
3002 rfree(b,n*
sizeof(T));
3008 free<T>(b,
static_cast<long unsigned int>(n));
3013 free<T>(b,
static_cast<long unsigned int>(n));
3019 free<T>(b,
static_cast<long unsigned int>(n));
3026 T*
p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
3027 for (
long unsigned int i=0; i<n; i++)
3028 (
void)
new (
p+i) T(b[i]);
3029 for (
long unsigned int i=n; i<m; i++)
3030 (
void)
new (
p+i) T();
3041 assert((n >= 0) && (m >= 0));
3042 return realloc<T>(b,
static_cast<long unsigned int>(n),
3043 static_cast<long unsigned int>(m));
3048 return realloc<T>(b,
static_cast<long unsigned int>(n),
3049 static_cast<long unsigned int>(m));
3054 assert((n >= 0) && (m >= 0));
3055 return realloc<T>(b,
static_cast<long unsigned int>(n),
3056 static_cast<long unsigned int>(m));
3059#define GECODE_KERNEL_REALLOC(T) \
3062 Space::realloc<T>(T* b, long unsigned int n, long unsigned int m) { \
3063 return static_cast<T*>(rrealloc(b,n*sizeof(T),m*sizeof(T))); \
3067 Space::realloc<T>(T* b, long int n, long int m) { \
3068 assert((n >= 0) && (m >= 0)); \
3069 return realloc<T>(b,static_cast<long unsigned int>(n), \
3070 static_cast<long unsigned int>(m)); \
3074 Space::realloc<T>(T* b, unsigned int n, unsigned int m) { \
3075 return realloc<T>(b,static_cast<long unsigned int>(n), \
3076 static_cast<long unsigned int>(m)); \
3080 Space::realloc<T>(T* b, int n, int m) { \
3081 assert((n >= 0) && (m >= 0)); \
3082 return realloc<T>(b,static_cast<long unsigned int>(n), \
3083 static_cast<long unsigned int>(m)); \
3098#undef GECODE_KERNEL_REALLOC
3103 return static_cast<T**
>(
rrealloc(b,n*
sizeof(T),m*
sizeof(T*)));
3108 assert((n >= 0) && (m >= 0));
3109 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3110 static_cast<long unsigned int>(m));
3115 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3116 static_cast<long unsigned int>(m));
3121 assert((n >= 0) && (m >= 0));
3122 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3123 static_cast<long unsigned int>(m));
3127#ifdef GECODE_HAS_VAR_DISPOSE
3130 Space::vars_d(
void)
const {
3131 return _vars_d[VIC::idx_d];
3135 Space::vars_d(VarImpBase* x) {
3136 _vars_d[VIC::idx_d] = x;
3141 Space::is_partial_clone(
void)
const {
3142 return d_fst == &Actor::sentinel;
3147 Actor::operator
delete(
void*) {}
3149 Actor::operator
delete(
void*,
Space&) {}
3151 Actor::operator
new(
size_t s,
Space& home) {
3152 return home.ralloc(s);
3164 return home.ralloc(s);
3169 Advisor::operator
delete(
void*) {}
3172 Advisor::operator
delete(
void*,
Space&) {}
3174 Advisor::operator
new(
size_t s,
Space& home) {
3175 return home.ralloc(s);
3179 NGL::operator
delete(
void*) {}
3183 NGL::operator
new(
size_t s,
Space& home) {
3184 return home.ralloc(s);
3205 return n.load(std::memory_order_acquire);
3209 n.store(n0, std::memory_order_release);
3221 unsigned long long int s0,
3222 unsigned long long int f0,
3304 p->_next = n; n->_prev = p;
3309 _next =
this; _prev =
this;
3316 this->_next = a; a->_prev =
this;
3317 a->_next = n; n->_prev = a;
3324 a->_next =
this; this->_prev = a;
3325 p->_next = a; a->_prev = p;
3330 return _next ==
this;
3348 return static_cast<const ActorLink*
>(&t);
3361 return static_cast<Actor*
>(&t);
3365 Actor::cast(
const ActorLink* al) {
3369 return static_cast<const Actor*
>(&t);
3374 s.notice(a,
p,duplicate);
3394 return const_cast<Space*
>(
this)->_clone();
3421 return ssd.data().gpi.decay();
3426 ssd.data().gpi.decay(d);
3431 return sizeof(*this);
3442 :
s(s0),
p(p0),
pg(pg0),
bg(bg0) {}
3469 return Home(*
this,&
p);
3514 return static_cast<What>(
who & 0b11);
3525 return *
reinterpret_cast<Brancher*
>
3526 (
who & ~static_cast<Support::uptrint_t>(0b11));
3539 :
h(home),
pg(home.propagatorgroup()),
3542 h.pc.p.vti.post(
pg);
3548 if (
h.pc.p.bid_sc & Space::sc_trace)
3562 :
i(i0),
g(g0),
p(p0),
s(s0) {}
3588 :
b(b0),
c(c0),
a(a0) {}
3617 :
g(g0),
s(s0),
n(n0) {}
3633 Space::NoGPI::NoGPI(
Space& h) : home(h), previous(h.no_gpi) {
3639 home.no_gpi = previous;
3644 Space::UseGPI::UseGPI(
Space& h) : home(h), previous(h.no_gpi) {
3645 home.no_gpi =
false;
3650 home.no_gpi = previous;
3680 Propagator::local_info(
void)
const {
3690 Propagator::disable(
Space& home) {
3691 home.pc.
p.
bid_sc |= Space::sc_disabled;
3696 Propagator::enable(
Space& home) {
3708 : gpi_disabled((home.
propagator() != nullptr) ?
3711 static_cast<
Space&>(home).no_gpi ?
3712 static_cast<
Space&>(home).local_info
3713 (home.propagatorgroup().gid) :
3715 static_cast<
Space&>(home).ssd.data().
gpi.allocate
3716 (home.propagatorgroup().gid)) {
3717 u.advisors =
nullptr;
3718 assert((u.med == 0) && (u.size == 0));
3719 static_cast<Space&
>(home).pl.head(
this);
3724 : gpi_disabled(p.gpi_disabled) {
3725 if (p.local_info()) {
3726 Kernel::GPI::Info* i = home.alloc<Kernel::GPI::Info>(1);
3728 gpi_disabled = Support::ptrjoin(i, p.disabled() ? 0b11 : 0b10);
3730 u.advisors =
nullptr;
3731 assert((u.med == 0) && (u.size == 0));
3743 return const_cast<Propagator&
>(*this).gpi().afc;
3746#ifdef GECODE_HAS_CBS
3748 Propagator::solndistrib(
Space&, SendMarginal)
const {}
3751 Propagator::domainsizesum(InDecision,
unsigned int& size,
3752 unsigned int& size_b)
const {
3760 return const_cast<Propagator&
>(*this).gpi().pid;
3781 p.u.size =
p.dispose(*
this);
3788 assert(
p.u.med != 0);
3795 assert(
p.u.med != 0);
3814 Brancher::cast(
const ActorLink* al) {
3818 return static_cast<const Brancher*
>(&t);
3823 gid(_home.branchergroup().gid) {
3825 bid = home.pc.
p.
bid_sc >> Space::sc_bits;
3826 home.pc.
p.
bid_sc += (1 << Space::sc_bits);
3827 if ((home.pc.
p.
bid_sc >> Space::sc_bits) == 0U)
3830 if (home.b_status == &
static_cast<Space&
>(home).bl) {
3831 home.b_status = this;
3832 if (home.b_commit == &static_cast<Space&>(home).bl)
3833 home.b_commit = this;
3840 : bid(b.bid), gid(b.gid) {
3866 b_commit = b.next();
3868 b_status = b.next();
3870 rfree(&b,b.dispose(*
this));
3874 Space::kill(Propagator& p) {
3879 if (pc.p.active < &pc.p.queue[0])
3883 assert(pc.p.active >= &pc.p.queue[0]);
3885 if (pc.p.active != pc.p.active->next())
3887 }
while (--pc.p.active >= &pc.p.queue[0]);
3889 assert(pc.p.active < &pc.p.queue[0]);
3893 Space::brancher(
unsigned int id) {
3908 ActorLink* b_old = b_commit;
3910 while (b_commit != &bl)
3911 if (
id != Brancher::cast(b_commit)->
id())
3912 b_commit = b_commit->next();
3914 return Brancher::cast(b_commit);
3915 if (b_commit == &bl) {
3917 b_commit = bl.next();
3918 while (b_commit != b_old)
3919 if (
id != Brancher::cast(b_commit)->
id())
3920 b_commit = b_commit->next();
3922 return Brancher::cast(b_commit);
3962 if (
prev() ==
nullptr)
3996 : bid(b.id()), alt(a) {}
4004 Choice::id(
void)
const {
4051 return sizeof(*this);
4071 Advisor::disposed(
void)
const {
4072 return prev() ==
nullptr;
4076 Advisor::cast(ActorLink* al) {
4077 return static_cast<Advisor*
>(al);
4082 return static_cast<const Advisor*
>(al);
4087 return static_cast<ActorLink*
>(&
a);
4092 assert(!disposed());
4099 assert(!disposed());
4103 if ((n !=
nullptr) && n->disposed())
4109 return home.pc.
p.
vti;
4146 : advisors(nullptr) {}
4152 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4155 return a ==
nullptr;
4164 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4169 if (c.advisors !=
nullptr) {
4173 Propagator* p_t = Propagator::cast(p_f->prev());
4179 assert(p_f->u.
advisors ==
nullptr);
4182 while (*a_f !=
nullptr) {
4183 if (
static_cast<A*
>(*a_f)->disposed()) {
4184 *a_f = (*a_f)->
next();
4187 A* a =
new (home) A(home,*
static_cast<A*
>(*a_f));
4202 for (
ActorLink* a = c.advisors; a !=
nullptr; a = a->next())
4203 if (!
static_cast<A*
>(a)->disposed())
4218 while (a !=
nullptr) {
4219 if (!
static_cast<A*
>(a)->disposed())
4220 static_cast<A*
>(a)->
dispose(home,*
this);
4235 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4242 return a !=
nullptr;
4250 }
while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed());
4256 return *
static_cast<A*
>(a);
4268 ActorLink*
c = &pc.p.queue[
p->cost(*
this,
p->u.med).ac];
4270 if (
c > pc.p.active)
4299 return ((pc.p.active < &pc.p.queue[0]) ||
4306 ap_notice_dispose(&a,d);
4309 pc.p.bid_sc |= sc_trace;
4312 pc.p.bid_sc |= sc_trace;
4325 ap_ignore_dispose(&a,d);
4347 assert((pc >= 0) && (pc < pc_max+2));
4348 return (pc == 0) ? b.base : b.base+u.idx[pc-1];
4353 VarImp<VIC>::actorNonZero(
PropCond pc) {
4354 assert((pc > 0) && (pc < pc_max+2));
4355 return b.base+u.idx[pc-1];
4361 assert((pc > 0) && (pc < pc_max+2));
4368 assert((pc > 0) && (pc < pc_max+2));
4375#ifdef GECODE_HAS_CBS
4376 : var_id(++home.var_id_counter)
4379#ifndef GECODE_HAS_CBS
4382 b.base =
nullptr; entries = 0;
4383 for (
PropCond pc=1; pc<pc_max+2; pc++)
4391#ifdef GECODE_HAS_CBS
4395 b.base =
nullptr; entries = 0;
4396 for (
PropCond pc=1; pc<pc_max+2; pc++)
4401#ifdef GECODE_HAS_CBS
4425 d += Propagator::cast(*a)->afc(); a++;
4434 ->propagator().afc();
4450 return free_and_bits;
4456 return free_and_bits;
4459#ifdef GECODE_HAS_VAR_DISPOSE
4463 return static_cast<VarImp<VIC>*
>(home.vars_d<VIC>());
4468 VarImp<VIC>::vars_d(Space& home, VarImp<VIC>* x) {
4469 home.vars_d<VIC>(x);
4496#ifdef GECODE_HAS_CBS
4501 free_and_bits = x.free_and_bits & ((1 << free_bits) - 1);
4502 if (x.b.
base ==
nullptr) {
4507 reg = &home.pc.
c.
vars_u[idx_c];
4511 entries = x.entries;
4512 for (
PropCond pc=1; pc<pc_max+2; pc++)
4524 return static_cast<ModEvent>((
med & VIC::med_mask) >> VIC::med_fst);
4536 return VIC::me_combine(me1,me2);
4543 if (VIC::med_update(p.u.
med,
me) || force)
4550 if (b.base ==
nullptr)
4554 while (end > begin) {
4562 VarImp<VIC>::resize(
Space& home) {
4563 if (b.base ==
nullptr) {
4564 assert((free_and_bits >> free_bits) == 0);
4566 free_and_bits += 4 << free_bits;
4568 for (
int i=0; i<pc_max+1; i++)
4572 unsigned int n = degree();
4576 ActorLink** s =
static_cast<ActorLink**
>(home.mm.
subscriptions());
4578 ((s <= b.base) && (b.base < s+home.pc.
p.
n_sub)) ?
4579 (n+4) : ((n+1)*3>>1);
4580 ActorLink** prop = home.
alloc<ActorLink*>(m);
4581 free_and_bits += (m-n) << free_bits;
4584 home.
free<ActorLink*>(b.base,n);
4592 assert(pc <= pc_max);
4594 home.pc.p.n_sub += 1;
4595 if ((free_and_bits >> free_bits) == 0)
4597 free_and_bits -= 1 << free_bits;
4600 b.base[entries] = *actorNonZero(pc_max+1);
4602 for (
PropCond j = pc_max; j > pc; j--) {
4603 *actorNonZero(j+1) = *actorNonZero(j);
4606 *actorNonZero(pc+1) = *actor(pc);
4612 while (f < (pc == pc_max+1 ?
b.base+entries : actorNonZero(pc+1)))
4627 home.pc.p.n_sub += 1;
4628 if ((free_and_bits >> free_bits) == 0)
4630 free_and_bits -= 1 << free_bits;
4633 b.base[entries++] = *actorNonZero(pc_max+1);
4634 *actorNonZero(pc_max+1) =
a;
4676 assert(pc <= pc_max);
4681 while (f < actorNonZero(pc+1))
4689 while (*f != a) f++;
4692 *f = *(actorNonZero(pc+1)-1);
4693 for (
PropCond j = pc+1; j< pc_max+1; j++) {
4694 *(actorNonZero(j)-1) = *(actorNonZero(j+1)-1);
4697 *(actorNonZero(pc_max+1)-1) = b.base[entries-1];
4700 free_and_bits += 1 << free_bits;
4707 if ((b.base !=
nullptr) && !home.is_partial_clone())
4718 while (f < b.base+entries)
4726 while (*f != a) f++;
4729 *f = b.base[--entries];
4730 free_and_bits += 1 << free_bits;
4737 if ((b.base !=
nullptr) && !home.is_partial_clone()) {
4747 unsigned int n_sub =
degree();
4748 home.pc.
p.
n_sub -= n_sub;
4749 unsigned int n = (free_and_bits >> free_bits) + n_sub;
4756 for (
PropCond pc=1; pc<pc_max+2; pc++)
4758 free_and_bits &= (1 << free_bits) - 1;
4769 ActorLink** la = actorNonZero(pc_max+1);
4780 assert(!a->disposed());
4782 switch (p.
advise(home,*a,d)) {
4797 }
while (++la < le);
4803 VarImp<VIC>::_fail(
Space& home) {
4809 ActorLink** la = actorNonZero(pc_max+1);
4820 assert(!a->disposed());
4824 }
while (++la < le);
4836#pragma clang diagnostic push
4837#pragma clang diagnostic ignored "-Warray-bounds"
4846 x->u.
idx[0] = u.idx[0];
4847 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4848 x->u.
idx[1] = u.idx[1];
4851 static_cast<unsigned int>(x->actorNonZero(pc_max+1) - x->actor(0));
4853 static_cast<unsigned int >(x->b.
base + x->entries -
4854 x->actorNonZero(pc_max+1));
4855 unsigned int n = na + np;
4856 assert(n == x->
degree());
4869 t[0] = p0; t[1] = p1; t[2] = p2; t[3] = p3;
4870 np -= 4; t += 4; f += 4;
4873 ActorLink* p0 = f[0]->prev();
4874 ActorLink* p1 = f[1]->prev();
4875 t[0] = p0; t[1] = p1;
4876 np -= 2; t += 2; f += 2;
4885 ptrdiff_t m0, m1, m2, m3;
4898 na -= 4; t += 4;
f += 4;
4908 na -= 2; t += 2;
f += 2;
4917#pragma clang diagnostic pop
4923 while (x !=
nullptr) {
4932 while (x !=
nullptr) {
4936 x->b.
base = copy->b.base;
4937 x->u.idx[0] = copy->u.idx[0];
4938 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4939 x->u.idx[1] = copy->u.idx[1];
4953 template<
class VarImp>
4955#ifdef GECODE_HAS_VAR_DISPOSE
4956 Space::vd[VarImp::idx_d] =
this;
4960 template<
class VarImp>
4965 x->dispose(home); x =
static_cast<VarImp*
>(x->next_d());
4966 }
while (x !=
nullptr);
5045 return (m ==
LO) ? lo : hi;
5059 return crazy(m,
static_cast<unsigned int>(n));
5068 return cubic(m,
static_cast<unsigned int>(n));
5077 return quadratic(m,
static_cast<unsigned int>(n));
5086 return linear(m,
static_cast<unsigned int>(n));
5107 : home(home0), q(home.pc.
p.
active) {
5108 while (q >= &home.pc.p.queue[0]) {
5109 if (q->next() != q) {
5110 c = q->next(); e = q; q--;
5116 if (!home.pl.empty()) {
5125 return c !=
nullptr;
5134 while (q >= &home.pc.p.queue[0]) {
5135 if (q->next() != q) {
5136 c = q->next(); e = q; q--;
5142 if (!home.pl.empty()) {
5153 return *Propagator::cast(c);
5159 : home(home0), q(home.pc.
p.
active) {
5160 while (q >= &home.pc.p.queue[0]) {
5161 if (q->next() != q) {
5162 c = q->next(); e = q; q--;
5167 q =
c = e =
nullptr;
5171 return c !=
nullptr;
5180 while (q >= &home.pc.p.queue[0]) {
5181 if (q->next() != q) {
5182 c = q->next(); e = q; q--;
5187 q = c = e =
nullptr;
5193 return *Propagator::cast(c);
5212 return *Propagator::cast(c);
5218 : c(home.bl.next()), e(&home.bl) {}
5229 return *Brancher::cast(c);
5286 return id() == g.
id();
5290 return id() != g.
id();
5324 return id() == g.
id();
5328 return id() != g.
id();
5345 : ps(const_cast<
Space&>(home)), g(g0) {
5346 while (ps() && !g.in(ps.propagator().group()))
5357 while (ps() && !g.in(ps.propagator().group()));
5361 return ps.propagator();
5366 : bs(const_cast<
Space&>(home)), g(g0) {
5367 while (bs() && !g.in(bs.brancher().group()))
5378 while (bs() && !g.in(bs.brancher().group()));
5382 return bs.brancher();
5395 template<
class T,
typename A1>
5398 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5402 template<
class T,
typename A1,
typename A2>
5405 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5409 template<
class T,
typename A1,
typename A2,
typename A3>
5412 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5413 new (&t) T(a1,a2,a3);
5416 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
5419 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5420 new (&t) T(a1,a2,a3,a4);
5423 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
5426 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5427 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 * 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.
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 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 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.
virtual NGL * ngl(Space &home, const Choice &c, unsigned int a) const
Create no-good literal for choice c and alternative a.
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 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.
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.
virtual bool notice(void) const
Whether dispose must always be called (returns false).
No-goods recorded from restarts.
virtual void post(Space &home) const
Post no-goods.
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.
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.
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 ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Advise function.
Kernel::GPI::Info & gpi(void)
Provide access to propagator information.
unsigned int id(void) const
Return propagator id.
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.
~NoGPI(void)
Restore the previous setting.
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.
~UseGPI(void)
Restore the previous setting.
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.
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.
Support::uptrint_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.
Space(void)
Default constructor.
virtual bool slave(const MetaInfo &mi)
Slave configuration function for meta search engines.
virtual void constrain(const Space &best)
Constrain function for best solution search.
virtual bool master(const MetaInfo &mi)
Master configuration function for meta search engines.
virtual Space * copy(void)=0
Copying member function.
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
void print(const Search::Statistics &stat, bool restart)
Print statistics.
#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.
std::make_unsigned_t< ptrdiff_t > uptrint_t
Unsigned integer for pointer encodings.
void * fmark(void *p)
Return marked pointer for p (possibly already marked).
void * mark(void *p)
Return marked pointer for unmarked pointer p.
void * funmark(void *p)
Clear the lowest bits bits of a possibly marked 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.
Gecode::FloatVal b(9, 12)
Gecode::FloatVal a(-8, 5)
#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