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];
286 ActorLink** actorNonZero(
PropCond pc);
290 unsigned int idx(
PropCond pc)
const;
298 void update(
VarImp* x, ActorLink**& sub);
305 static void update(
Space& home, ActorLink**& sub);
307 static void recover(
Space& home, ActorLink**& sub);
312 void enter(
Space& home, ActorLink* a);
314 void resize(
Space& home);
318 void remove(
Space& home, ActorLink* a);
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);
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;
1713 unsigned int asset(
void)
const;
1807#ifdef GECODE_HAS_CBS
1809 unsigned int var_id_counter;
1836 Brancher* brancher(
unsigned int id);
1845 void kill_brancher(
unsigned int id);
1848 static const unsigned reserved_bid = 0U;
1851 static const unsigned int sc_bits = 2;
1853 static const unsigned int sc_fast = 0;
1855 static const unsigned int sc_disabled = 1;
1857 static const unsigned int sc_trace = 2;
1883 unsigned int bid_sc;
1902 void enqueue(Propagator* p);
1907#ifdef GECODE_HAS_VAR_DISPOSE
1911 VarImpBase* _vars_d[AllVarConf::idx_d];
1913 template<
class VIC> VarImpBase* vars_d(
void)
const;
1915 template<
class VIC>
void vars_d(VarImpBase* x);
1918 void update(ActorLink** sub);
1922 void recover_noidx(
void);
1925 void recover(Space& source);
1928 bool is_partial_clone(
void)
const;
1992 void _commit(
const Choice& c,
unsigned int a);
2025 void _trycommit(
const Choice& c,
unsigned int a);
2029 TraceRecorder* findtracerecorder(
void);
2032 void post(
const PostInfo&
pi);
2041 void ap_notice_dispose(Actor* a,
bool d);
2049 void ap_ignore_dispose(Actor* a,
bool d);
2071 NoGPI(
const NoGPI&) =
delete;
2072 NoGPI& operator =(
const NoGPI&) =
delete;
2075 explicit NoGPI(
Space& home);
2093 UseGPI(
const UseGPI&) =
delete;
2094 UseGPI& operator =(
const UseGPI&) =
delete;
2097 explicit UseGPI(
Space& home);
2558 T*
alloc(
long unsigned int n);
2566 T*
alloc(
long int n);
2574 T*
alloc(
unsigned int n);
2593 void free(T* b,
long unsigned int n);
2604 void free(T* b,
long int n);
2615 void free(T* b,
unsigned int n);
2626 void free(T* b,
int n);
2639 T*
realloc(T* b,
long unsigned int n,
long unsigned int m);
2652 T*
realloc(T* b,
long int n,
long int m);
2665 T*
realloc(T* b,
unsigned int n,
unsigned int m);
2678 T*
realloc(T* b,
int n,
int m);
2687 T**
realloc(T** b,
long unsigned int n,
long unsigned int m);
2696 T**
realloc(T** b,
long int n,
long int m);
2705 T**
realloc(T** b,
unsigned int n,
unsigned int m);
2714 T**
realloc(T** b,
int n,
int m);
2718 void rfree(
void* p,
size_t s);
2720 void*
rrealloc(
void* b,
size_t n,
size_t m);
2722 template<
size_t>
void*
fl_alloc(
void);
2742 template<
class T,
typename A1>
2749 template<
class T,
typename A1,
typename A2>
2750 T&
construct(A1
const& a1, A2
const& a2);
2756 template<
class T,
typename A1,
typename A2,
typename A3>
2757 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
2763 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
2764 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
2770 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
2771 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
2804 bool operator ()(
void)
const;
2806 void operator ++(
void);
2829 bool operator ()(
void)
const;
2831 void operator ++(
void);
2850 bool operator ()(
void)
const;
2852 void operator ++(
void);
2871 bool operator ()(
void)
const;
2873 void operator ++(
void);
2926 return mm.alloc(ssd.data().sm,s);
2930 return mm.reuse(p,s);
2934 char* b =
static_cast<char*
>(_b);
2936 char* p =
static_cast<char*
>(
ralloc(m));
2964 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
2965 for (
long unsigned int i=0; i<n; i++)
2966 (
void)
new (p+i) T();
2973 return alloc<T>(
static_cast<long unsigned int>(n));
2978 return alloc<T>(
static_cast<long unsigned int>(n));
2984 return alloc<T>(
static_cast<long unsigned int>(n));
2990 for (
long unsigned int i=0; i<n; i++)
2992 rfree(b,n*
sizeof(T));
2998 free<T>(b,
static_cast<long unsigned int>(n));
3003 free<T>(b,
static_cast<long unsigned int>(n));
3009 free<T>(b,
static_cast<long unsigned int>(n));
3016 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
3017 for (
long unsigned int i=0; i<n; i++)
3018 (
void)
new (p+i) T(b[i]);
3019 for (
long unsigned int i=n; i<m; i++)
3020 (
void)
new (p+i) T();
3031 assert((n >= 0) && (m >= 0));
3032 return realloc<T>(b,
static_cast<long unsigned int>(n),
3033 static_cast<long unsigned int>(m));
3038 return realloc<T>(b,
static_cast<long unsigned int>(n),
3039 static_cast<long unsigned int>(m));
3044 assert((n >= 0) && (m >= 0));
3045 return realloc<T>(b,
static_cast<long unsigned int>(n),
3046 static_cast<long unsigned int>(m));
3049#define GECODE_KERNEL_REALLOC(T) \
3052 Space::realloc<T>(T* b, long unsigned int n, long unsigned int m) { \
3053 return static_cast<T*>(rrealloc(b,n*sizeof(T),m*sizeof(T))); \
3057 Space::realloc<T>(T* b, long int n, long int m) { \
3058 assert((n >= 0) && (m >= 0)); \
3059 return realloc<T>(b,static_cast<long unsigned int>(n), \
3060 static_cast<long unsigned int>(m)); \
3064 Space::realloc<T>(T* b, unsigned int n, unsigned int m) { \
3065 return realloc<T>(b,static_cast<long unsigned int>(n), \
3066 static_cast<long unsigned int>(m)); \
3070 Space::realloc<T>(T* b, int n, int m) { \
3071 assert((n >= 0) && (m >= 0)); \
3072 return realloc<T>(b,static_cast<long unsigned int>(n), \
3073 static_cast<long unsigned int>(m)); \
3088#undef GECODE_KERNEL_REALLOC
3093 return static_cast<T**
>(
rrealloc(b,n*
sizeof(T),m*
sizeof(T*)));
3098 assert((n >= 0) && (m >= 0));
3099 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3100 static_cast<long unsigned int>(m));
3105 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3106 static_cast<long unsigned int>(m));
3111 assert((n >= 0) && (m >= 0));
3112 return realloc<T*>(b,
static_cast<long unsigned int>(n),
3113 static_cast<long unsigned int>(m));
3117#ifdef GECODE_HAS_VAR_DISPOSE
3120 Space::vars_d(
void)
const {
3121 return _vars_d[VIC::idx_d];
3125 Space::vars_d(VarImpBase* x) {
3126 _vars_d[VIC::idx_d] = x;
3131 Space::is_partial_clone(
void)
const {
3132 return d_fst == &Actor::sentinel;
3137 Actor::operator
delete(
void*) {}
3139 Actor::operator
delete(
void*,
Space&) {}
3141 Actor::operator
new(
size_t s,
Space& home) {
3142 return home.ralloc(s);
3154 return home.ralloc(s);
3159 Advisor::operator
delete(
void*) {}
3162 Advisor::operator
delete(
void*,
Space&) {}
3164 Advisor::operator
new(
size_t s,
Space& home) {
3165 return home.ralloc(s);
3169 NGL::operator
delete(
void*) {}
3173 NGL::operator
new(
size_t s,
Space& home) {
3174 return home.ralloc(s);
3193 forceinline
unsigned long int
3195 return n.load(std::memory_order_acquire);
3199 n.store(n0, std::memory_order_release);
3211 unsigned long long int s0,
3212 unsigned long long int f0,
3225 forceinline
unsigned long int
3234 forceinline
unsigned long long int
3239 forceinline
unsigned long long int
3244 forceinline
const Space*
3254 forceinline
unsigned int
3294 p->_next = n; n->_prev = p;
3299 _next =
this; _prev =
this;
3306 this->_next = a; a->_prev =
this;
3307 a->_next = n; n->_prev = a;
3314 a->_next =
this; this->_prev = a;
3315 p->_next = a; a->_prev = p;
3320 return _next ==
this;
3338 return static_cast<const ActorLink*
>(&t);
3351 return static_cast<Actor*
>(&t);
3354 forceinline
const Actor*
3355 Actor::cast(
const ActorLink* al) {
3359 return static_cast<const Actor*
>(&t);
3364 s.notice(a,
p,duplicate);
3384 return const_cast<Space*
>(
this)->_clone();
3411 return ssd.data().gpi.decay();
3416 ssd.data().gpi.decay(d);
3421 return sizeof(*this);
3432 :
s(s0),
p(p0),
pg(pg0),
bg(bg0) {}
3459 return Home(*
this,&p);
3504 return static_cast<What>(
who & 0b11);
3515 return *
reinterpret_cast<Brancher*
>
3516 (
who & ~static_cast<Support::uptrint_t>(0b11));
3529 :
h(home),
pg(home.propagatorgroup()),
3532 h.pc.p.vti.post(
pg);
3538 if (
h.pc.p.bid_sc & Space::sc_trace)
3552 :
i(i0),
g(g0),
p(p0),
s(s0) {}
3553 forceinline
unsigned int
3578 :
b(b0),
c(c0),
a(a0) {}
3579 forceinline
unsigned int
3591 forceinline
const Choice&
3595 forceinline
unsigned int
3607 :
g(g0),
s(s0),
n(n0) {}
3616 forceinline
unsigned int
3623 Space::NoGPI::NoGPI(
Space& h) : home(h), previous(h.no_gpi) {
3629 home.no_gpi = previous;
3634 Space::UseGPI::UseGPI(
Space& h) : home(h), previous(h.no_gpi) {
3635 home.no_gpi =
false;
3640 home.no_gpi = previous;
3670 Propagator::local_info(
void)
const {
3680 Propagator::disable(
Space& home) {
3681 home.pc.p.bid_sc |= Space::sc_disabled;
3686 Propagator::enable(
Space& home) {
3691 forceinline Kernel::GPI::Info&
3698 : gpi_disabled((home.
propagator() != nullptr) ?
3701 static_cast<
Space&>(home).no_gpi ?
3702 static_cast<
Space&>(home).local_info
3703 (home.propagatorgroup().gid) :
3705 static_cast<
Space&>(home).ssd.data().
gpi.allocate
3706 (home.propagatorgroup().gid)) {
3707 u.advisors =
nullptr;
3708 assert((u.med == 0) && (u.size == 0));
3709 static_cast<Space&
>(home).pl.head(
this);
3714 : gpi_disabled(p.gpi_disabled) {
3715 if (p.local_info()) {
3716 Kernel::GPI::Info* i = home.alloc<Kernel::GPI::Info>(1);
3718 gpi_disabled = Support::ptrjoin(i, p.disabled() ? 0b11 : 0b10);
3720 u.advisors =
nullptr;
3721 assert((u.med == 0) && (u.size == 0));
3733 return const_cast<Propagator&
>(*this).gpi().afc;
3736#ifdef GECODE_HAS_CBS
3738 Propagator::solndistrib(
Space&, SendMarginal)
const {}
3741 Propagator::domainsizesum(InDecision,
unsigned int& size,
3742 unsigned int& size_b)
const {
3748 forceinline
unsigned int
3750 return const_cast<Propagator&
>(*this).gpi().pid;
3778 assert(p.u.med != 0);
3785 assert(p.u.med != 0);
3803 forceinline
const Brancher*
3804 Brancher::cast(
const ActorLink* al) {
3808 return static_cast<const Brancher*
>(&t);
3813 gid(_home.branchergroup().gid) {
3815 bid = home.pc.p.bid_sc >> Space::sc_bits;
3816 home.pc.p.bid_sc += (1 << Space::sc_bits);
3817 if ((home.pc.p.bid_sc >> Space::sc_bits) == 0U)
3820 if (home.b_status == &
static_cast<Space&
>(home).bl) {
3821 home.b_status = this;
3822 if (home.b_commit == &static_cast<Space&>(home).bl)
3823 home.b_commit = this;
3830 : bid(b.bid), gid(b.gid) {
3835 forceinline
unsigned int
3856 b_commit = b.next();
3858 b_status = b.next();
3864 Space::kill(Propagator& p) {
3867 rfree(&p,p.dispose(*
this));
3869 if (pc.p.active < &pc.p.queue[0])
3873 assert(pc.p.active >= &pc.p.queue[0]);
3875 if (pc.p.active != pc.p.active->next())
3877 }
while (--pc.p.active >= &pc.p.queue[0]);
3879 assert(pc.p.active < &pc.p.queue[0]);
3883 Space::brancher(
unsigned int id) {
3898 ActorLink* b_old = b_commit;
3900 while (b_commit != &bl)
3901 if (
id != Brancher::cast(b_commit)->
id())
3902 b_commit = b_commit->next();
3904 return Brancher::cast(b_commit);
3905 if (b_commit == &bl) {
3907 b_commit = bl.next();
3908 while (b_commit != b_old)
3909 if (
id != Brancher::cast(b_commit)->
id())
3910 b_commit = b_commit->next();
3912 return Brancher::cast(b_commit);
3952 if (
prev() ==
nullptr)
3986 : bid(b.id()), alt(a) {}
3988 forceinline
unsigned int
3993 forceinline
unsigned int
3994 Choice::id(
void)
const {
4041 return sizeof(*this);
4061 Advisor::disposed(
void)
const {
4062 return prev() ==
nullptr;
4065 forceinline Advisor*
4066 Advisor::cast(ActorLink* al) {
4067 return static_cast<Advisor*
>(al);
4072 return static_cast<const Advisor*
>(al);
4077 return static_cast<ActorLink*
>(&a);
4082 assert(!disposed());
4089 assert(!disposed());
4093 if ((n !=
nullptr) && n->disposed())
4099 return home.pc.p.vti;
4136 : advisors(nullptr) {}
4142 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4145 return a ==
nullptr;
4154 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4159 if (c.advisors !=
nullptr) {
4163 Propagator* p_t = Propagator::cast(p_f->prev());
4169 assert(p_f->u.advisors ==
nullptr);
4170 p_f->u.advisors = c.advisors;
4172 while (*a_f !=
nullptr) {
4173 if (
static_cast<A*
>(*a_f)->disposed()) {
4174 *a_f = (*a_f)->
next();
4177 A* a =
new (home) A(home,*
static_cast<A*
>(*a_f));
4192 for (
ActorLink* a = c.advisors; a !=
nullptr; a = a->
next())
4193 if (!
static_cast<A*
>(a)->disposed())
4195 p_f->u.advisors =
nullptr;
4208 while (a !=
nullptr) {
4209 if (!
static_cast<A*
>(a)->disposed())
4210 static_cast<A*
>(a)->
dispose(home,*
this);
4225 while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed())
4232 return a !=
nullptr;
4240 }
while ((a !=
nullptr) &&
static_cast<A*
>(a)->disposed());
4246 return *
static_cast<A*
>(a);
4260 if (c > pc.p.active)
4289 return ((pc.p.active < &pc.p.queue[0]) ||
4296 ap_notice_dispose(&a,d);
4299 pc.p.bid_sc |= sc_trace;
4302 pc.p.bid_sc |= sc_trace;
4315 ap_ignore_dispose(&a,d);
4337 assert((pc >= 0) && (pc < pc_max+2));
4338 return (pc == 0) ? b.base : b.base+u.idx[pc-1];
4342 forceinline ActorLink**
4343 VarImp<VIC>::actorNonZero(
PropCond pc) {
4344 assert((pc > 0) && (pc < pc_max+2));
4345 return b.base+u.idx[pc-1];
4349 forceinline
unsigned int&
4351 assert((pc > 0) && (pc < pc_max+2));
4356 forceinline
unsigned int
4357 VarImp<VIC>::idx(
PropCond pc)
const {
4358 assert((pc > 0) && (pc < pc_max+2));
4365#ifdef GECODE_HAS_CBS
4366 : var_id(++home.var_id_counter)
4369#ifndef GECODE_HAS_CBS
4372 b.base =
nullptr; entries = 0;
4373 for (
PropCond pc=1; pc<pc_max+2; pc++)
4381#ifdef GECODE_HAS_CBS
4385 b.base =
nullptr; entries = 0;
4386 for (
PropCond pc=1; pc<pc_max+2; pc++)
4391#ifdef GECODE_HAS_CBS
4393 forceinline
unsigned int
4400 forceinline
unsigned int
4415 d += Propagator::cast(*a)->afc(); a++;
4424 ->propagator().afc();
4438 forceinline
unsigned int
4440 return free_and_bits;
4444 forceinline
unsigned int&
4446 return free_and_bits;
4449#ifdef GECODE_HAS_VAR_DISPOSE
4453 return static_cast<VarImp<VIC>*
>(home.vars_d<VIC>());
4458 VarImp<VIC>::vars_d(Space& home, VarImp<VIC>* x) {
4459 home.vars_d<VIC>(x);
4486#ifdef GECODE_HAS_CBS
4491 free_and_bits = x.free_and_bits & ((1 << free_bits) - 1);
4492 if (x.b.base ==
nullptr) {
4494 reg = &home.pc.c.vars_noidx;
4497 reg = &home.pc.c.vars_u[idx_c];
4501 entries = x.entries;
4502 for (
PropCond pc=1; pc<pc_max+2; pc++)
4503 idx(pc) = x.idx(pc);
4514 return static_cast<ModEvent>((
med & VIC::med_mask) >> VIC::med_fst);
4526 return VIC::me_combine(me1,me2);
4533 if (VIC::med_update(p.u.med,
me) || force)
4540 if (b.base ==
nullptr)
4544 while (end > begin) {
4552 VarImp<VIC>::resize(
Space& home) {
4553 if (b.base ==
nullptr) {
4554 assert((free_and_bits >> free_bits) == 0);
4556 free_and_bits += 4 << free_bits;
4558 for (
int i=0; i<pc_max+1; i++)
4562 unsigned int n = degree();
4566 ActorLink** s =
static_cast<ActorLink**
>(home.mm.
subscriptions());
4568 ((s <= b.base) && (b.base < s+home.pc.p.n_sub)) ?
4569 (n+4) : ((n+1)*3>>1);
4570 ActorLink** prop = home.
alloc<ActorLink*>(m);
4571 free_and_bits += (m-n) << free_bits;
4574 home.
free<ActorLink*>(b.base,n);
4582 assert(pc <= pc_max);
4584 home.pc.p.n_sub += 1;
4585 if ((free_and_bits >> free_bits) == 0)
4587 free_and_bits -= 1 << free_bits;
4590 b.base[entries] = *actorNonZero(pc_max+1);
4592 for (
PropCond j = pc_max; j > pc; j--) {
4593 *actorNonZero(j+1) = *actorNonZero(j);
4596 *actorNonZero(pc+1) = *actor(pc);
4602 while (f < (pc == pc_max+1 ? b.base+entries : actorNonZero(pc+1)))
4617 home.pc.p.n_sub += 1;
4618 if ((free_and_bits >> free_bits) == 0)
4620 free_and_bits -= 1 << free_bits;
4623 b.base[entries++] = *actorNonZero(pc_max+1);
4624 *actorNonZero(pc_max+1) = a;
4666 assert(pc <= pc_max);
4671 while (f < actorNonZero(pc+1))
4679 while (*f != a) f++;
4682 *f = *(actorNonZero(pc+1)-1);
4683 for (
PropCond j = pc+1; j< pc_max+1; j++) {
4684 *(actorNonZero(j)-1) = *(actorNonZero(j+1)-1);
4687 *(actorNonZero(pc_max+1)-1) = b.base[entries-1];
4690 free_and_bits += 1 << free_bits;
4691 home.pc.p.n_sub -= 1;
4697 if ((b.base !=
nullptr) && !home.is_partial_clone())
4708 while (f < b.base+entries)
4716 while (*f != a) f++;
4719 *f = b.base[--entries];
4720 free_and_bits += 1 << free_bits;
4721 home.pc.p.n_sub -= 1;
4727 if ((b.base !=
nullptr) && !home.is_partial_clone()) {
4737 unsigned int n_sub =
degree();
4738 home.pc.p.n_sub -= n_sub;
4739 unsigned int n = (free_and_bits >> free_bits) + n_sub;
4746 for (
PropCond pc=1; pc<pc_max+2; pc++)
4748 free_and_bits &= (1 << free_bits) - 1;
4759 ActorLink** la = actorNonZero(pc_max+1);
4770 assert(!a->disposed());
4772 switch (p.
advise(home,*a,d)) {
4787 }
while (++la < le);
4793 VarImp<VIC>::_fail(
Space& home) {
4799 ActorLink** la = actorNonZero(pc_max+1);
4810 assert(!a->disposed());
4814 }
while (++la < le);
4826#pragma clang diagnostic push
4827#pragma clang diagnostic ignored "-Warray-bounds"
4836 x->u.idx[0] = u.idx[0];
4837 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4838 x->u.idx[1] = u.idx[1];
4841 static_cast<unsigned int>(x->actorNonZero(pc_max+1) - x->actor(0));
4843 static_cast<unsigned int >(x->b.base + x->entries -
4844 x->actorNonZero(pc_max+1));
4845 unsigned int n = na + np;
4846 assert(n == x->
degree());
4859 t[0] = p0; t[1] = p1; t[2] = p2; t[3] = p3;
4860 np -= 4; t += 4; f += 4;
4863 ActorLink* p0 = f[0]->
prev();
4864 ActorLink* p1 = f[1]->
prev();
4865 t[0] = p0; t[1] = p1;
4866 np -= 2; t += 2; f += 2;
4875 ptrdiff_t m0, m1, m2, m3;
4888 na -= 4; t += 4; f += 4;
4898 na -= 2; t += 2; f += 2;
4907#pragma clang diagnostic pop
4913 while (x !=
nullptr) {
4922 while (x !=
nullptr) {
4926 x->b.base = copy->b.base;
4927 x->u.idx[0] = copy->u.idx[0];
4928 if (pc_max > 0 &&
sizeof(
ActorLink**) >
sizeof(
unsigned int))
4929 x->u.idx[1] = copy->u.idx[1];
4943 template<
class VarImp>
4945#ifdef GECODE_HAS_VAR_DISPOSE
4946 Space::vd[VarImp::idx_d] =
this;
4950 template<
class VarImp>
4955 x->dispose(home); x =
static_cast<VarImp*
>(x->next_d());
4956 }
while (x !=
nullptr);
5024 forceinline PropCost
5035 return (m ==
LO) ? lo : hi;
5049 return crazy(m,
static_cast<unsigned int>(n));
5058 return cubic(m,
static_cast<unsigned int>(n));
5067 return quadratic(m,
static_cast<unsigned int>(n));
5076 return linear(m,
static_cast<unsigned int>(n));
5097 : home(home0), q(home.pc.p.active) {
5098 while (q >= &home.pc.p.queue[0]) {
5099 if (q->next() != q) {
5100 c = q->next(); e = q; q--;
5106 if (!home.pl.empty()) {
5115 return c !=
nullptr;
5124 while (q >= &home.pc.p.queue[0]) {
5125 if (q->next() != q) {
5126 c = q->next(); e = q; q--;
5132 if (!home.pl.empty()) {
5143 return *Propagator::cast(c);
5149 : home(home0), q(home.pc.p.active) {
5150 while (q >= &home.pc.p.queue[0]) {
5151 if (q->next() != q) {
5152 c = q->next(); e = q; q--;
5157 q = c = e =
nullptr;
5161 return c !=
nullptr;
5170 while (q >= &home.pc.p.queue[0]) {
5171 if (q->next() != q) {
5172 c = q->next(); e = q; q--;
5177 q = c = e =
nullptr;
5183 return *Propagator::cast(c);
5202 return *Propagator::cast(c);
5208 : c(home.bl.next()), e(&home.bl) {}
5219 return *Brancher::cast(c);
5247 forceinline
unsigned int
5276 return id() == g.
id();
5280 return id() != g.
id();
5314 return id() == g.
id();
5318 return id() != g.
id();
5335 : ps(const_cast<
Space&>(home)), g(g0) {
5336 while (ps() && !g.in(ps.propagator().group()))
5347 while (ps() && !g.in(ps.propagator().group()));
5351 return ps.propagator();
5356 : bs(const_cast<
Space&>(home)), g(g0) {
5357 while (bs() && !g.in(bs.brancher().group()))
5368 while (bs() && !g.in(bs.brancher().group()));
5372 return bs.brancher();
5385 template<
class T,
typename A1>
5388 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5392 template<
class T,
typename A1,
typename A2>
5395 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5399 template<
class T,
typename A1,
typename A2,
typename A3>
5402 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5403 new (&t) T(a1,a2,a3);
5406 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
5409 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5410 new (&t) T(a1,a2,a3,a4);
5413 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
5416 T& t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
5417 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.
bool in(Group a) const
Check whether actor group a is included in this group.
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.
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 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.
Propagator(Home home)
Constructor for posting.
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.
friend void trace(Home home, TraceFilter tf, int te, Tracer &t)
Create tracer.
void * ralloc(size_t s)
Allocate memory on space heap.
double afc_decay(void) const
Return AFC decay factor.
void afc_unshare(void)
Unshare AFC information for all propagators.
T & construct(void)
Construction routines.
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).
void * fl_alloc(void)
Allocate from freelist-managed memory.
void afc_decay(double d)
Set AFC decay factor to d
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
friend class PropagatorGroup
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
friend class BrancherGroup
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
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 * next(void) const
Return next copied variable.
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.
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)
VarImp * forward(void) const
Use forward pointer if variable already copied.
static ModEvent me(const ModEventDelta &med)
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)
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 brancher(Brancher &b)
Record that brancher b is executing.
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.
void propagator(Propagator &p)
Record that propagator p is executing.
Support::uptrint_t who
Encoding a tagged pointer or a tagged group id.
void post(PropagatorGroup g)
Record that a post function with propagator group g is executing.
#define GECODE_KERNEL_REALLOC(T)
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
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.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
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 update(VY &y, Space &home, bool shared, VY py)
Update view y from py.
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.
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntPropLevel ipl=IPL_DEF)
Post propagators for scheduling tasks on unary resources.
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