core.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
* Guido Tack <tack@gecode.org>
* Mikael Lagerkvist <lagerkvist@gecode.org>
*
* Contributing authors:
* Filip Konvicka <filip.konvicka@logis.cz>
* Samuel Gagnon <samuel.gagnon92@gmail.com>
*
* Copyright:
* Christian Schulte, 2002
* Guido Tack, 2003
* Mikael Lagerkvist, 2006
* LOGIS, s.r.o., 2009
* Samuel Gagnon, 2018
*
* Bugfixes provided by:
* Alexander Samoilov <alexander_samoilov@yahoo.com>
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <iostream>
namespace Gecode {
class Space;
typedef int ModEvent;
const ModEvent ME_GEN_FAILED = -1;
const ModEvent ME_GEN_NONE = 0;
const ModEvent ME_GEN_ASSIGNED = 1;
typedef int PropCond;
const PropCond PC_GEN_NONE = -1;
const PropCond PC_GEN_ASSIGNED = 0;
typedef int ModEventDelta;
}
#include <gecode/kernel/var-type.hpp>
namespace Gecode {
class NoIdxVarImpConf {
public:
static const int idx_c = -1;
static const int idx_d = -1;
static const PropCond pc_max = PC_GEN_ASSIGNED;
static const int free_bits = 0;
static const int med_fst = 0;
static const int med_lst = 0;
static const int med_mask = 0;
static Gecode::ModEvent me_combine(ModEvent me1, ModEvent me2);
static bool med_update(ModEventDelta& med, ModEvent me);
};
forceinline ModEvent
NoIdxVarImpConf::me_combine(ModEvent, ModEvent) {
GECODE_NEVER; return 0;
}
forceinline bool
NoIdxVarImpConf::med_update(ModEventDelta&, ModEvent) {
GECODE_NEVER; return false;
}
/*
* These are the classes of interest
*
*/
class ActorLink;
class Actor;
class Propagator;
class SubscribedPropagators;
class LocalObject;
class Advisor;
class AFC;
class Choice;
class Brancher;
class Group;
class PropagatorGroup;
class BrancherGroup;
class PostInfo;
class ViewTraceInfo;
class PropagateTraceInfo;
class CommitTraceInfo;
class PostTraceInfo;
class TraceRecorder;
class TraceFilter;
class Tracer;
template<class A> class Council;
template<class A> class Advisors;
template<class VIC> class VarImp;
/*
* Variable implementations
*
*/
class VarImpBase {};
class GECODE_VTABLE_EXPORT VarImpDisposerBase {
public:
GECODE_KERNEL_EXPORT virtual void dispose(Space& home, VarImpBase* x);
GECODE_KERNEL_EXPORT virtual ~VarImpDisposerBase(void);
};
template<class VarImp>
class VarImpDisposer : public VarImpDisposerBase {
public:
VarImpDisposer(void);
virtual void dispose(Space& home, VarImpBase* x);
};
class Delta {
template<class VIC> friend class VarImp;
private:
ModEvent me;
};
template<class VIC>
class VarImp : public VarImpBase {
friend class Space;
friend class Propagator;
template<class VarImp> friend class VarImpDisposer;
friend class SubscribedPropagators;
private:
union {
ActorLink** base;
VarImp<VIC>* fwd;
} b;
static const int idx_c = VIC::idx_c;
static const int idx_d = VIC::idx_d;
static const int free_bits = VIC::free_bits;
unsigned int entries;
unsigned int free_and_bits;
static const Gecode::PropCond pc_max = VIC::pc_max;
#ifdef GECODE_HAS_CBS
const unsigned var_id;
#endif
union {
unsigned int idx[pc_max+1];
VarImp<VIC>* next;
} u;
ActorLink** actor(PropCond pc);
ActorLink** actorNonZero(PropCond pc);
unsigned int& idx(PropCond pc);
unsigned int idx(PropCond pc) const;
void update(VarImp* x, ActorLink**& sub);
static void update(Space& home, ActorLink**& sub);
void enter(Space& home, Propagator* p, PropCond pc);
void enter(Space& home, Advisor* a);
void resize(Space& home);
void remove(Space& home, Propagator* p, PropCond pc);
void remove(Space& home, Advisor* a);
protected:
void cancel(Space& home);
bool advise(Space& home, ModEvent me, Delta& d);
private:
void _fail(Space& home);
protected:
ModEvent fail(Space& home);
#ifdef GECODE_HAS_VAR_DISPOSE
static VarImp<VIC>* vars_d(Space& home);
static void vars_d(Space& home, VarImp<VIC>* x);
#endif
public:
VarImp(Space& home);
VarImp(void);
#ifdef GECODE_HAS_CBS
unsigned int id(void) const;
#endif
void subscribe(Space& home, Propagator& p, PropCond pc,
bool assigned, ModEvent me, bool schedule);
void cancel(Space& home, Propagator& p, PropCond pc);
void subscribe(Space& home, Advisor& a, bool assigned, bool fail);
void cancel(Space& home, Advisor& a, bool fail);
unsigned int degree(void) const;
double afc(void) const;
VarImp(Space& home, VarImp& x);
bool copied(void) const;
VarImp* forward(void) const;
VarImp* next(void) const;
static void schedule(Space& home, Propagator& p, ModEvent me,
bool force = false);
static void reschedule(Space& home, Propagator& p, PropCond pc,
bool assigned, ModEvent me);
static ModEvent me(const ModEventDelta& med);
static ModEventDelta med(ModEvent me);
static ModEvent me_combine(ModEvent me1, ModEvent me2);
static ModEvent modevent(const Delta& d);
unsigned int bits(void) const;
unsigned int& bits(void);
protected:
void schedule(Space& home, PropCond pc1, PropCond pc2, ModEvent me);
public:
static void* operator new(size_t,Space&);
static void operator delete(void*,Space&);
static void operator delete(void*);
};
enum ExecStatus {
__ES_SUBSUMED = -2,
ES_FAILED = -1,
ES_NOFIX = 0,
ES_OK = 0,
ES_FIX = 1,
ES_NOFIX_FORCE = 2,
__ES_PARTIAL = 2
};
class PropCost {
friend class Space;
public:
enum ActualCost {
AC_RECORD = 0,
AC_CRAZY_LO = 1,
AC_CRAZY_HI = 1,
AC_CUBIC_LO = 1,
AC_CUBIC_HI = 1,
AC_QUADRATIC_LO = 2,
AC_QUADRATIC_HI = 2,
AC_LINEAR_HI = 3,
AC_LINEAR_LO = 4,
AC_TERNARY_HI = 4,
AC_BINARY_HI = 5,
AC_TERNARY_LO = 5,
AC_BINARY_LO = 6,
AC_UNARY_LO = 6,
AC_UNARY_HI = 6,
AC_MAX = 6
};
ActualCost ac;
public:
enum Mod {
LO,
HI
};
private:
static PropCost cost(Mod m, ActualCost lo, ActualCost hi, unsigned int n);
PropCost(ActualCost ac);
public:
static PropCost record(void);
static PropCost crazy(PropCost::Mod m, unsigned int n);
static PropCost crazy(PropCost::Mod m, int n);
static PropCost cubic(PropCost::Mod m, unsigned int n);
static PropCost cubic(PropCost::Mod m, int n);
static PropCost quadratic(PropCost::Mod m, unsigned int n);
static PropCost quadratic(PropCost::Mod m, int n);
static PropCost linear(PropCost::Mod m, unsigned int n);
static PropCost linear(PropCost::Mod m, int n);
static PropCost ternary(PropCost::Mod m);
static PropCost binary(PropCost::Mod m);
static PropCost unary(PropCost::Mod m);
};
enum ActorProperty {
AP_DISPOSE = (1 << 0),
AP_WEAKLY = (1 << 1),
AP_VIEW_TRACE = (1 << 2),
AP_TRACE = (1 << 3)
};
class ActorLink {
friend class Actor;
friend class Propagator;
friend class Advisor;
friend class Brancher;
friend class LocalObject;
friend class Space;
template<class VIC> friend class VarImp;
private:
ActorLink* _next; ActorLink* _prev;
public:
ActorLink* prev(void) const; void prev(ActorLink*);
ActorLink* next(void) const; void next(ActorLink*);
ActorLink** next_ref(void);
void init(void);
void unlink(void);
void head(ActorLink* al);
void tail(ActorLink* al);
bool empty(void) const;
template<class T> static ActorLink* cast(T* a);
template<class T> static const ActorLink* cast(const T* a);
};
class GECODE_VTABLE_EXPORT Actor : private ActorLink {
friend class ActorLink;
friend class Space;
friend class Propagator;
friend class Advisor;
friend class Brancher;
friend class LocalObject;
template<class VIC> friend class VarImp;
template<class A> friend class Council;
private:
static Actor* cast(ActorLink* al);
static const Actor* cast(const ActorLink* al);
GECODE_KERNEL_EXPORT static Actor* sentinel;
public:
virtual Actor* copy(Space& home) = 0;
GECODE_KERNEL_EXPORT
virtual size_t dispose(Space& home);
static void* operator new(size_t s, Space& home);
static void operator delete(void* p, Space& home);
public:
GECODE_KERNEL_EXPORT virtual ~Actor(void);
static void* operator new(size_t s);
static void operator delete(void* p);
};
class Home;
class Group {
friend class Home;
friend class Propagator;
friend class Brancher;
friend class ViewTraceInfo;
friend class PropagateTraceInfo;
friend class CommitTraceInfo;
friend class PostTraceInfo;
protected:
static const unsigned int GROUPID_ALL = 0U;
static const unsigned int GROUPID_DEF = 1U;
static const unsigned int GROUPID_MAX = UINT_MAX >> 2;
unsigned int gid;
GECODE_KERNEL_EXPORT
static unsigned int next;
GECODE_KERNEL_EXPORT
static Support::Mutex m;
Group(unsigned int gid0);
public:
GECODE_KERNEL_EXPORT
Group(void);
Group(const Group& g);
Group& operator =(const Group& g);
unsigned int id(void) const;
bool in(Group a) const;
bool in(void) const;
GECODE_KERNEL_EXPORT
static Group all;
GECODE_KERNEL_EXPORT
static Group def;
};
class PropagatorGroup : public Group {
friend class Propagator;
friend class ViewTraceInfo;
friend class PropagateTraceInfo;
friend class PostTraceInfo;
protected:
PropagatorGroup(unsigned int gid);
public:
PropagatorGroup(void);
PropagatorGroup(const PropagatorGroup& g);
PropagatorGroup& operator =(const PropagatorGroup& g);
Home operator ()(Space& home);
GECODE_KERNEL_EXPORT
PropagatorGroup& move(Space& home, PropagatorGroup g);
PropagatorGroup& move(Space& home, Propagator& p);
GECODE_KERNEL_EXPORT
PropagatorGroup& move(Space& home, unsigned int id);
bool operator ==(PropagatorGroup g) const;
bool operator !=(PropagatorGroup g) const;
GECODE_KERNEL_EXPORT
unsigned int size(Space& home) const;
GECODE_KERNEL_EXPORT
void kill(Space& home);
GECODE_KERNEL_EXPORT
void disable(Space& home);
GECODE_KERNEL_EXPORT
void enable(Space& home, bool s=true);
GECODE_KERNEL_EXPORT
static PropagatorGroup all;
GECODE_KERNEL_EXPORT
static PropagatorGroup def;
};
class BrancherGroup : public Group {
friend class Brancher;
protected:
BrancherGroup(unsigned int gid);
public:
BrancherGroup(void);
BrancherGroup(const BrancherGroup& g);
BrancherGroup& operator =(const BrancherGroup& g);
Home operator ()(Space& home);
GECODE_KERNEL_EXPORT
BrancherGroup& move(Space& home, BrancherGroup g);
BrancherGroup& move(Space& home, Brancher& b);
GECODE_KERNEL_EXPORT
BrancherGroup& move(Space& home, unsigned int id);
bool operator ==(BrancherGroup g) const;
bool operator !=(BrancherGroup g) const;
GECODE_KERNEL_EXPORT
unsigned int size(Space& home) const;
GECODE_KERNEL_EXPORT
void kill(Space& home);
GECODE_KERNEL_EXPORT
static BrancherGroup all;
GECODE_KERNEL_EXPORT
static BrancherGroup def;
};
class Home {
friend class PostInfo;
protected:
Space& s;
Propagator* p;
PropagatorGroup pg;
BrancherGroup bg;
public:
Home(Space& s, Propagator* p=NULL,
PropagatorGroup pg=PropagatorGroup::def,
BrancherGroup bg=BrancherGroup::def);
Home& operator =(const Home& h);
operator Space&(void);
Home operator ()(Propagator& p);
Home operator ()(PropagatorGroup pg);
Home operator ()(BrancherGroup bg);
Propagator* propagator(void) const;
PropagatorGroup propagatorgroup(void) const;
BrancherGroup branchergroup(void) const;
bool failed(void) const;
void fail(void);
void notice(Actor& a, ActorProperty p, bool duplicate=false);
};
class ViewTraceInfo {
friend class Space;
friend class PostInfo;
public:
enum What {
PROPAGATOR = 0,
BRANCHER = 1,
POST = 2,
OTHER = 3
};
protected:
ptrdiff_t who;
void propagator(Propagator& p);
void brancher(Brancher& b);
void post(PropagatorGroup g);
void other(void);
public:
What what(void) const;
const Propagator& propagator(void) const;
const Brancher& brancher(void) const;
PropagatorGroup post(void) const;
};
class PostInfo {
friend class Space;
protected:
Space& h;
PropagatorGroup pg;
unsigned int pid;
bool nested;
public:
PostInfo(Home home);
~PostInfo(void);
};
class PropagateTraceInfo {
friend class Space;
public:
enum Status {
FIX,
NOFIX,
FAILED,
SUBSUMED
};
protected:
unsigned int i;
PropagatorGroup g;
const Propagator* p;
Status s;
PropagateTraceInfo(unsigned int i, PropagatorGroup g,
const Propagator* p, Status s);
public:
unsigned int id(void) const;
PropagatorGroup group(void) const;
const Propagator* propagator(void) const;
Status status(void) const;
};
class CommitTraceInfo {
friend class Space;
protected:
const Brancher& b;
const Choice& c;
unsigned int a;
CommitTraceInfo(const Brancher& b, const Choice& c, unsigned int a);
public:
unsigned int id(void) const;
BrancherGroup group(void) const;
const Brancher& brancher(void) const;
const Choice& choice(void) const;
unsigned int alternative(void) const;
};
class PostTraceInfo {
friend class Space;
friend class PostInfo;
public:
enum Status {
POSTED,
FAILED,
SUBSUMED
};
protected:
PropagatorGroup g;
Status s;
unsigned int n;
PostTraceInfo(PropagatorGroup g, Status s, unsigned int n);
public:
Status status(void) const;
PropagatorGroup group(void) const;
unsigned int propagators(void) const;
};
class GECODE_VTABLE_EXPORT Propagator : public Actor {
friend class ActorLink;
friend class Space;
template<class VIC> friend class VarImp;
friend class Advisor;
template<class A> friend class Council;
friend class SubscribedPropagators;
friend class PropagatorGroup;
private:
union {
ModEventDelta med;
size_t size;
Gecode::ActorLink* advisors;
} u;
void* gpi_disabled;
static Propagator* cast(ActorLink* al);
static const Propagator* cast(const ActorLink* al);
void disable(Space& home);
void enable(Space& home);
protected:
Propagator(Home home);
Propagator(Space& home, Propagator& p);
Propagator* fwd(void) const;
Kernel::GPI::Info& gpi(void);
public:
virtual void reschedule(Space& home) = 0;
virtual ExecStatus propagate(Space& home, const ModEventDelta& med) = 0;
virtual PropCost cost(const Space& home, const ModEventDelta& med) const = 0;
ModEventDelta modeventdelta(void) const;
GECODE_KERNEL_EXPORT
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
GECODE_KERNEL_EXPORT
virtual void advise(Space& home, Advisor& a);
double afc(void) const;
#ifdef GECODE_HAS_CBS
typedef std::function<void(unsigned int prop_id, unsigned int var_id,
int val, double dens)> SendMarginal;
virtual void solndistrib(Space& home, SendMarginal send) const;
typedef std::function<bool(unsigned int var_id)> InDecision;
virtual void domainsizesum(InDecision in, unsigned int& size,
unsigned int& size_b) const;
#endif
unsigned int id(void) const;
PropagatorGroup group(void) const;
void group(PropagatorGroup g);
bool disabled(void) const;
};
template<class A>
class Council {
friend class Advisor;
friend class Advisors<A>;
private:
mutable ActorLink* advisors;
public:
Council(void);
Council(Space& home);
bool empty(void) const;
void update(Space& home, Council<A>& c);
void dispose(Space& home);
};
template<class A>
class Advisors {
private:
ActorLink* a;
public:
Advisors(const Council<A>& c);
bool operator ()(void) const;
void operator ++(void);
A& advisor(void) const;
};
class Advisor : private ActorLink {
template<class VIC> friend class VarImp;
template<class A> friend class Council;
template<class A> friend class Advisors;
friend class SubscribedPropagators;
private:
bool disposed(void) const;
static Advisor* cast(ActorLink* al);
static const Advisor* cast(const ActorLink* al);
protected:
Propagator& propagator(void) const;
public:
template<class A>
Advisor(Space& home, Propagator& p, Council<A>& c);
Advisor(Space& home, Advisor& a);
const ViewTraceInfo& operator ()(const Space& home) const;
template<class A>
void dispose(Space& home, Council<A>& c);
static void* operator new(size_t s, Space& home);
static void operator delete(void* p, Space& home);
private:
#ifndef __GNUC__
static void operator delete(void* p);
#endif
static void* operator new(size_t s);
};
class GECODE_VTABLE_EXPORT NGL {
private:
void* nl;
public:
enum Status {
FAILED,
SUBSUMED,
NONE
};
NGL(void);
NGL(Space& home);
NGL(Space& home, NGL& ngl);
virtual void subscribe(Space& home, Propagator& p) = 0;
virtual void cancel(Space& home, Propagator& p) = 0;
virtual void reschedule(Space& home, Propagator& p) = 0;
virtual NGL::Status status(const Space& home) const = 0;
virtual ExecStatus prune(Space& home) = 0;
virtual NGL* copy(Space& home) = 0;
GECODE_KERNEL_EXPORT
virtual bool notice(void) const;
virtual size_t dispose(Space& home);
bool leaf(void) const;
NGL* next(void) const;
void leaf(bool l);
void next(NGL* n);
NGL* add(NGL* n, bool l);
static void* operator new(size_t s, Space& home);
static void operator delete(void* s, Space& home);
static void operator delete(void* p);
public:
GECODE_KERNEL_EXPORT virtual ~NGL(void);
static void* operator new(size_t s);
};
class GECODE_VTABLE_EXPORT Choice : public HeapAllocated {
friend class Space;
private:
unsigned int bid;
unsigned int alt;
unsigned int id(void) const;
protected:
Choice(const Brancher& b, const unsigned int a);
public:
unsigned int alternatives(void) const;
GECODE_KERNEL_EXPORT virtual ~Choice(void);
GECODE_KERNEL_EXPORT
virtual void archive(Archive& e) const;
};
class GECODE_VTABLE_EXPORT Brancher : public Actor {
friend class ActorLink;
friend class Space;
friend class Choice;
private:
unsigned int bid;
unsigned int gid;
static Brancher* cast(ActorLink* al);
static const Brancher* cast(const ActorLink* al);
protected:
Brancher(Home home);
Brancher(Space& home, Brancher& b);
public:
virtual bool status(const Space& home) const = 0;
virtual const Choice* choice(Space& home) = 0;
virtual const Choice* choice(const Space& home, Archive& e) = 0;
virtual ExecStatus commit(Space& home, const Choice& c,
unsigned int a) = 0;
GECODE_KERNEL_EXPORT
virtual NGL* ngl(Space& home, const Choice& c, unsigned int a) const;
GECODE_KERNEL_EXPORT
virtual void print(const Space& home, const Choice& c, unsigned int a,
std::ostream& o) const;
unsigned int id(void) const;
BrancherGroup group(void) const;
void group(BrancherGroup g);
};
class LocalObject : public Actor {
friend class ActorLink;
friend class Space;
friend class LocalHandle;
protected:
LocalObject(Home home);
LocalObject(Space& home, LocalObject& l);
static LocalObject* cast(ActorLink* al);
static const LocalObject* cast(const ActorLink* al);
private:
GECODE_KERNEL_EXPORT void fwdcopy(Space& home);
public:
LocalObject* fwd(Space& home);
};
class LocalHandle {
private:
LocalObject* o;
protected:
LocalHandle(void);
LocalHandle(LocalObject* lo);
LocalHandle(const LocalHandle& lh);
public:
LocalHandle& operator =(const LocalHandle& lh);
void update(Space& home, LocalHandle& lh);
~LocalHandle(void);
protected:
LocalObject* object(void) const;
void object(LocalObject* n);
};
class GECODE_VTABLE_EXPORT NoGoods {
protected:
unsigned long int n;
public:
NoGoods(void);
GECODE_KERNEL_EXPORT
virtual void post(Space& home) const;
unsigned long int ng(void) const;
void ng(unsigned long int n);
virtual ~NoGoods(void);
GECODE_KERNEL_EXPORT
static NoGoods eng;
};
class GECODE_VTABLE_EXPORT MetaInfo {
public:
enum Type {
RESTART,
PORTFOLIO
};
protected:
const Type t;
const unsigned long int r;
const unsigned long int s;
const unsigned long int f;
const Space* l;
const NoGoods& ng;
const unsigned int a;
public:
MetaInfo(unsigned long int r,
unsigned long int s,
unsigned long int f,
const Space* l,
NoGoods& ng);
MetaInfo(unsigned int a);
Type type(void) const;
unsigned long int restart(void) const;
unsigned long int solution(void) const;
unsigned long int fail(void) const;
const Space* last(void) const;
const NoGoods& nogoods(void) const;
unsigned int asset(void) const;
};
enum SpaceStatus {
SS_FAILED,
SS_SOLVED,
SS_BRANCH
};
class StatusStatistics {
public:
unsigned long int propagate;
StatusStatistics(void);
void reset(void);
StatusStatistics operator +(const StatusStatistics& s);
StatusStatistics& operator +=(const StatusStatistics& s);
};
class CloneStatistics {
public:
CloneStatistics(void);
void reset(void);
CloneStatistics operator +(const CloneStatistics& s);
CloneStatistics& operator +=(const CloneStatistics& s);
};
class CommitStatistics {
public:
CommitStatistics(void);
void reset(void);
CommitStatistics operator +(const CommitStatistics& s);
CommitStatistics& operator +=(const CommitStatistics& s);
};
class GECODE_VTABLE_EXPORT Space : public HeapAllocated {
friend class Actor;
friend class Propagator;
friend class PropagatorGroup;
friend class Propagators;
friend class Brancher;
friend class BrancherGroup;
friend class Branchers;
friend class Advisor;
template <class A> friend class Council;
template<class VIC> friend class VarImp;
template<class VarImp> friend class VarImpDisposer;
friend class LocalObject;
friend class Region;
friend class AFC;
friend class PostInfo;
friend GECODE_KERNEL_EXPORT
void trace(Home home, TraceFilter tf, int te, Tracer& t);
private:
Kernel::SharedSpaceData ssd;
Kernel::MemoryManager mm;
#ifdef GECODE_HAS_CBS
unsigned int var_id_counter;
#endif
ActorLink pl;
ActorLink bl;
Brancher* b_status;
Brancher* b_commit;
Brancher* brancher(unsigned int id);
void kill(Brancher& b);
void kill(Propagator& p);
GECODE_KERNEL_EXPORT
void kill_brancher(unsigned int id);
static const unsigned reserved_bid = 0U;
static const unsigned int sc_bits = 2;
static const unsigned int sc_fast = 0;
static const unsigned int sc_disabled = 1;
static const unsigned int sc_trace = 2;
union {
struct {
ActorLink* active;
ActorLink queue[PropCost::AC_MAX+1];
unsigned int bid_sc;
unsigned int n_sub;
ViewTraceInfo vti;
} p;
struct {
VarImpBase* vars_u[AllVarConf::idx_c];
VarImpBase* vars_noidx;
LocalObject* local;
} c;
} pc;
void enqueue(Propagator* p);
#ifdef GECODE_HAS_VAR_DISPOSE
GECODE_KERNEL_EXPORT static VarImpDisposerBase* vd[AllVarConf::idx_d];
VarImpBase* _vars_d[AllVarConf::idx_d];
template<class VIC> VarImpBase* vars_d(void) const;
template<class VIC> void vars_d(VarImpBase* x);
#endif
void update(ActorLink** sub);
Actor** d_fst;
Actor** d_cur;
Actor** d_lst;
GECODE_KERNEL_EXPORT static StatusStatistics unused_status;
GECODE_KERNEL_EXPORT static CloneStatistics unused_clone;
GECODE_KERNEL_EXPORT static CommitStatistics unused_commit;
GECODE_KERNEL_EXPORT Space* _clone(void);
GECODE_KERNEL_EXPORT
void _commit(const Choice& c, unsigned int a);
GECODE_KERNEL_EXPORT
void _trycommit(const Choice& c, unsigned int a);
GECODE_KERNEL_EXPORT
TraceRecorder* findtracerecorder(void);
GECODE_KERNEL_EXPORT
void post(const PostInfo& pi);
GECODE_KERNEL_EXPORT
void ap_notice_dispose(Actor* a, bool d);
GECODE_KERNEL_EXPORT
void ap_ignore_dispose(Actor* a, bool d);
public:
GECODE_KERNEL_EXPORT
Space(void);
GECODE_KERNEL_EXPORT
Space(Space& s);
GECODE_KERNEL_EXPORT
virtual ~Space(void);
virtual Space* copy(void) = 0;
GECODE_KERNEL_EXPORT virtual void constrain(const Space& best);
GECODE_KERNEL_EXPORT
virtual bool master(const MetaInfo& mi);
GECODE_KERNEL_EXPORT
virtual bool slave(const MetaInfo& mi);
/*
* Member functions for search engines
*
*/
GECODE_KERNEL_EXPORT
SpaceStatus status(StatusStatistics& stat=unused_status);
GECODE_KERNEL_EXPORT
const Choice* choice(void);
GECODE_KERNEL_EXPORT
const Choice* choice(Archive& e) const;
Space* clone(CloneStatistics& stat=unused_clone) const;
void commit(const Choice& c, unsigned int a,
CommitStatistics& stat=unused_commit);
void trycommit(const Choice& c, unsigned int a,
CommitStatistics& stat=unused_commit);
GECODE_KERNEL_EXPORT
NGL* ngl(const Choice& c, unsigned int a);
GECODE_KERNEL_EXPORT
void print(const Choice& c, unsigned int a, std::ostream& o) const;
GECODE_KERNEL_EXPORT
void notice(Actor& a, ActorProperty p, bool duplicate=false);
GECODE_KERNEL_EXPORT
void ignore(Actor& a, ActorProperty p, bool duplicate=false);
ExecStatus ES_SUBSUMED(Propagator& p);
ExecStatus ES_SUBSUMED_DISPOSED(Propagator& p, size_t s);
ExecStatus ES_FIX_PARTIAL(Propagator& p, const ModEventDelta& med);
ExecStatus ES_NOFIX_PARTIAL(Propagator& p, const ModEventDelta& med);
template<class A>
ExecStatus ES_FIX_DISPOSE(Council<A>& c, A& a);
template<class A>
ExecStatus ES_NOFIX_DISPOSE(Council<A>& c, A& a);
template<class A>
ExecStatus ES_NOFIX_DISPOSE_FORCE(Council<A>& c, A& a);
void fail(void);
bool failed(void) const;
bool stable(void) const;
Home operator ()(Propagator& p);
Home operator ()(PropagatorGroup pg);
Home operator ()(BrancherGroup bg);
template<class T>
T* alloc(long unsigned int n);
template<class T>
T* alloc(long int n);
template<class T>
T* alloc(unsigned int n);
template<class T>
T* alloc(int n);
template<class T>
void free(T* b, long unsigned int n);
template<class T>
void free(T* b, long int n);
template<class T>
void free(T* b, unsigned int n);
template<class T>
void free(T* b, int n);
template<class T>
T* realloc(T* b, long unsigned int n, long unsigned int m);
template<class T>
T* realloc(T* b, long int n, long int m);
template<class T>
T* realloc(T* b, unsigned int n, unsigned int m);
template<class T>
T* realloc(T* b, int n, int m);
template<class T>
T** realloc(T** b, long unsigned int n, long unsigned int m);
template<class T>
T** realloc(T** b, long int n, long int m);
template<class T>
T** realloc(T** b, unsigned int n, unsigned int m);
template<class T>
T** realloc(T** b, int n, int m);
void* ralloc(size_t s);
void rfree(void* p, size_t s);
void* rrealloc(void* b, size_t n, size_t m);
template<size_t> void* fl_alloc(void);
template<size_t> void fl_dispose(FreeList* f, FreeList* l);
template<class T>
T& construct(void);
template<class T, typename A1>
T& construct(A1 const& a1);
template<class T, typename A1, typename A2>
T& construct(A1 const& a1, A2 const& a2);
template<class T, typename A1, typename A2, typename A3>
T& construct(A1 const& a1, A2 const& a2, A3 const& a3);
template<class T, typename A1, typename A2, typename A3, typename A4>
T& construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4);
template<class T, typename A1, typename A2, typename A3, typename A4, typename A5>
T& construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5);
void afc_decay(double d);
double afc_decay(void) const;
GECODE_KERNEL_EXPORT void afc_unshare(void);
protected:
class Propagators {
private:
Space& home;
ActorLink* q;
ActorLink* c;
ActorLink* e;
public:
Propagators(Space& home);
bool operator ()(void) const;
void operator ++(void);
Propagator& propagator(void) const;
};
class ScheduledPropagators {
private:
Space& home;
ActorLink* q;
ActorLink* c;
ActorLink* e;
public:
ScheduledPropagators(Space& home);
bool operator ()(void) const;
void operator ++(void);
Propagator& propagator(void) const;
};
class IdlePropagators {
private:
ActorLink* c;
ActorLink* e;
public:
IdlePropagators(Space& home);
bool operator ()(void) const;
void operator ++(void);
Propagator& propagator(void) const;
};
class Branchers {
private:
ActorLink* c;
ActorLink* e;
public:
Branchers(Space& home);
bool operator ()(void) const;
void operator ++(void);
Brancher& brancher(void) const;
};
};
class Propagators {
private:
Space::Propagators ps;
PropagatorGroup g;
public:
Propagators(const Space& home, PropagatorGroup g);
bool operator ()(void) const;
void operator ++(void);
const Propagator& propagator(void) const;
};
class Branchers {
private:
Space::Branchers bs;
BrancherGroup g;
public:
Branchers(const Space& home, BrancherGroup g);
bool operator ()(void) const;
void operator ++(void);
const Brancher& brancher(void) const;
};
/*
* Memory management
*
*/
// Space allocation: general space heaps and free lists
forceinline void*
Space::ralloc(size_t s) {
return mm.alloc(ssd.data().sm,s);
}
forceinline void
Space::rfree(void* p, size_t s) {
return mm.reuse(p,s);
}
forceinline void*
Space::rrealloc(void* _b, size_t n, size_t m) {
char* b = static_cast<char*>(_b);
if (n < m) {
char* p = static_cast<char*>(ralloc(m));
memcpy(p,b,n);
rfree(b,n);
return p;
} else {
rfree(b+m,m-n);
return b;
}
}
template<size_t s>
forceinline void*
Space::fl_alloc(void) {
return mm.template fl_alloc<s>(ssd.data().sm);
}
template<size_t s>
forceinline void
Space::fl_dispose(FreeList* f, FreeList* l) {
mm.template fl_dispose<s>(f,l);
}
/*
* Typed allocation routines
*
*/
template<class T>
forceinline T*
Space::alloc(long unsigned int n) {
T* p = static_cast<T*>(ralloc(sizeof(T)*n));
for (long unsigned int i=0; i<n; i++)
(void) new (p+i) T();
return p;
}
template<class T>
forceinline T*
Space::alloc(long int n) {
assert(n >= 0);
return alloc<T>(static_cast<long unsigned int>(n));
}
template<class T>
forceinline T*
Space::alloc(unsigned int n) {
return alloc<T>(static_cast<long unsigned int>(n));
}
template<class T>
forceinline T*
Space::alloc(int n) {
assert(n >= 0);
return alloc<T>(static_cast<long unsigned int>(n));
}
template<class T>
forceinline void
Space::free(T* b, long unsigned int n) {
for (long unsigned int i=0; i<n; i++)
b[i].~T();
rfree(b,n*sizeof(T));
}
template<class T>
forceinline void
Space::free(T* b, long int n) {
assert(n >= 0);
free<T>(b,static_cast<long unsigned int>(n));
}
template<class T>
forceinline void
Space::free(T* b, unsigned int n) {
free<T>(b,static_cast<long unsigned int>(n));
}
template<class T>
forceinline void
Space::free(T* b, int n) {
assert(n >= 0);
free<T>(b,static_cast<long unsigned int>(n));
}
template<class T>
forceinline T*
Space::realloc(T* b, long unsigned int n, long unsigned int m) {
if (n < m) {
T* p = static_cast<T*>(ralloc(sizeof(T)*m));
for (long unsigned int i=0; i<n; i++)
(void) new (p+i) T(b[i]);
for (long unsigned int i=n; i<m; i++)
(void) new (p+i) T();
free<T>(b,n);
return p;
} else {
free<T>(b+m,m-n);
return b;
}
}
template<class T>
forceinline T*
Space::realloc(T* b, long int n, long int m) {
assert((n >= 0) && (m >= 0));
return realloc<T>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
template<class T>
forceinline T*
Space::realloc(T* b, unsigned int n, unsigned int m) {
return realloc<T>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
template<class T>
forceinline T*
Space::realloc(T* b, int n, int m) {
assert((n >= 0) && (m >= 0));
return realloc<T>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
#define GECODE_KERNEL_REALLOC(T) \
template<> \
forceinline T* \
Space::realloc<T>(T* b, long unsigned int n, long unsigned int m) { \
return static_cast<T*>(rrealloc(b,n*sizeof(T),m*sizeof(T))); \
} \
template<> \
forceinline T* \
Space::realloc<T>(T* b, long int n, long int m) { \
assert((n >= 0) && (m >= 0)); \
return realloc<T>(b,static_cast<long unsigned int>(n), \
static_cast<long unsigned int>(m)); \
} \
template<> \
forceinline T* \
Space::realloc<T>(T* b, unsigned int n, unsigned int m) { \
return realloc<T>(b,static_cast<long unsigned int>(n), \
static_cast<long unsigned int>(m)); \
} \
template<> \
forceinline T* \
Space::realloc<T>(T* b, int n, int m) { \
assert((n >= 0) && (m >= 0)); \
return realloc<T>(b,static_cast<long unsigned int>(n), \
static_cast<long unsigned int>(m)); \
}
GECODE_KERNEL_REALLOC(bool)
GECODE_KERNEL_REALLOC(signed char)
GECODE_KERNEL_REALLOC(unsigned char)
GECODE_KERNEL_REALLOC(signed short int)
GECODE_KERNEL_REALLOC(unsigned short int)
GECODE_KERNEL_REALLOC(signed int)
GECODE_KERNEL_REALLOC(unsigned int)
GECODE_KERNEL_REALLOC(signed long int)
GECODE_KERNEL_REALLOC(unsigned long int)
GECODE_KERNEL_REALLOC(float)
GECODE_KERNEL_REALLOC(double)
#undef GECODE_KERNEL_REALLOC
template<class T>
forceinline T**
Space::realloc(T** b, long unsigned int n, long unsigned int m) {
return static_cast<T**>(rrealloc(b,n*sizeof(T),m*sizeof(T*)));
}
template<class T>
forceinline T**
Space::realloc(T** b, long int n, long int m) {
assert((n >= 0) && (m >= 0));
return realloc<T*>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
template<class T>
forceinline T**
Space::realloc(T** b, unsigned int n, unsigned int m) {
return realloc<T*>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
template<class T>
forceinline T**
Space::realloc(T** b, int n, int m) {
assert((n >= 0) && (m >= 0));
return realloc<T*>(b,static_cast<long unsigned int>(n),
static_cast<long unsigned int>(m));
}
#ifdef GECODE_HAS_VAR_DISPOSE
template<class VIC>
forceinline VarImpBase*
Space::vars_d(void) const {
return _vars_d[VIC::idx_d];
}
template<class VIC>
forceinline void
Space::vars_d(VarImpBase* x) {
_vars_d[VIC::idx_d] = x;
}
#endif
// Space allocated entities: Actors, variable implementations, and advisors
forceinline void
Actor::operator delete(void*) {}
forceinline void
Actor::operator delete(void*, Space&) {}
forceinline void*
Actor::operator new(size_t s, Space& home) {
return home.ralloc(s);
}
template<class VIC>
forceinline void
VarImp<VIC>::operator delete(void*) {}
template<class VIC>
forceinline void
VarImp<VIC>::operator delete(void*, Space&) {}
template<class VIC>
forceinline void*
VarImp<VIC>::operator new(size_t s, Space& home) {
return home.ralloc(s);
}
#ifndef __GNUC__
forceinline void
Advisor::operator delete(void*) {}
#endif
forceinline void
Advisor::operator delete(void*, Space&) {}
forceinline void*
Advisor::operator new(size_t s, Space& home) {
return home.ralloc(s);
}
forceinline void
NGL::operator delete(void*) {}
forceinline void
NGL::operator delete(void*, Space&) {}
forceinline void*
NGL::operator new(size_t s, Space& home) {
return home.ralloc(s);
}
/*
* No-goods
*
*/
forceinline
NoGoods::NoGoods(void)
: n(0) {}
forceinline unsigned long int
NoGoods::ng(void) const {
return n;
}
forceinline void
NoGoods::ng(unsigned long int n0) {
n=n0;
}
forceinline
NoGoods::~NoGoods(void) {}
/*
* Information from meta search engines
*/
forceinline
MetaInfo::MetaInfo(unsigned long int r0,
unsigned long int s0,
unsigned long int f0,
const Space* l0,
NoGoods& ng0)
: t(RESTART), r(r0), s(s0), f(f0), l(l0), ng(ng0), a(0) {}
forceinline
MetaInfo::MetaInfo(unsigned int a0)
: t(PORTFOLIO), r(0), s(0), f(0), l(NULL), ng(NoGoods::eng), a(a0) {}
forceinline MetaInfo::Type
MetaInfo::type(void) const {
return t;
}
forceinline unsigned long int
MetaInfo::restart(void) const {
assert(type() == RESTART);
return r;
}
forceinline unsigned long int
MetaInfo::solution(void) const {
assert(type() == RESTART);
return s;
}
forceinline unsigned long int
MetaInfo::fail(void) const {
assert(type() == RESTART);
return f;
}
forceinline const Space*
MetaInfo::last(void) const {
assert(type() == RESTART);
return l;
}
forceinline const NoGoods&
MetaInfo::nogoods(void) const {
assert(type() == RESTART);
return ng;
}
forceinline unsigned int
MetaInfo::asset(void) const {
assert(type() == PORTFOLIO);
return a;
}
/*
* ActorLink
*
*/
forceinline ActorLink*
ActorLink::prev(void) const {
return _prev;
}
forceinline ActorLink*
ActorLink::next(void) const {
return _next;
}
forceinline ActorLink**
ActorLink::next_ref(void) {
return &_next;
}
forceinline void
ActorLink::prev(ActorLink* al) {
_prev = al;
}
forceinline void
ActorLink::next(ActorLink* al) {
_next = al;
}
forceinline void
ActorLink::unlink(void) {
ActorLink* p = _prev; ActorLink* n = _next;
p->_next = n; n->_prev = p;
}
forceinline void
ActorLink::init(void) {
_next = this; _prev =this;
}
forceinline void
ActorLink::head(ActorLink* a) {
// Inserts al at head of link-chain (that is, after this)
ActorLink* n = _next;
this->_next = a; a->_prev = this;
a->_next = n; n->_prev = a;
}
forceinline void
ActorLink::tail(ActorLink* a) {
// Inserts al at tail of link-chain (that is, before this)
ActorLink* p = _prev;
a->_next = this; this->_prev = a;
p->_next = a; a->_prev = p;
}
forceinline bool
ActorLink::empty(void) const {
return _next == this;
}
template<class T>
forceinline ActorLink*
ActorLink::cast(T* a) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(a);
ActorLink& t = *a;
return static_cast<ActorLink*>(&t);
}
template<class T>
forceinline const ActorLink*
ActorLink::cast(const T* a) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(a);
const ActorLink& t = *a;
return static_cast<const ActorLink*>(&t);
}
/*
* Actor
*
*/
forceinline Actor*
Actor::cast(ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
ActorLink& t = *al;
return static_cast<Actor*>(&t);
}
forceinline const Actor*
Actor::cast(const ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
const ActorLink& t = *al;
return static_cast<const Actor*>(&t);
}
forceinline void
Home::notice(Actor& a, ActorProperty p, bool duplicate) {
s.notice(a,p,duplicate);
}
forceinline Space*
Space::clone(CloneStatistics&) const {
// Clone is only const for search engines. During cloning, several data
// structures are updated (e.g. forwarding pointers), so we have to
// cast away the constness.
return const_cast<Space*>(this)->_clone();
}
forceinline void
Space::commit(const Choice& c, unsigned int a, CommitStatistics&) {
_commit(c,a);
}
forceinline void
Space::trycommit(const Choice& c, unsigned int a, CommitStatistics&) {
_trycommit(c,a);
}
forceinline double
Space::afc_decay(void) const {
return ssd.data().gpi.decay();
}
forceinline void
Space::afc_decay(double d) {
ssd.data().gpi.decay(d);
}
forceinline size_t
Actor::dispose(Space&) {
return sizeof(*this);
}
/*
* Home for posting actors
*
*/
forceinline
Home::Home(Space& s0, Propagator* p0,
PropagatorGroup pg0, BrancherGroup bg0)
: s(s0), p(p0), pg(pg0), bg(bg0) {}
forceinline Home&
Home::operator =(const Home& h) {
s=h.s; p=h.p; pg=h.pg; bg=h.bg;
return *this;
}
forceinline
Home::operator Space&(void) {
return s;
}
forceinline Home
Home::operator ()(Propagator& p) {
return Home(s,&p);
}
forceinline Home
Home::operator ()(PropagatorGroup pg) {
return Home(s,NULL,pg,BrancherGroup::def);
}
forceinline Home
Home::operator ()(BrancherGroup bg) {
return Home(s,NULL,PropagatorGroup::def,bg);
}
forceinline Home
Space::operator ()(Propagator& p) {
return Home(*this,&p);
}
forceinline Home
Space::operator ()(PropagatorGroup pg) {
return Home(*this,NULL,pg,BrancherGroup::def);
}
forceinline Home
Space::operator ()(BrancherGroup bg) {
return Home(*this,NULL,PropagatorGroup::def,bg);
}
forceinline Propagator*
Home::propagator(void) const {
return p;
}
forceinline PropagatorGroup
Home::propagatorgroup(void) const {
return pg;
}
forceinline BrancherGroup
Home::branchergroup(void) const {
return bg;
}
/*
* View trace information
*
*/
forceinline void
ViewTraceInfo::propagator(Propagator& p) {
who = reinterpret_cast<ptrdiff_t>(&p) | PROPAGATOR;
}
forceinline void
ViewTraceInfo::brancher(Brancher& b) {
who = reinterpret_cast<ptrdiff_t>(&b) | BRANCHER;
}
forceinline void
ViewTraceInfo::post(PropagatorGroup g) {
who = (g.id() << 2) | POST;
}
forceinline void
ViewTraceInfo::other(void) {
who = OTHER;
}
forceinline ViewTraceInfo::What
ViewTraceInfo::what(void) const {
return static_cast<What>(who & 3);
}
forceinline const Propagator&
ViewTraceInfo::propagator(void) const {
assert(what() == PROPAGATOR);
// Because PROPAGATOR == 0
return *reinterpret_cast<Propagator*>(who);
}
forceinline const Brancher&
ViewTraceInfo::brancher(void) const {
assert(what() == BRANCHER);
return *reinterpret_cast<Brancher*>(who & ~3);
}
forceinline PropagatorGroup
ViewTraceInfo::post(void) const {
assert(what() == POST);
return PropagatorGroup(static_cast<unsigned int>(who >> 2));
}
/*
* Post information
*/
forceinline
PostInfo::PostInfo(Home home)
: h(home), pg(home.propagatorgroup()),
pid(h.ssd.data().gpi.pid()),
nested(h.pc.p.vti.what() != ViewTraceInfo::OTHER) {
h.pc.p.vti.post(pg);
}
forceinline
PostInfo::~PostInfo(void) {
if (!nested) {
if (h.pc.p.bid_sc & Space::sc_trace)
h.post(*this);
h.pc.p.vti.other();
}
}
/*
* Propagate trace information
*
*/
forceinline
PropagateTraceInfo::PropagateTraceInfo(unsigned int i0, PropagatorGroup g0,
const Propagator* p0, Status s0)
: i(i0), g(g0), p(p0), s(s0) {}
forceinline unsigned int
PropagateTraceInfo::id(void) const {
return i;
}
forceinline PropagatorGroup
PropagateTraceInfo::group(void) const {
return g;
}
forceinline const Propagator*
PropagateTraceInfo::propagator(void) const {
return p;
}
forceinline PropagateTraceInfo::Status
PropagateTraceInfo::status(void) const {
return s;
}
/*
* Commit trace information
*
*/
forceinline
CommitTraceInfo::CommitTraceInfo(const Brancher& b0, const Choice& c0,
unsigned int a0)
: b(b0), c(c0), a(a0) {}
forceinline unsigned int
CommitTraceInfo::id(void) const {
return b.id();
}
forceinline BrancherGroup
CommitTraceInfo::group(void) const {
return b.group();
}
forceinline const Brancher&
CommitTraceInfo::brancher(void) const {
return b;
}
forceinline const Choice&
CommitTraceInfo::choice(void) const {
return c;
}
forceinline unsigned int
CommitTraceInfo::alternative(void) const {
return a;
}
/*
* Post trace information
*
*/
forceinline
PostTraceInfo::PostTraceInfo(PropagatorGroup g0, Status s0, unsigned int n0)
: g(g0), s(s0), n(n0) {}
forceinline PropagatorGroup
PostTraceInfo::group(void) const {
return g;
}
forceinline PostTraceInfo::Status
PostTraceInfo::status(void) const {
return s;
}
forceinline unsigned int
PostTraceInfo::propagators(void) const {
return n;
}
/*
* Propagator
*
*/
forceinline Propagator*
Propagator::cast(ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
ActorLink& t = *al;
return static_cast<Propagator*>(&t);
}
forceinline const Propagator*
Propagator::cast(const ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
const ActorLink& t = *al;
return static_cast<const Propagator*>(&t);
}
forceinline Propagator*
Propagator::fwd(void) const {
return static_cast<Propagator*>(prev());
}
forceinline bool
Propagator::disabled(void) const {
return Support::marked(gpi_disabled);
}
forceinline void
Propagator::disable(Space& home) {
home.pc.p.bid_sc |= Space::sc_disabled;
gpi_disabled = Support::fmark(gpi_disabled);
}
forceinline void
Propagator::enable(Space& home) {
(void) home;
gpi_disabled = Support::funmark(gpi_disabled);
}
forceinline Kernel::GPI::Info&
Propagator::gpi(void) {
return *static_cast<Kernel::GPI::Info*>(Support::funmark(gpi_disabled));
}
forceinline
Propagator::Propagator(Home home)
: gpi_disabled((home.propagator() != NULL) ?
// Inherit propagator information
home.propagator()->gpi_disabled :
// New propagator information
static_cast<Space&>(home).ssd.data().gpi.allocate
(home.propagatorgroup().gid)) {
u.advisors = NULL;
assert((u.med == 0) && (u.size == 0));
static_cast<Space&>(home).pl.head(this);
}
forceinline
Propagator::Propagator(Space&, Propagator& p)
: gpi_disabled(p.gpi_disabled) {
u.advisors = NULL;
assert((u.med == 0) && (u.size == 0));
// Set forwarding pointer
p.prev(this);
}
forceinline ModEventDelta
Propagator::modeventdelta(void) const {
return u.med;
}
forceinline double
Propagator::afc(void) const {
return const_cast<Propagator&>(*this).gpi().afc;
}
#ifdef GECODE_HAS_CBS
forceinline void
Propagator::solndistrib(Space&, SendMarginal) const {}
forceinline void
Propagator::domainsizesum(InDecision, unsigned int& size,
unsigned int& size_b) const {
size = 0;
size_b = 0;
}
#endif
forceinline unsigned int
Propagator::id(void) const {
return const_cast<Propagator&>(*this).gpi().pid;
}
forceinline PropagatorGroup
Propagator::group(void) const {
return PropagatorGroup(const_cast<Propagator&>(*this).gpi().gid);
}
forceinline void
Propagator::group(PropagatorGroup g) {
gpi().gid = g.id();
}
forceinline ExecStatus
Space::ES_SUBSUMED_DISPOSED(Propagator& p, size_t s) {
p.u.size = s;
return __ES_SUBSUMED;
}
forceinline ExecStatus
Space::ES_SUBSUMED(Propagator& p) {
p.u.size = p.dispose(*this);
return __ES_SUBSUMED;
}
forceinline ExecStatus
Space::ES_FIX_PARTIAL(Propagator& p, const ModEventDelta& med) {
p.u.med = med;
assert(p.u.med != 0);
return __ES_PARTIAL;
}
forceinline ExecStatus
Space::ES_NOFIX_PARTIAL(Propagator& p, const ModEventDelta& med) {
p.u.med = AllVarConf::med_combine(p.u.med,med);
assert(p.u.med != 0);
return __ES_PARTIAL;
}
/*
* Brancher
*
*/
forceinline Brancher*
Brancher::cast(ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
ActorLink& t = *al;
return static_cast<Brancher*>(&t);
}
forceinline const Brancher*
Brancher::cast(const ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
const ActorLink& t = *al;
return static_cast<const Brancher*>(&t);
}
forceinline
Brancher::Brancher(Home _home) :
gid(_home.branchergroup().gid) {
Space& home = static_cast<Space&>(_home);
bid = home.pc.p.bid_sc >> Space::sc_bits;
home.pc.p.bid_sc += (1 << Space::sc_bits);
if ((home.pc.p.bid_sc >> Space::sc_bits) == 0U)
throw TooManyBranchers("Brancher::Brancher");
// If no brancher available, make it the first one
if (home.b_status == &static_cast<Space&>(home).bl) {
home.b_status = this;
if (home.b_commit == &static_cast<Space&>(home).bl)
home.b_commit = this;
}
home.bl.tail(this);
}
forceinline
Brancher::Brancher(Space&, Brancher& b)
: bid(b.bid), gid(b.gid) {
// Set forwarding pointer
b.prev(this);
}
forceinline unsigned int
Brancher::id(void) const {
return bid;
}
forceinline BrancherGroup
Brancher::group(void) const {
return BrancherGroup(gid);
}
forceinline void
Brancher::group(BrancherGroup g) {
gid = g.id();
}
forceinline void
Space::kill(Brancher& b) {
assert(!failed());
// Make sure that neither b_status nor b_commit does not point to b!
if (b_commit == &b)
b_commit = Brancher::cast(b.next());
if (b_status == &b)
b_status = Brancher::cast(b.next());
b.unlink();
rfree(&b,b.dispose(*this));
}
forceinline void
Space::kill(Propagator& p) {
assert(!failed());
p.unlink();
rfree(&p,p.dispose(*this));
}
forceinline Brancher*
Space::brancher(unsigned int id) {
/*
* Due to weakly monotonic propagators the following scenario might
* occur: a brancher has been committed with all its available
* choices. Then, propagation determines less information
* than before and the brancher now will create new choices.
* Later, during recomputation, all of these choices
* can be used together, possibly interleaved with
* choices for other branchers. That means all branchers
* must be scanned to find the matching brancher for the choice.
*
* b_commit tries to optimize scanning as it is most likely that
* recomputation does not generate new choices during recomputation
* and hence b_commit is moved from newer to older branchers.
*/
Brancher* b_old = b_commit;
// Try whether we are lucky
while (b_commit != Brancher::cast(&bl))
if (id != b_commit->id())
b_commit = Brancher::cast(b_commit->next());
else
return b_commit;
if (b_commit == Brancher::cast(&bl)) {
// We did not find the brancher, start at the beginning
b_commit = Brancher::cast(bl.next());
while (b_commit != b_old)
if (id != b_commit->id())
b_commit = Brancher::cast(b_commit->next());
else
return b_commit;
}
return NULL;
}
/*
* Local objects
*
*/
forceinline LocalObject*
LocalObject::cast(ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
ActorLink& t = *al;
return static_cast<LocalObject*>(&t);
}
forceinline const LocalObject*
LocalObject::cast(const ActorLink* al) {
// Turning al into a reference is for gcc, assume is for MSVC
GECODE_NOT_NULL(al);
const ActorLink& t = *al;
return static_cast<const LocalObject*>(&t);
}
forceinline
LocalObject::LocalObject(Home home) {
(void) home;
ActorLink::cast(this)->prev(NULL);
}
forceinline
LocalObject::LocalObject(Space&, LocalObject&) {
ActorLink::cast(this)->prev(NULL);
}
forceinline LocalObject*
LocalObject::fwd(Space& home) {
if (prev() == NULL)
fwdcopy(home);
return LocalObject::cast(prev());
}
forceinline
LocalHandle::LocalHandle(void) : o(NULL) {}
forceinline
LocalHandle::LocalHandle(LocalObject* lo) : o(lo) {}
forceinline
LocalHandle::LocalHandle(const LocalHandle& lh) : o(lh.o) {}
forceinline LocalHandle&
LocalHandle::operator =(const LocalHandle& lh) {
o = lh.o;
return *this;
}
forceinline
LocalHandle::~LocalHandle(void) {}
forceinline LocalObject*
LocalHandle::object(void) const { return o; }
forceinline void
LocalHandle::object(LocalObject* n) { o = n; }
forceinline void
LocalHandle::update(Space& home, LocalHandle& lh) {
object(lh.object()->fwd(home));
}
/*
* Choices
*
*/
forceinline
Choice::Choice(const Brancher& b, const unsigned int a)
: bid(b.id()), alt(a) {}
forceinline unsigned int
Choice::alternatives(void) const {
return alt;
}
forceinline unsigned int
Choice::id(void) const {
return bid;
}
forceinline
Choice::~Choice(void) {}
/*
* No-good literal
*
*/
forceinline bool
NGL::leaf(void) const {
return Support::marked(nl);
}
forceinline NGL*
NGL::next(void) const {
return static_cast<NGL*>(Support::funmark(nl));
}
forceinline void
NGL::leaf(bool l) {
nl = l ? Support::fmark(nl) : Support::funmark(nl);
}
forceinline void
NGL::next(NGL* n) {
nl = Support::marked(nl) ? Support::mark(n) : n;
}
forceinline NGL*
NGL::add(NGL* n, bool l) {
nl = Support::marked(nl) ? Support::mark(n) : n;
n->leaf(l);
return n;
}
forceinline
NGL::NGL(void)
: nl(NULL) {}
forceinline
NGL::NGL(Space&)
: nl(NULL) {}
forceinline
NGL::NGL(Space&, NGL&)
: nl(NULL) {}
forceinline size_t
NGL::dispose(Space&) {
return sizeof(*this);
}
/*
* Advisor
*
*/
template<class A>
forceinline
Advisor::Advisor(Space&, Propagator& p, Council<A>& c) {
// Store propagator and forwarding in prev()
ActorLink::prev(&p);
// Link to next advisor in next()
ActorLink::next(c.advisors); c.advisors = static_cast<A*>(this);
}
forceinline
Advisor::Advisor(Space&, Advisor&) {}
forceinline bool
Advisor::disposed(void) const {
return prev() == NULL;
}
forceinline Advisor*
Advisor::cast(ActorLink* al) {
return static_cast<Advisor*>(al);
}
forceinline const Advisor*
Advisor::cast(const ActorLink* al) {
return static_cast<const Advisor*>(al);
}
forceinline Propagator&
Advisor::propagator(void) const {
assert(!disposed());
return *Propagator::cast(ActorLink::prev());
}
template<class A>
forceinline void
Advisor::dispose(Space&,Council<A>&) {
assert(!disposed());
ActorLink::prev(NULL);
// Shorten chains of disposed advisors by one, if possible
Advisor* n = Advisor::cast(next());
if ((n != NULL) && n->disposed())
next(n->next());
}
forceinline const ViewTraceInfo&
Advisor::operator ()(const Space& home) const {
return home.pc.p.vti;
}
template<class A>
forceinline ExecStatus
Space::ES_FIX_DISPOSE(Council<A>& c, A& a) {
a.dispose(*this,c);
return ES_FIX;
}
template<class A>
forceinline ExecStatus
Space::ES_NOFIX_DISPOSE(Council<A>& c, A& a) {
a.dispose(*this,c);
return ES_NOFIX;
}
template<class A>
forceinline ExecStatus
Space::ES_NOFIX_DISPOSE_FORCE(Council<A>& c, A& a) {
a.dispose(*this,c);
return ES_NOFIX_FORCE;
}
/*
* Advisor council
*
*/
template<class A>
forceinline
Council<A>::Council(void) {}
template<class A>
forceinline
Council<A>::Council(Space&)
: advisors(NULL) {}
template<class A>
forceinline bool
Council<A>::empty(void) const {
ActorLink* a = advisors;
while ((a != NULL) && static_cast<A*>(a)->disposed())
a = a->next();
advisors = a;
return a == NULL;
}
template<class A>
forceinline void
Council<A>::update(Space& home, Council<A>& c) {
// Skip all disposed advisors
{
ActorLink* a = c.advisors;
while ((a != NULL) && static_cast<A*>(a)->disposed())
a = a->next();
c.advisors = a;
}
// Are there any advisors to be cloned?
if (c.advisors != NULL) {
// The propagator in from-space
Propagator* p_f = &static_cast<A*>(c.advisors)->propagator();
// The propagator in to-space
Propagator* p_t = Propagator::cast(p_f->prev());
// Advisors in from-space
ActorLink** a_f = &c.advisors;
// Advisors in to-space
A* a_t = NULL;
while (*a_f != NULL) {
if (static_cast<A*>(*a_f)->disposed()) {
*a_f = (*a_f)->next();
} else {
// Run specific copying part
A* a = new (home) A(home,*static_cast<A*>(*a_f));
// Set propagator pointer
a->prev(p_t);
// Set forwarding pointer
(*a_f)->prev(a);
// Link
a->next(a_t);
a_t = a;
a_f = (*a_f)->next_ref();
}
}
advisors = a_t;
// Enter advisor link for reset
assert(p_f->u.advisors == NULL);
p_f->u.advisors = c.advisors;
} else {
advisors = NULL;
}
}
template<class A>
forceinline void
Council<A>::dispose(Space& home) {
ActorLink* a = advisors;
while (a != NULL) {
if (!static_cast<A*>(a)->disposed())
static_cast<A*>(a)->dispose(home,*this);
a = a->next();
}
}
/*
* Advisor iterator
*
*/
template<class A>
forceinline
Advisors<A>::Advisors(const Council<A>& c)
: a(c.advisors) {
while ((a != NULL) && static_cast<A*>(a)->disposed())
a = a->next();
}
template<class A>
forceinline bool
Advisors<A>::operator ()(void) const {
return a != NULL;
}
template<class A>
forceinline void
Advisors<A>::operator ++(void) {
do {
a = a->next();
} while ((a != NULL) && static_cast<A*>(a)->disposed());
}
template<class A>
forceinline A&
Advisors<A>::advisor(void) const {
return *static_cast<A*>(a);
}
/*
* Space
*
*/
forceinline void
Space::enqueue(Propagator* p) {
ActorLink::cast(p)->unlink();
ActorLink* c = &pc.p.queue[p->cost(*this,p->u.med).ac];
c->tail(ActorLink::cast(p));
if (c > pc.p.active)
pc.p.active = c;
}
forceinline void
Space::fail(void) {
pc.p.active = &pc.p.queue[PropCost::AC_MAX+1]+1;
/*
* Now active points beyond the last queue. This is essential as
* enqueuing a propagator in a failed space keeps the space
* failed.
*/
}
forceinline void
Home::fail(void) {
s.fail();
}
forceinline bool
Space::failed(void) const {
return pc.p.active > &pc.p.queue[PropCost::AC_MAX+1];
}
forceinline bool
Home::failed(void) const {
return s.failed();
}
forceinline bool
Space::stable(void) const {
return ((pc.p.active < &pc.p.queue[0]) ||
(pc.p.active > &pc.p.queue[PropCost::AC_MAX+1]));
}
forceinline void
Space::notice(Actor& a, ActorProperty p, bool d) {
if (p & AP_DISPOSE) {
ap_notice_dispose(&a,d);
}
if (p & AP_VIEW_TRACE) {
pc.p.bid_sc |= sc_trace;
}
if (p & AP_TRACE) {
pc.p.bid_sc |= sc_trace;
}
// Currently unused
if (p & AP_WEAKLY) {}
}
forceinline void
Space::ignore(Actor& a, ActorProperty p, bool d) {
// Check wether array has already been discarded as space
// deletion is already in progress
if ((p & AP_DISPOSE) && (d_fst != NULL))
ap_ignore_dispose(&a,d);
if (p & AP_VIEW_TRACE) {}
if (p & AP_TRACE) {}
// Currently unused
if (p & AP_WEAKLY) {}
}
/*
* Variable implementation
*
*/
template<class VIC>
forceinline ActorLink**
VarImp<VIC>::actor(PropCond pc) {
assert((pc >= 0) && (pc < pc_max+2));
return (pc == 0) ? b.base : b.base+u.idx[pc-1];
}
template<class VIC>
forceinline ActorLink**
VarImp<VIC>::actorNonZero(PropCond pc) {
assert((pc > 0) && (pc < pc_max+2));
return b.base+u.idx[pc-1];
}
template<class VIC>
forceinline unsigned int&
VarImp<VIC>::idx(PropCond pc) {
assert((pc > 0) && (pc < pc_max+2));
return u.idx[pc-1];
}
template<class VIC>
forceinline unsigned int
VarImp<VIC>::idx(PropCond pc) const {
assert((pc > 0) && (pc < pc_max+2));
return u.idx[pc-1];
}
template<class VIC>
forceinline
VarImp<VIC>::VarImp(Space& home)
#ifdef GECODE_HAS_CBS
: var_id(++home.var_id_counter)
#endif
{
#ifndef GECODE_HAS_CBS
(void) home;
#endif
b.base = NULL; entries = 0;
for (PropCond pc=1; pc<pc_max+2; pc++)
idx(pc) = 0;
free_and_bits = 0;
}
template<class VIC>
forceinline
VarImp<VIC>::VarImp(void)
#ifdef GECODE_HAS_CBS
: var_id(0)
#endif
{
b.base = NULL; entries = 0;
for (PropCond pc=1; pc<pc_max+2; pc++)
idx(pc) = 0;
free_and_bits = 0;
}
#ifdef GECODE_HAS_CBS
template<class VIC>
forceinline unsigned int
VarImp<VIC>::id(void) const {
return var_id;
}
#endif
template<class VIC>
forceinline unsigned int
VarImp<VIC>::degree(void) const {
assert(!copied());
return entries;
}
template<class VIC>
forceinline double
VarImp<VIC>::afc(void) const {
double d = 0.0;
// Count the afc of each propagator
{
ActorLink** a = const_cast<VarImp<VIC>*>(this)->actor(0);
ActorLink** e = const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
while (a < e) {
d += Propagator::cast(*a)->afc(); a++;
}
}
// Count the afc of each advisor's propagator
{
ActorLink** a = const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
ActorLink** e = const_cast<VarImp<VIC>*>(this)->b.base+entries;
while (a < e) {
d += Advisor::cast(static_cast<ActorLink*>(Support::funmark(*a)))
->propagator().afc();
a++;
}
}
return d;
}
template<class VIC>
forceinline ModEvent
VarImp<VIC>::modevent(const Delta& d) {
return d.me;
}
template<class VIC>
forceinline unsigned int
VarImp<VIC>::bits(void) const {
return free_and_bits;
}
template<class VIC>
forceinline unsigned int&
VarImp<VIC>::bits(void) {
return free_and_bits;
}
#ifdef GECODE_HAS_VAR_DISPOSE
template<class VIC>
forceinline VarImp<VIC>*
VarImp<VIC>::vars_d(Space& home) {
return static_cast<VarImp<VIC>*>(home.vars_d<VIC>());
}
template<class VIC>
forceinline void
VarImp<VIC>::vars_d(Space& home, VarImp<VIC>* x) {
home.vars_d<VIC>(x);
}
#endif
template<class VIC>
forceinline bool
VarImp<VIC>::copied(void) const {
return Support::marked(b.fwd);
}
template<class VIC>
forceinline VarImp<VIC>*
VarImp<VIC>::forward(void) const {
assert(copied());
return static_cast<VarImp<VIC>*>(Support::unmark(b.fwd));
}
template<class VIC>
forceinline VarImp<VIC>*
VarImp<VIC>::next(void) const {
assert(copied());
return u.next;
}
template<class VIC>
forceinline
VarImp<VIC>::VarImp(Space& home, VarImp<VIC>& x)
#ifdef GECODE_HAS_CBS
: var_id(x.var_id)
#endif
{
VarImpBase** reg;
free_and_bits = x.free_and_bits & ((1 << free_bits) - 1);
if (x.b.base == NULL) {
// Variable implementation needs no index structure
reg = &home.pc.c.vars_noidx;
assert(x.degree() == 0);
} else {
reg = &home.pc.c.vars_u[idx_c];
}
// Save subscriptions in copy
b.base = x.b.base;
entries = x.entries;
for (PropCond pc=1; pc<pc_max+2; pc++)
idx(pc) = x.idx(pc);
// Set forwarding pointer
x.b.fwd = static_cast<VarImp<VIC>*>(Support::mark(this));
// Register original
x.u.next = static_cast<VarImp<VIC>*>(*reg); *reg = &x;
}
template<class VIC>
forceinline ModEvent
VarImp<VIC>::me(const ModEventDelta& med) {
return static_cast<ModEvent>((med & VIC::med_mask) >> VIC::med_fst);
}
template<class VIC>
forceinline ModEventDelta
VarImp<VIC>::med(ModEvent me) {
return static_cast<ModEventDelta>(me << VIC::med_fst);
}
template<class VIC>
forceinline ModEvent
VarImp<VIC>::me_combine(ModEvent me1, ModEvent me2) {
return VIC::me_combine(me1,me2);
}
template<class VIC>
forceinline void
VarImp<VIC>::schedule(Space& home, Propagator& p, ModEvent me,
bool force) {
if (VIC::med_update(p.u.med,me) || force)
home.enqueue(&p);
}
template<class VIC>
forceinline void
VarImp<VIC>::schedule(Space& home, PropCond pc1, PropCond pc2, ModEvent me) {
ActorLink** b = actor(pc1);
ActorLink** p = actorNonZero(pc2+1);
while (p-- > b)
schedule(home,*Propagator::cast(*p),me);
}
template<class VIC>
forceinline void
VarImp<VIC>::resize(Space& home) {
if (b.base == NULL) {
assert((free_and_bits >> free_bits) == 0);
// Create fresh dependency array with four entries
free_and_bits += 4 << free_bits;
b.base = home.alloc<ActorLink*>(4);
for (int i=0; i<pc_max+1; i++)
u.idx[i] = 0;
} else {
// Resize dependency array
unsigned int n = degree();
// Find out whether the area is most likely in the special area
// reserved for subscriptions. If yes, just resize mildly otherwise
// more agressively
ActorLink** s = static_cast<ActorLink**>(home.mm.subscriptions());
unsigned int m =
((s <= b.base) && (b.base < s+home.pc.p.n_sub)) ?
(n+4) : ((n+1)*3>>1);
ActorLink** prop = home.alloc<ActorLink*>(m);
free_and_bits += (m-n) << free_bits;
// Copy entries
Heap::copy<ActorLink*>(prop, b.base, n);
home.free<ActorLink*>(b.base,n);
b.base = prop;
}
}
template<class VIC>
forceinline void
VarImp<VIC>::enter(Space& home, Propagator* p, PropCond pc) {
assert(pc <= pc_max);
// Count one new subscription
home.pc.p.n_sub += 1;
if ((free_and_bits >> free_bits) == 0)
resize(home);
free_and_bits -= 1 << free_bits;
// Enter subscription
b.base[entries] = *actorNonZero(pc_max+1);
entries++;
for (PropCond j = pc_max; j > pc; j--) {
*actorNonZero(j+1) = *actorNonZero(j);
idx(j+1)++;
}
*actorNonZero(pc+1) = *actor(pc);
idx(pc+1)++;
*actor(pc) = ActorLink::cast(p);
#ifdef GECODE_AUDIT
ActorLink** f = actor(pc);
while (f < (pc == pc_max+1 ? b.base+entries : actorNonZero(pc+1)))
if (*f == p)
goto found;
else
f++;
GECODE_NEVER;
found: ;
#endif
}
template<class VIC>
forceinline void
VarImp<VIC>::enter(Space& home, Advisor* a) {
// Note that a might be a marked pointer
// Count one new subscription
home.pc.p.n_sub += 1;
if ((free_and_bits >> free_bits) == 0)
resize(home);
free_and_bits -= 1 << free_bits;
// Enter subscription
b.base[entries++] = *actorNonZero(pc_max+1);
*actorNonZero(pc_max+1) = a;
}
template<class VIC>
forceinline void
VarImp<VIC>::subscribe(Space& home, Propagator& p, PropCond pc,
bool assigned, ModEvent me, bool schedule) {
if (assigned) {
// Do not subscribe, just schedule the propagator
if (schedule)
VarImp<VIC>::schedule(home,p,ME_GEN_ASSIGNED);
} else {
enter(home,&p,pc);
// Schedule propagator
if (schedule && (pc != PC_GEN_ASSIGNED))
VarImp<VIC>::schedule(home,p,me);
}
}
template<class VIC>
forceinline void
VarImp<VIC>::subscribe(Space& home, Advisor& a, bool assigned, bool fail) {
if (!assigned) {
Advisor* ma = static_cast<Advisor*>(Support::ptrjoin(&a,fail ? 1 : 0));
enter(home,ma);
}
}
template<class VIC>
forceinline void
VarImp<VIC>::reschedule(Space& home, Propagator& p, PropCond pc,
bool assigned, ModEvent me) {
if (assigned)
VarImp<VIC>::schedule(home,p,ME_GEN_ASSIGNED);
else if (pc != PC_GEN_ASSIGNED)
VarImp<VIC>::schedule(home,p,me);
}
template<class VIC>
void
VarImp<VIC>::remove(Space& home, Propagator* p, PropCond pc) {
assert(pc <= pc_max);
ActorLink* a = ActorLink::cast(p);
// Find actor in dependency array
ActorLink** f = actor(pc);
#ifdef GECODE_AUDIT
while (f < actorNonZero(pc+1))
if (*f == a)
goto found;
else
f++;
GECODE_NEVER;
found: ;
#else
while (*f != a) f++;
#endif
// Remove actor
*f = *(actorNonZero(pc+1)-1);
for (PropCond j = pc+1; j< pc_max+1; j++) {
*(actorNonZero(j)-1) = *(actorNonZero(j+1)-1);
idx(j)--;
}
*(actorNonZero(pc_max+1)-1) = b.base[entries-1];
idx(pc_max+1)--;
entries--;
free_and_bits += 1 << free_bits;
home.pc.p.n_sub -= 1;
}
template<class VIC>
forceinline void
VarImp<VIC>::cancel(Space& home, Propagator& p, PropCond pc) {
if (b.base != NULL)
remove(home,&p,pc);
}
template<class VIC>
void
VarImp<VIC>::remove(Space& home, Advisor* a) {
// Note that a might be a marked pointer
// Find actor in dependency array
ActorLink** f = actorNonZero(pc_max+1);
#ifdef GECODE_AUDIT
while (f < b.base+entries)
if (*f == a)
goto found;
else
f++;
GECODE_NEVER;
found: ;
#else
while (*f != a) f++;
#endif
// Remove actor
*f = b.base[--entries];
free_and_bits += 1 << free_bits;
home.pc.p.n_sub -= 1;
}
template<class VIC>
forceinline void
VarImp<VIC>::cancel(Space& home, Advisor& a, bool fail) {
if (b.base != NULL) {
Advisor* ma = static_cast<Advisor*>(Support::ptrjoin(&a,fail ? 1 : 0));
remove(home,ma);
}
}
template<class VIC>
forceinline void
VarImp<VIC>::cancel(Space& home) {
unsigned int n_sub = degree();
home.pc.p.n_sub -= n_sub;
unsigned int n = (free_and_bits >> free_bits) + n_sub;
home.free<ActorLink*>(b.base,n);
// Must be NULL such that cloning works
b.base = NULL;
// Must be 0 such that degree works
entries = 0;
// Must be NULL such that afc works
for (PropCond pc=1; pc<pc_max+2; pc++)
idx(pc) = 0;
free_and_bits &= (1 << free_bits) - 1;
}
template<class VIC>
forceinline bool
VarImp<VIC>::advise(Space& home, ModEvent me, Delta& d) {
/*
* An advisor that is executed might remove itself due to subsumption.
* As entries are removed from front to back, the advisors must
* be iterated in forward direction.
*/
ActorLink** la = actorNonZero(pc_max+1);
ActorLink** le = b.base+entries;
if (la == le)
return true;
d.me = me;
// An advisor that is run, might be removed during execution.
// As removal is done from the back the advisors have to be executed
// in inverse order.
do {
Advisor* a = Advisor::cast
(static_cast<ActorLink*>(Support::funmark(*la)));
assert(!a->disposed());
Propagator& p = a->propagator();
switch (p.advise(home,*a,d)) {
case ES_FIX:
break;
case ES_FAILED:
return false;
case ES_NOFIX:
schedule(home,p,me);
break;
case ES_NOFIX_FORCE:
schedule(home,p,me,true);
break;
case __ES_SUBSUMED:
default:
GECODE_NEVER;
}
} while (++la < le);
return true;
}
template<class VIC>
void
VarImp<VIC>::_fail(Space& home) {
/*
* An advisor that is executed might remove itself due to subsumption.
* As entries are removed from front to back, the advisors must
* be iterated in forward direction.
*/
ActorLink** la = actorNonZero(pc_max+1);
ActorLink** le = b.base+entries;
if (la == le)
return;
// An advisor that is run, might be removed during execution.
// As removal is done from the back the advisors have to be executed
// in inverse order.
do {
if (Support::marked(*la)) {
Advisor* a = Advisor::cast(static_cast<ActorLink*>
(Support::unmark(*la)));
assert(!a->disposed());
Propagator& p = a->propagator();
p.advise(home,*a);
}
} while (++la < le);
}
template<class VIC>
ModEvent
VarImp<VIC>::fail(Space& home) {
_fail(home);
return ME_GEN_FAILED;
}
template<class VIC>
forceinline void
VarImp<VIC>::update(VarImp<VIC>* x, ActorLink**& sub) {
// this refers to the variable to be updated (clone)
// x refers to the original
// Recover from copy
x->b.base = b.base;
x->u.idx[0] = u.idx[0];
if (pc_max > 0 && sizeof(ActorLink**) > sizeof(unsigned int))
x->u.idx[1] = u.idx[1];
unsigned int np =
static_cast<unsigned int>(x->actorNonZero(pc_max+1) - x->actor(0));
unsigned int na =
static_cast<unsigned int >(x->b.base + x->entries -
x->actorNonZero(pc_max+1));
unsigned int n = na + np;
assert(n == x->degree());
ActorLink** f = x->b.base;
ActorLink** t = sub;
sub += n;
b.base = t;
// Process propagator subscriptions
while (np >= 4) {
ActorLink* p3 = f[3]->prev();
ActorLink* p0 = f[0]->prev();
ActorLink* p1 = f[1]->prev();
ActorLink* p2 = f[2]->prev();
t[0] = p0; t[1] = p1; t[2] = p2; t[3] = p3;
np -= 4; t += 4; f += 4;
}
if (np >= 2) {
ActorLink* p0 = f[0]->prev();
ActorLink* p1 = f[1]->prev();
t[0] = p0; t[1] = p1;
np -= 2; t += 2; f += 2;
}
if (np > 0) {
ActorLink* p0 = f[0]->prev();
t[0] = p0;
t += 1; f += 1;
}
// Process advisor subscriptions
while (na >= 4) {
ptrdiff_t m0, m1, m2, m3;
ActorLink* p3 =
static_cast<ActorLink*>(Support::ptrsplit(f[3],m3))->prev();
ActorLink* p0 =
static_cast<ActorLink*>(Support::ptrsplit(f[0],m0))->prev();
ActorLink* p1 =
static_cast<ActorLink*>(Support::ptrsplit(f[1],m1))->prev();
ActorLink* p2 =
static_cast<ActorLink*>(Support::ptrsplit(f[2],m2))->prev();
t[0] = static_cast<ActorLink*>(Support::ptrjoin(p0,m0));
t[1] = static_cast<ActorLink*>(Support::ptrjoin(p1,m1));
t[2] = static_cast<ActorLink*>(Support::ptrjoin(p2,m2));
t[3] = static_cast<ActorLink*>(Support::ptrjoin(p3,m3));
na -= 4; t += 4; f += 4;
}
if (na >= 2) {
ptrdiff_t m0, m1;
ActorLink* p0 =
static_cast<ActorLink*>(Support::ptrsplit(f[0],m0))->prev();
ActorLink* p1 =
static_cast<ActorLink*>(Support::ptrsplit(f[1],m1))->prev();
t[0] = static_cast<ActorLink*>(Support::ptrjoin(p0,m0));
t[1] = static_cast<ActorLink*>(Support::ptrjoin(p1,m1));
na -= 2; t += 2; f += 2;
}
if (na > 0) {
ptrdiff_t m0;
ActorLink* p0 =
static_cast<ActorLink*>(Support::ptrsplit(f[0],m0))->prev();
t[0] = static_cast<ActorLink*>(Support::ptrjoin(p0,m0));
}
}
template<class VIC>
forceinline void
VarImp<VIC>::update(Space& home, ActorLink**& sub) {
VarImp<VIC>* x = static_cast<VarImp<VIC>*>(home.pc.c.vars_u[idx_c]);
while (x != NULL) {
VarImp<VIC>* n = x->next(); x->forward()->update(x,sub); x = n;
}
}
/*
* Variable disposer
*
*/
template<class VarImp>
VarImpDisposer<VarImp>::VarImpDisposer(void) {
#ifdef GECODE_HAS_VAR_DISPOSE
Space::vd[VarImp::idx_d] = this;
#endif
}
template<class VarImp>
void
VarImpDisposer<VarImp>::dispose(Space& home, VarImpBase* _x) {
VarImp* x = static_cast<VarImp*>(_x);
do {
x->dispose(home); x = static_cast<VarImp*>(x->next_d());
} while (x != NULL);
}
/*
* Statistics
*/
forceinline void
StatusStatistics::reset(void) {
propagate = 0;
}
forceinline
StatusStatistics::StatusStatistics(void) {
reset();
}
forceinline StatusStatistics&
StatusStatistics::operator +=(const StatusStatistics& s) {
propagate += s.propagate;
return *this;
}
forceinline StatusStatistics
StatusStatistics::operator +(const StatusStatistics& s) {
StatusStatistics t(s);
return t += *this;
}
forceinline void
CloneStatistics::reset(void) {}
forceinline
CloneStatistics::CloneStatistics(void) {
reset();
}
forceinline CloneStatistics
CloneStatistics::operator +(const CloneStatistics&) {
CloneStatistics s;
return s;
}
forceinline CloneStatistics&
CloneStatistics::operator +=(const CloneStatistics&) {
return *this;
}
forceinline void
CommitStatistics::reset(void) {}
forceinline
CommitStatistics::CommitStatistics(void) {
reset();
}
forceinline CommitStatistics
CommitStatistics::operator +(const CommitStatistics&) {
CommitStatistics s;
return s;
}
forceinline CommitStatistics&
CommitStatistics::operator +=(const CommitStatistics&) {
return *this;
}
/*
* Cost computation
*
*/
forceinline
PropCost::PropCost(PropCost::ActualCost ac0) : ac(ac0) {}
forceinline PropCost
PropCost::cost(PropCost::Mod m,
PropCost::ActualCost lo, PropCost::ActualCost hi,
unsigned int n) {
if (n < 2)
return (m == LO) ? AC_UNARY_LO : AC_UNARY_HI;
else if (n == 2)
return (m == LO) ? AC_BINARY_LO : AC_BINARY_HI;
else if (n == 3)
return (m == LO) ? AC_TERNARY_LO : AC_TERNARY_HI;
else
return (m == LO) ? lo : hi;
}
forceinline PropCost
PropCost::record(void) {
return AC_RECORD;
}
forceinline PropCost
PropCost::crazy(PropCost::Mod m, unsigned int n) {
return cost(m,AC_CRAZY_LO,AC_CRAZY_HI,n);
}
forceinline PropCost
PropCost::crazy(PropCost::Mod m, int n) {
assert(n >= 0);
return crazy(m,static_cast<unsigned int>(n));
}
forceinline PropCost
PropCost::cubic(PropCost::Mod m, unsigned int n) {
return cost(m,AC_CUBIC_LO,AC_CUBIC_HI,n);
}
forceinline PropCost
PropCost::cubic(PropCost::Mod m, int n) {
assert(n >= 0);
return cubic(m,static_cast<unsigned int>(n));
}
forceinline PropCost
PropCost::quadratic(PropCost::Mod m, unsigned int n) {
return cost(m,AC_QUADRATIC_LO,AC_QUADRATIC_HI,n);
}
forceinline PropCost
PropCost::quadratic(PropCost::Mod m, int n) {
assert(n >= 0);
return quadratic(m,static_cast<unsigned int>(n));
}
forceinline PropCost
PropCost::linear(PropCost::Mod m, unsigned int n) {
return cost(m,AC_LINEAR_LO,AC_LINEAR_HI,n);
}
forceinline PropCost
PropCost::linear(PropCost::Mod m, int n) {
assert(n >= 0);
return linear(m,static_cast<unsigned int>(n));
}
forceinline PropCost
PropCost::ternary(PropCost::Mod m) {
return (m == LO) ? AC_TERNARY_LO : AC_TERNARY_HI;
}
forceinline PropCost
PropCost::binary(PropCost::Mod m) {
return (m == LO) ? AC_BINARY_LO : AC_BINARY_HI;
}
forceinline PropCost
PropCost::unary(PropCost::Mod m) {
return (m == LO) ? AC_UNARY_LO : AC_UNARY_HI;
}
/*
* Iterators for propagators and branchers of a space
*
*/
forceinline
Space::Propagators::Propagators(Space& home0)
: home(home0), q(home.pc.p.active) {
while (q >= &home.pc.p.queue[0]) {
if (q->next() != q) {
c = q->next(); e = q; q--;
return;
}
q--;
}
q = NULL;
if (!home.pl.empty()) {
c = Propagator::cast(home.pl.next());
e = Propagator::cast(&home.pl);
} else {
c = e = NULL;
}
}
forceinline bool
Space::Propagators::operator ()(void) const {
return c != NULL;
}
forceinline void
Space::Propagators::operator ++(void) {
c = c->next();
if (c == e) {
if (q == NULL) {
c = NULL;
} else {
while (q >= &home.pc.p.queue[0]) {
if (q->next() != q) {
c = q->next(); e = q; q--;
return;
}
q--;
}
q = NULL;
if (!home.pl.empty()) {
c = Propagator::cast(home.pl.next());
e = Propagator::cast(&home.pl);
} else {
c = NULL;
}
}
}
}
forceinline Propagator&
Space::Propagators::propagator(void) const {
return *Propagator::cast(c);
}
forceinline
Space::ScheduledPropagators::ScheduledPropagators(Space& home0)
: home(home0), q(home.pc.p.active) {
while (q >= &home.pc.p.queue[0]) {
if (q->next() != q) {
c = q->next(); e = q; q--;
return;
}
q--;
}
q = c = e = NULL;
}
forceinline bool
Space::ScheduledPropagators::operator ()(void) const {
return c != NULL;
}
forceinline void
Space::ScheduledPropagators::operator ++(void) {
c = c->next();
if (c == e) {
if (q == NULL) {
c = NULL;
} else {
while (q >= &home.pc.p.queue[0]) {
if (q->next() != q) {
c = q->next(); e = q; q--;
return;
}
q--;
}
q = c = e = NULL;
}
}
}
forceinline Propagator&
Space::ScheduledPropagators::propagator(void) const {
return *Propagator::cast(c);
}
forceinline
Space::IdlePropagators::IdlePropagators(Space& home) {
c = Propagator::cast(home.pl.next());
e = Propagator::cast(&home.pl);
}
forceinline bool
Space::IdlePropagators::operator ()(void) const {
return c != e;
}
forceinline void
Space::IdlePropagators::operator ++(void) {
c = c->next();
}
forceinline Propagator&
Space::IdlePropagators::propagator(void) const {
return *Propagator::cast(c);
}
forceinline
Space::Branchers::Branchers(Space& home)
: c(Brancher::cast(home.bl.next())), e(&home.bl) {}
forceinline bool
Space::Branchers::operator ()(void) const {
return c != e;
}
forceinline void
Space::Branchers::operator ++(void) {
c = c->next();
}
forceinline Brancher&
Space::Branchers::brancher(void) const {
return *Brancher::cast(c);
}
/*
* Groups of actors
*/
forceinline
Group::Group(unsigned int gid0) : gid(gid0) {}
forceinline bool
Group::in(Group actor) const {
return (gid == GROUPID_ALL) || (gid == actor.gid);
}
forceinline bool
Group::in(void) const {
return (gid != GROUPID_ALL) && (gid != GROUPID_DEF);
}
forceinline
Group::Group(const Group& g) : gid(g.gid) {}
forceinline Group&
Group::operator =(const Group& g) {
gid=g.gid; return *this;
}
forceinline unsigned int
Group::id(void) const {
return gid;
}
forceinline
PropagatorGroup::PropagatorGroup(void) {}
forceinline
PropagatorGroup::PropagatorGroup(unsigned int gid)
: Group(gid) {}
forceinline
PropagatorGroup::PropagatorGroup(const PropagatorGroup& g)
: Group(g) {}
forceinline PropagatorGroup&
PropagatorGroup::operator =(const PropagatorGroup& g) {
return static_cast<PropagatorGroup&>(Group::operator =(g));
}
forceinline Home
PropagatorGroup::operator ()(Space& home) {
return Home(home,NULL,*this,BrancherGroup::def);
}
forceinline bool
PropagatorGroup::operator ==(PropagatorGroup g) const {
return id() == g.id();
}
forceinline bool
PropagatorGroup::operator !=(PropagatorGroup g) const {
return id() != g.id();
}
forceinline PropagatorGroup&
PropagatorGroup::move(Space& , Propagator& p) {
if (id() != GROUPID_ALL)
p.group(*this);
return *this;
}
forceinline
BrancherGroup::BrancherGroup(void) {}
forceinline
BrancherGroup::BrancherGroup(unsigned int gid)
: Group(gid) {}
forceinline
BrancherGroup::BrancherGroup(const BrancherGroup& g)
: Group(g) {}
forceinline BrancherGroup&
BrancherGroup::operator =(const BrancherGroup& g) {
return static_cast<BrancherGroup&>(Group::operator =(g));
}
forceinline Home
BrancherGroup::operator ()(Space& home) {
return Home(home,NULL,PropagatorGroup::def,*this);
}
forceinline bool
BrancherGroup::operator ==(BrancherGroup g) const {
return id() == g.id();
}
forceinline bool
BrancherGroup::operator !=(BrancherGroup g) const {
return id() != g.id();
}
forceinline BrancherGroup&
BrancherGroup::move(Space& , Brancher& p) {
if (id() != GROUPID_ALL)
p.group(*this);
return *this;
}
/*
* Iterators for propagators and branchers in a group
*
*/
forceinline
Propagators::Propagators(const Space& home, PropagatorGroup g0)
: ps(const_cast<Space&>(home)), g(g0) {
while (ps() && !g.in(ps.propagator().group()))
++ps;
}
forceinline bool
Propagators::operator ()(void) const {
return ps();
}
forceinline void
Propagators::operator ++(void) {
do
++ps;
while (ps() && !g.in(ps.propagator().group()));
}
forceinline const Propagator&
Propagators::propagator(void) const {
return ps.propagator();
}
forceinline
Branchers::Branchers(const Space& home, BrancherGroup g0)
: bs(const_cast<Space&>(home)), g(g0) {
while (bs() && !g.in(bs.brancher().group()))
++bs;
}
forceinline bool
Branchers::operator ()(void) const {
return bs();
}
forceinline void
Branchers::operator ++(void) {
do
++bs;
while (bs() && !g.in(bs.brancher().group()));
}
forceinline const Brancher&
Branchers::brancher(void) const {
return bs.brancher();
}
/*
* Space construction support
*
*/
template<class T>
forceinline T&
Space::construct(void) {
return alloc<T>(1);
}
template<class T, typename A1>
forceinline T&
Space::construct(A1 const& a1) {
T& t = *static_cast<T*>(ralloc(sizeof(T)));
new (&t) T(a1);
return t;
}
template<class T, typename A1, typename A2>
forceinline T&
Space::construct(A1 const& a1, A2 const& a2) {
T& t = *static_cast<T*>(ralloc(sizeof(T)));
new (&t) T(a1,a2);
return t;
}
template<class T, typename A1, typename A2, typename A3>
forceinline T&
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3) {
T& t = *static_cast<T*>(ralloc(sizeof(T)));
new (&t) T(a1,a2,a3);
return t;
}
template<class T, typename A1, typename A2, typename A3, typename A4>
forceinline T&
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4) {
T& t = *static_cast<T*>(ralloc(sizeof(T)));
new (&t) T(a1,a2,a3,a4);
return t;
}
template<class T, typename A1, typename A2, typename A3, typename A4, typename A5>
forceinline T&
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5) {
T& t = *static_cast<T*>(ralloc(sizeof(T)));
new (&t) T(a1,a2,a3,a4,a5);
return t;
}
}
// STATISTICS: kernel-core
Gecode::AFC
Class for AFC (accumulated failure count) management.
Definition afc.hpp:40
Gecode::ActorLink
Double-linked list for actors.
Definition core.hpp:589
Gecode::ActorLink::next_ref
ActorLink ** next_ref(void)
Definition core.hpp:3133
Gecode::ActorLink::next
ActorLink * next(void) const
Definition core.hpp:3128
Gecode::ActorLink::init
void init(void)
Initialize links (self-linked).
Definition core.hpp:3154
Gecode::ActorLink::Space
friend class Space
Definition core.hpp:595
Gecode::ActorLink::unlink
void unlink(void)
Remove from predecessor and successor.
Definition core.hpp:3148
Gecode::ActorLink::head
void head(ActorLink *al)
Insert al directly after this.
Definition core.hpp:3159
Gecode::ActorLink::LocalObject
friend class LocalObject
Definition core.hpp:594
Gecode::ActorLink::tail
void tail(ActorLink *al)
Insert al directly before this.
Definition core.hpp:3167
Gecode::ActorLink::prev
ActorLink * prev(void) const
Routines for double-linked list.
Definition core.hpp:3123
Gecode::ActorLink::VarImp
friend class VarImp
Definition core.hpp:596
Gecode::ActorLink::Advisor
friend class Advisor
Definition core.hpp:592
Gecode::ActorLink::Propagator
friend class Propagator
Definition core.hpp:591
Gecode::ActorLink::Brancher
friend class Brancher
Definition core.hpp:593
Gecode::ActorLink::empty
bool empty(void) const
Test whether actor link is empty (points to itself).
Definition core.hpp:3175
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::ActorLink::cast
static ActorLink * cast(T *a)
Static cast for a non-null pointer (to give a hint to optimizer).
Definition core.hpp:3181
Gecode::Actor
Base-class for both propagators and branchers.
Definition core.hpp:628
Gecode::Actor::Space
friend class Space
Definition core.hpp:630
Gecode::Actor::LocalObject
friend class LocalObject
Definition core.hpp:634
Gecode::Actor::ActorLink
friend class ActorLink
Definition core.hpp:629
Gecode::Actor::VarImp
friend class VarImp
Definition core.hpp:635
Gecode::Actor::Advisor
friend class Advisor
Definition core.hpp:632
Gecode::Actor::Propagator
friend class Propagator
Definition core.hpp:631
Gecode::Actor::Brancher
friend class Brancher
Definition core.hpp:633
Gecode::Actor::copy
virtual Actor * copy(Space &home)=0
Create copy.
Gecode::Actor::Council
friend class Council
Definition core.hpp:636
Gecode::Actor::dispose
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition core.hpp:3252
Gecode::Advisor
Base-class for advisors.
Definition core.hpp:1292
Gecode::Advisor::SubscribedPropagators
friend class SubscribedPropagators
Definition core.hpp:1296
Gecode::Advisor::propagator
Propagator & propagator(void) const
Return the advisor's propagator.
Definition core.hpp:3857
Gecode::Advisor::Advisor
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Definition core.hpp:3831
Gecode::Advisor::VarImp
friend class VarImp
Definition core.hpp:1293
Gecode::Advisor::dispose
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
Definition core.hpp:3864
Gecode::Advisor::Advisors
friend class Advisors
Definition core.hpp:1295
Gecode::Advisor::Council
friend class Council
Definition core.hpp:1294
Gecode::Advisor::operator()
const ViewTraceInfo & operator()(const Space &home) const
Provide access to view trace information.
Definition core.hpp:3874
Gecode::Advisors
Class to iterate over advisors of a council.
Definition core.hpp:1266
Gecode::Advisors::Advisors
Advisors(const Council< A > &c)
Initialize.
Definition core.hpp:3988
Gecode::Advisors::operator()
bool operator()(void) const
Test whether there advisors left.
Definition core.hpp:3996
Gecode::Advisors::operator++
void operator++(void)
Move iterator to next advisor.
Definition core.hpp:4002
Gecode::Advisors::advisor
A & advisor(void) const
Return advisor.
Definition core.hpp:4010
Gecode::AllVarConf::idx_c
static const int idx_c
Index for cloning.
Definition var-type.hpp:459
Gecode::AllVarConf::med_combine
static ModEventDelta med_combine(ModEventDelta med1, ModEventDelta med2)
Combine modification event delta med1 with med2.
Definition var-type.hpp:889
Gecode::Archive
Archive representation
Definition archive.hpp:42
Gecode::BrancherGroup
Group of branchers.
Definition core.hpp:799
Gecode::BrancherGroup::size
unsigned int size(Space &home) const
Return number of branchers in a group.
Definition core.cpp:1033
Gecode::BrancherGroup::def
static BrancherGroup def
Group of branchers not in any user-defined group.
Definition core.hpp:850
Gecode::BrancherGroup::all
static BrancherGroup all
Group of all branchers.
Definition core.hpp:847
Gecode::BrancherGroup::operator=
BrancherGroup & operator=(const BrancherGroup &g)
Assignment operator.
Definition core.hpp:5029
Gecode::BrancherGroup::move
BrancherGroup & move(Space &home, BrancherGroup g)
Move branchers from group g to this group.
Definition core.cpp:1010
Gecode::BrancherGroup::BrancherGroup
BrancherGroup(unsigned int gid)
Initialize with group id gid.
Definition core.hpp:5021
Gecode::BrancherGroup::Brancher
friend class Brancher
Definition core.hpp:800
Gecode::BrancherGroup::operator()
Home operator()(Space &home)
To augment a space argument.
Definition core.hpp:5034
Gecode::BrancherGroup::operator!=
bool operator!=(BrancherGroup g) const
Test whether this group is different from group g.
Definition core.hpp:5043
Gecode::BrancherGroup::kill
void kill(Space &home)
Kill all branchers in a group.
Definition core.cpp:1044
Gecode::BrancherGroup::operator==
bool operator==(BrancherGroup g) const
Test whether this group is equal to group g.
Definition core.hpp:5039
Gecode::BrancherGroup::BrancherGroup
BrancherGroup(void)
Constructor.
Definition core.hpp:5018
Gecode::Brancher
Base-class for branchers.
Definition core.hpp:1442
Gecode::Brancher::choice
virtual const Choice * choice(Space &home)=0
Return choice.
Gecode::Brancher::Space
friend class Space
Definition core.hpp:1444
Gecode::Brancher::commit
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int a)=0
Commit for choice c and alternative a.
Gecode::Brancher::ActorLink
friend class ActorLink
Definition core.hpp:1443
Gecode::Brancher::id
unsigned int id(void) const
Return brancher id.
Definition core.hpp:3629
Gecode::Brancher::choice
virtual const Choice * choice(const Space &home, Archive &e)=0
Return choice from e.
Gecode::Brancher::group
BrancherGroup group(void) const
Return group brancher belongs to.
Definition core.hpp:3634
Gecode::Brancher::status
virtual bool status(const Space &home) const =0
Check status of brancher, return true if alternatives left.
Gecode::Brancher::ngl
virtual NGL * ngl(Space &home, const Choice &c, unsigned int a) const
Create no-good literal for choice c and alternative a.
Definition core.cpp:92
Gecode::Brancher::Brancher
Brancher(Home home)
Constructor for creation.
Definition core.hpp:3605
Gecode::Brancher::Choice
friend class Choice
Definition core.hpp:1445
Gecode::Branchers::operator++
void operator++(void)
Move iterator to next brancher.
Definition core.hpp:5091
Gecode::Branchers::brancher
const Brancher & brancher(void) const
Return propagator.
Definition core.hpp:5097
Gecode::Branchers::operator()
bool operator()(void) const
Test whether there are branchers left.
Definition core.hpp:5087
Gecode::Branchers::Branchers
Branchers(const Space &home, BrancherGroup g)
Initialize.
Definition core.hpp:5081
Gecode::Choice
Choice for performing commit
Definition core.hpp:1412
Gecode::Choice::Choice
Choice(const Brancher &b, const unsigned int a)
Initialize for particular brancher b and alternatives a.
Definition core.hpp:3766
Gecode::Choice::Space
friend class Space
Definition core.hpp:1413
Gecode::Choice::archive
virtual void archive(Archive &e) const
Archive into e.
Definition core.cpp:891
Gecode::Choice::~Choice
virtual ~Choice(void)
Destructor.
Definition core.hpp:3780
Gecode::Choice::alternatives
unsigned int alternatives(void) const
Return number of alternatives.
Definition core.hpp:3770
Gecode::CloneStatistics
Statistics for execution of clone
Definition core.hpp:1709
Gecode::CloneStatistics::operator+
CloneStatistics operator+(const CloneStatistics &s)
Return sum with s.
Definition core.hpp:4716
Gecode::CloneStatistics::reset
void reset(void)
Reset information.
Definition core.hpp:4709
Gecode::CloneStatistics::operator+=
CloneStatistics & operator+=(const CloneStatistics &s)
Increment by statistics s.
Definition core.hpp:4721
Gecode::CloneStatistics::CloneStatistics
CloneStatistics(void)
Initialize.
Definition core.hpp:4712
Gecode::CommitStatistics
Statistics for execution of commit
Definition core.hpp:1725
Gecode::CommitStatistics::operator+=
CommitStatistics & operator+=(const CommitStatistics &s)
Increment by statistics s.
Definition core.hpp:4738
Gecode::CommitStatistics::reset
void reset(void)
Reset information.
Definition core.hpp:4726
Gecode::CommitStatistics::operator+
CommitStatistics operator+(const CommitStatistics &s)
Return sum with s.
Definition core.hpp:4733
Gecode::CommitStatistics::CommitStatistics
CommitStatistics(void)
Initialize.
Definition core.hpp:4729
Gecode::CommitTraceInfo
Commit trace information.
Definition core.hpp:1005
Gecode::CommitTraceInfo::group
BrancherGroup group(void) const
Return brancher group.
Definition core.hpp:3412
Gecode::CommitTraceInfo::Space
friend class Space
Definition core.hpp:1006
Gecode::CommitTraceInfo::alternative
unsigned int alternative(void) const
Return alternative.
Definition core.hpp:3424
Gecode::CommitTraceInfo::b
const Brancher & b
Brancher.
Definition core.hpp:1009
Gecode::CommitTraceInfo::CommitTraceInfo
CommitTraceInfo(const Brancher &b, const Choice &c, unsigned int a)
Initialize.
Definition core.hpp:3404
Gecode::CommitTraceInfo::id
unsigned int id(void) const
Return brancher identifier.
Definition core.hpp:3408
Gecode::CommitTraceInfo::a
unsigned int a
Alternative.
Definition core.hpp:1013
Gecode::CommitTraceInfo::c
const Choice & c
Choice.
Definition core.hpp:1011
Gecode::CommitTraceInfo::choice
const Choice & choice(void) const
Return choice.
Definition core.hpp:3420
Gecode::CommitTraceInfo::brancher
const Brancher & brancher(void) const
Return brancher.
Definition core.hpp:3416
Gecode::Council
Council of advisors
Definition core.hpp:1241
Gecode::Council::empty
bool empty(void) const
Test whether council has advisor left.
Definition core.hpp:3916
Gecode::Council::update
void update(Space &home, Council< A > &c)
Update during cloning (copies all advisors).
Definition core.hpp:3926
Gecode::Council::dispose
void dispose(Space &home)
Dispose council.
Definition core.hpp:3971
Gecode::Council::Advisor
friend class Advisor
Definition core.hpp:1242
Gecode::Council::Council
Council(void)
Default constructor.
Definition core.hpp:3907
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::Delta::VarImp
friend class VarImp
Definition core.hpp:205
Gecode::FreeList
Base-class for freelist-managed objects.
Definition manager.hpp:98
Gecode::Group
Group baseclass for controlling actors.
Definition core.hpp:673
Gecode::Group::all
static Group all
Group of all actors.
Definition core.hpp:717
Gecode::Group::def
static Group def
Group of actors not in any user-defined group.
Definition core.hpp:720
Gecode::Group::GROUPID_ALL
static const unsigned int GROUPID_ALL
Fake id for group of all actors.
Definition core.hpp:683
Gecode::Group::Group
Group(void)
Constructor.
Definition core.cpp:921
Gecode::Group::in
bool in(void) const
Check whether this is a real group (and not just default).
Definition core.hpp:4961
Gecode::Group::CommitTraceInfo
friend class CommitTraceInfo
Definition core.hpp:679
Gecode::Group::m
static Support::Mutex m
Mutex for protection.
Definition core.hpp:695
Gecode::Group::PostTraceInfo
friend class PostTraceInfo
Definition core.hpp:680
Gecode::Group::GROUPID_MAX
static const unsigned int GROUPID_MAX
The maximal group number.
Definition core.hpp:687
Gecode::Group::operator=
Group & operator=(const Group &g)
Assignment operator.
Definition core.hpp:4969
Gecode::Group::id
unsigned int id(void) const
Return a unique id for the group.
Definition core.hpp:4974
Gecode::Group::GROUPID_DEF
static const unsigned int GROUPID_DEF
Pre-defined default group id.
Definition core.hpp:685
Gecode::Group::gid
unsigned int gid
The group id.
Definition core.hpp:689
Gecode::Group::Propagator
friend class Propagator
Definition core.hpp:675
Gecode::Group::Brancher
friend class Brancher
Definition core.hpp:676
Gecode::Group::next
static unsigned int next
Next group id.
Definition core.hpp:692
Gecode::Group::PropagateTraceInfo
friend class PropagateTraceInfo
Definition core.hpp:678
Gecode::Group::Group
Group(unsigned int gid0)
Construct with predefined group id gid0.
Definition core.hpp:4953
Gecode::Group::Home
friend class Home
Definition core.hpp:674
Gecode::Group::ViewTraceInfo
friend class ViewTraceInfo
Definition core.hpp:677
Gecode::HeapAllocated
Base class for heap allocated objects.
Definition heap.hpp:340
Gecode::Heap::copy
static T * copy(T *d, const T *s, long unsigned int n)
Copy n objects starting at s to d.
Definition heap.hpp:583
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Home::pg
PropagatorGroup pg
A propagator group.
Definition core.hpp:864
Gecode::Home::branchergroup
BrancherGroup branchergroup(void) const
Return brancher group.
Definition core.hpp:3307
Gecode::Home::notice
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Definition core.hpp:3219
Gecode::Home::Home
Home(Space &s, Propagator *p=NULL, PropagatorGroup pg=PropagatorGroup::def, BrancherGroup bg=BrancherGroup::def)
Initialize the home with space s and propagator p and group g.
Definition core.hpp:3262
Gecode::Home::p
Propagator * p
A propagator (possibly) that is currently being rewritten.
Definition core.hpp:862
Gecode::Home::s
Space & s
The space where the propagator is to be posted.
Definition core.hpp:860
Gecode::Home::fail
void fail(void)
Mark space as failed.
Definition core.hpp:4039
Gecode::Home::bg
BrancherGroup bg
A brancher group.
Definition core.hpp:866
Gecode::Home::propagator
Propagator * propagator(void) const
Return propagator (or NULL) for currently rewritten propagator.
Definition core.hpp:3299
Gecode::Home::propagatorgroup
PropagatorGroup propagatorgroup(void) const
Return propagator group.
Definition core.hpp:3303
Gecode::Home::PostInfo
friend class PostInfo
Definition core.hpp:857
Gecode::Home::operator()
Home operator()(Propagator &p)
Return a home extended by propagator to be rewritten.
Definition core.hpp:3275
Gecode::Home::failed
bool failed(void) const
Check whether corresponding space is failed.
Definition core.hpp:4048
Gecode::Home::operator=
Home & operator=(const Home &h)
Assignment operator.
Definition core.hpp:3266
Gecode::Kernel::GPI::Info
Class for storing propagator information.
Definition gpi.hpp:42
Gecode::Kernel::GPI::Info::gid
unsigned int gid
Group identifier.
Definition gpi.hpp:47
Gecode::Kernel::MemoryManager
Manage memory for space.
Definition manager.hpp:120
Gecode::Kernel::MemoryManager::subscriptions
void * subscriptions(void) const
Get the memory area for subscriptions.
Definition manager.hpp:297
Gecode::Kernel::SharedSpaceData
Class to store data shared among several spaces.
Definition shared-space-data.hpp:37
Gecode::LocalHandle
Handles for local (space-shared) objects.
Definition core.hpp:1558
Gecode::LocalHandle::LocalHandle
LocalHandle(void)
Create local handle pointing to NULL object.
Definition core.hpp:3739
Gecode::LocalHandle::~LocalHandle
~LocalHandle(void)
Destructor.
Definition core.hpp:3750
Gecode::LocalHandle::update
void update(Space &home, LocalHandle &lh)
Updating during cloning.
Definition core.hpp:3756
Gecode::LocalHandle::operator=
LocalHandle & operator=(const LocalHandle &lh)
Assignment operator.
Definition core.hpp:3745
Gecode::LocalHandle::object
LocalObject * object(void) const
Access to the local object.
Definition core.hpp:3752
Gecode::LocalObject
Local (space-shared) object.
Definition core.hpp:1533
Gecode::LocalObject::cast
static LocalObject * cast(ActorLink *al)
Static cast for a non-null pointer (to give a hint to optimizer).
Definition core.hpp:3705
Gecode::LocalObject::Space
friend class Space
Definition core.hpp:1535
Gecode::LocalObject::fwd
LocalObject * fwd(Space &home)
Return forwarding pointer.
Definition core.hpp:3732
Gecode::LocalObject::ActorLink
friend class ActorLink
Definition core.hpp:1534
Gecode::LocalObject::LocalObject
LocalObject(Home home)
Constructor for creation.
Definition core.hpp:3721
Gecode::LocalObject::LocalHandle
friend class LocalHandle
Definition core.hpp:1536
Gecode::MetaInfo
Information passed by meta search engines.
Definition core.hpp:1613
Gecode::MetaInfo::nogoods
const NoGoods & nogoods(void) const
Return no-goods recorded from restart.
Definition core.hpp:3106
Gecode::MetaInfo::fail
unsigned long int fail(void) const
Return number of failures since last restart.
Definition core.hpp:3096
Gecode::MetaInfo::Type
Type
Which type of information is provided.
Definition core.hpp:1616
Gecode::MetaInfo::PORTFOLIO
@ PORTFOLIO
Information is provided by a portfolio-based engine.
Definition core.hpp:1620
Gecode::MetaInfo::RESTART
@ RESTART
Information is provided by a restart-based engine.
Definition core.hpp:1618
Gecode::MetaInfo::solution
unsigned long int solution(void) const
Return number of solutions since last restart.
Definition core.hpp:3091
Gecode::MetaInfo::t
const Type t
Type of information.
Definition core.hpp:1624
Gecode::MetaInfo::asset
unsigned int asset(void) const
Return number of asset in portfolio.
Definition core.hpp:3111
Gecode::MetaInfo::l
const Space * l
Last solution found.
Definition core.hpp:1634
Gecode::MetaInfo::restart
unsigned long int restart(void) const
Return number of restarts.
Definition core.hpp:3086
Gecode::MetaInfo::last
const Space * last(void) const
Return last solution found (possibly NULL).
Definition core.hpp:3101
Gecode::MetaInfo::r
const unsigned long int r
Number of restarts.
Definition core.hpp:1628
Gecode::MetaInfo::MetaInfo
MetaInfo(unsigned long int r, unsigned long int s, unsigned long int f, const Space *l, NoGoods &ng)
Constructor for restart-based engine.
Definition core.hpp:3070
Gecode::MetaInfo::a
const unsigned int a
Number of asset in portfolio.
Definition core.hpp:1641
Gecode::MetaInfo::ng
const NoGoods & ng
No-goods from restart.
Definition core.hpp:1636
Gecode::MetaInfo::f
const unsigned long int f
Number of failures since last restart.
Definition core.hpp:1632
Gecode::MetaInfo::type
Type type(void) const
Return type of information.
Definition core.hpp:3082
Gecode::MetaInfo::s
const unsigned long int s
Number of solutions since last restart.
Definition core.hpp:1630
Gecode::NGL
No-good literal recorded during search.
Definition core.hpp:1340
Gecode::NGL::leaf
bool leaf(void) const
Test whether literal is a leaf.
Definition core.hpp:3789
Gecode::NGL::prune
virtual ExecStatus prune(Space &home)=0
Propagate the negation of the no-good literal.
Gecode::NGL::cancel
virtual void cancel(Space &home, Propagator &p)=0
Cancel propagator p from all views of the no-good literal.
Gecode::NGL::subscribe
virtual void subscribe(Space &home, Propagator &p)=0
Subscribe propagator p to all views of the no-good literal.
Gecode::NGL::status
virtual NGL::Status status(const Space &home) const =0
Test the status of the no-good literal.
Gecode::NGL::NGL
NGL(void)
Constructor for creation.
Definition core.hpp:3812
Gecode::NGL::copy
virtual NGL * copy(Space &home)=0
Create copy.
Gecode::NGL::Status
Status
The status of a no-good literal.
Definition core.hpp:1346
Gecode::NGL::SUBSUMED
@ SUBSUMED
The literal is subsumed.
Definition core.hpp:1348
Gecode::NGL::FAILED
@ FAILED
The literal is failed.
Definition core.hpp:1347
Gecode::NGL::NONE
@ NONE
The literal is neither failed nor subsumed.
Definition core.hpp:1349
Gecode::NGL::reschedule
virtual void reschedule(Space &home, Propagator &p)=0
Schedule propagator p for all views of the no-good literal.
Gecode::NGL::next
NGL * next(void) const
Return pointer to next literal.
Definition core.hpp:3793
Gecode::NGL::dispose
virtual size_t dispose(Space &home)
Dispose.
Definition core.hpp:3821
Gecode::NGL::add
NGL * add(NGL *n, bool l)
Add node n and mark it as leaf l and return n.
Definition core.hpp:3805
Gecode::NGL::notice
virtual bool notice(void) const
Whether dispose must always be called (returns false).
Definition core.cpp:896
Gecode::NoGoods
No-goods recorded from restarts.
Definition core.hpp:1588
Gecode::NoGoods::post
virtual void post(Space &home) const
Post no-goods.
Definition core.cpp:82
Gecode::NoGoods::eng
static NoGoods eng
Empty no-goods.
Definition core.hpp:1606
Gecode::NoGoods::~NoGoods
virtual ~NoGoods(void)
Destructor.
Definition core.hpp:3063
Gecode::NoGoods::NoGoods
NoGoods(void)
Initialize.
Definition core.hpp:3052
Gecode::NoGoods::ng
unsigned long int ng(void) const
Return number of no-goods posted.
Definition core.hpp:3055
Gecode::NoGoods::n
unsigned long int n
Number of no-goods.
Definition core.hpp:1591
Gecode::NoIdxVarImpConf
Configuration class for variable implementations without index structure.
Definition core.hpp:98
Gecode::NoIdxVarImpConf::med_update
static bool med_update(ModEventDelta &med, ModEvent me)
Update modification even delta med by me, return true on change.
Definition core.hpp:125
Gecode::NoIdxVarImpConf::free_bits
static const int free_bits
Freely available bits.
Definition core.hpp:107
Gecode::NoIdxVarImpConf::idx_c
static const int idx_c
Index for update.
Definition core.hpp:101
Gecode::NoIdxVarImpConf::med_fst
static const int med_fst
Start of bits for modification event delta.
Definition core.hpp:109
Gecode::NoIdxVarImpConf::med_lst
static const int med_lst
End of bits for modification event delta.
Definition core.hpp:111
Gecode::NoIdxVarImpConf::pc_max
static const PropCond pc_max
Maximal propagation condition.
Definition core.hpp:105
Gecode::NoIdxVarImpConf::idx_d
static const int idx_d
Index for disposal.
Definition core.hpp:103
Gecode::NoIdxVarImpConf::me_combine
static Gecode::ModEvent me_combine(ModEvent me1, ModEvent me2)
Combine modification events me1 and me2.
Definition core.hpp:121
Gecode::NoIdxVarImpConf::med_mask
static const int med_mask
Bitmask for modification event delta.
Definition core.hpp:113
Gecode::PostInfo
Class to set group information when a post function is executed.
Definition core.hpp:948
Gecode::PostInfo::h
Space & h
The home space.
Definition core.hpp:952
Gecode::PostInfo::Space
friend class Space
Definition core.hpp:949
Gecode::PostInfo::PostInfo
PostInfo(Home home)
Set information.
Definition core.hpp:3356
Gecode::PostInfo::nested
bool nested
Whether it is used nested.
Definition core.hpp:958
Gecode::PostInfo::pid
unsigned int pid
Next free propagator id.
Definition core.hpp:956
Gecode::PostInfo::pg
PropagatorGroup pg
The propagator group.
Definition core.hpp:954
Gecode::PostInfo::~PostInfo
~PostInfo(void)
Reset information.
Definition core.hpp:3364
Gecode::PostTraceInfo
Post trace information.
Definition core.hpp:1032
Gecode::PostTraceInfo::propagators
unsigned int propagators(void) const
Return number of posted propagators.
Definition core.hpp:3445
Gecode::PostTraceInfo::Space
friend class Space
Definition core.hpp:1033
Gecode::PostTraceInfo::group
PropagatorGroup group(void) const
Return propagator group.
Definition core.hpp:3437
Gecode::PostTraceInfo::g
PropagatorGroup g
Propagator group.
Definition core.hpp:1044
Gecode::PostTraceInfo::Status
Status
Post status.
Definition core.hpp:1037
Gecode::PostTraceInfo::SUBSUMED
@ SUBSUMED
Propagator not posted as already subsumed.
Definition core.hpp:1040
Gecode::PostTraceInfo::FAILED
@ FAILED
Posting failed.
Definition core.hpp:1039
Gecode::PostTraceInfo::POSTED
@ POSTED
Propagator was posted.
Definition core.hpp:1038
Gecode::PostTraceInfo::status
Status status(void) const
Return post status.
Definition core.hpp:3441
Gecode::PostTraceInfo::PostInfo
friend class PostInfo
Definition core.hpp:1034
Gecode::PostTraceInfo::PostTraceInfo
PostTraceInfo(PropagatorGroup g, Status s, unsigned int n)
Initialize.
Definition core.hpp:3434
Gecode::PostTraceInfo::s
Status s
Status.
Definition core.hpp:1046
Gecode::PostTraceInfo::n
unsigned int n
Number of posted propagators.
Definition core.hpp:1048
Gecode::PropCost
Propagation cost.
Definition core.hpp:486
Gecode::PropCost::ac
ActualCost ac
Actual cost.
Definition core.hpp:509
Gecode::PropCost::Space
friend class Space
Definition core.hpp:487
Gecode::PropCost::unary
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition core.hpp:4813
Gecode::PropCost::ternary
static PropCost ternary(PropCost::Mod m)
Three variables for modifier pcm.
Definition core.hpp:4805
Gecode::PropCost::record
static PropCost record(void)
For recording information (no propagation allowed).
Definition core.hpp:4765
Gecode::PropCost::crazy
static PropCost crazy(PropCost::Mod m, unsigned int n)
Exponential complexity for modifier m and size measure n.
Definition core.hpp:4769
Gecode::PropCost::quadratic
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
Definition core.hpp:4787
Gecode::PropCost::linear
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
Definition core.hpp:4796
Gecode::PropCost::cubic
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Definition core.hpp:4778
Gecode::PropCost::binary
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition core.hpp:4809
Gecode::PropCost::Mod
Mod
Propagation cost modifier.
Definition core.hpp:512
Gecode::PropCost::LO
@ LO
Cheap.
Definition core.hpp:513
Gecode::PropCost::HI
@ HI
Expensive.
Definition core.hpp:514
Gecode::PropCost::ActualCost
ActualCost
The actual cost values that are used.
Definition core.hpp:490
Gecode::PropCost::AC_TERNARY_LO
@ AC_TERNARY_LO
Three variables, cheap.
Definition core.hpp:502
Gecode::PropCost::AC_TERNARY_HI
@ AC_TERNARY_HI
Three variables, expensive.
Definition core.hpp:500
Gecode::PropCost::AC_BINARY_LO
@ AC_BINARY_LO
Two variables, cheap.
Definition core.hpp:503
Gecode::PropCost::AC_CUBIC_LO
@ AC_CUBIC_LO
Cubic complexity, cheap.
Definition core.hpp:494
Gecode::PropCost::AC_UNARY_HI
@ AC_UNARY_HI
Only single variable, expensive.
Definition core.hpp:505
Gecode::PropCost::AC_RECORD
@ AC_RECORD
Reserved for recording information.
Definition core.hpp:491
Gecode::PropCost::AC_BINARY_HI
@ AC_BINARY_HI
Two variables, expensive.
Definition core.hpp:501
Gecode::PropCost::AC_LINEAR_HI
@ AC_LINEAR_HI
Linear complexity, expensive.
Definition core.hpp:498
Gecode::PropCost::AC_CUBIC_HI
@ AC_CUBIC_HI
Cubic complexity, expensive.
Definition core.hpp:495
Gecode::PropCost::AC_MAX
@ AC_MAX
Maximal cost value.
Definition core.hpp:506
Gecode::PropCost::AC_CRAZY_LO
@ AC_CRAZY_LO
Exponential complexity, cheap.
Definition core.hpp:492
Gecode::PropCost::AC_LINEAR_LO
@ AC_LINEAR_LO
Linear complexity, cheap.
Definition core.hpp:499
Gecode::PropCost::AC_UNARY_LO
@ AC_UNARY_LO
Only single variable, cheap.
Definition core.hpp:504
Gecode::PropCost::AC_QUADRATIC_LO
@ AC_QUADRATIC_LO
Quadratic complexity, cheap.
Definition core.hpp:496
Gecode::PropCost::AC_CRAZY_HI
@ AC_CRAZY_HI
Exponential complexity, expensive.
Definition core.hpp:493
Gecode::PropCost::AC_QUADRATIC_HI
@ AC_QUADRATIC_HI
Quadratic complexity, expensive.
Definition core.hpp:497
Gecode::PropagateTraceInfo
Propagate trace information.
Definition core.hpp:969
Gecode::PropagateTraceInfo::i
unsigned int i
Propagator id.
Definition core.hpp:981
Gecode::PropagateTraceInfo::Space
friend class Space
Definition core.hpp:970
Gecode::PropagateTraceInfo::Status
Status
Propagator status.
Definition core.hpp:973
Gecode::PropagateTraceInfo::SUBSUMED
@ SUBSUMED
Propagator is subsumed.
Definition core.hpp:977
Gecode::PropagateTraceInfo::FIX
@ FIX
Propagator computed fixpoint.
Definition core.hpp:974
Gecode::PropagateTraceInfo::NOFIX
@ NOFIX
Propagator did not compute fixpoint.
Definition core.hpp:975
Gecode::PropagateTraceInfo::FAILED
@ FAILED
Propagator failed.
Definition core.hpp:976
Gecode::PropagateTraceInfo::PropagateTraceInfo
PropagateTraceInfo(unsigned int i, PropagatorGroup g, const Propagator *p, Status s)
Initialize.
Definition core.hpp:3378
Gecode::PropagateTraceInfo::propagator
const Propagator * propagator(void) const
Return pointer to non-subsumed propagator.
Definition core.hpp:3390
Gecode::PropagateTraceInfo::s
Status s
Status.
Definition core.hpp:987
Gecode::PropagateTraceInfo::id
unsigned int id(void) const
Return propagator identifier.
Definition core.hpp:3382
Gecode::PropagateTraceInfo::status
Status status(void) const
Return propagator status.
Definition core.hpp:3394
Gecode::PropagateTraceInfo::p
const Propagator * p
Propagator.
Definition core.hpp:985
Gecode::PropagateTraceInfo::g
PropagatorGroup g
Propagator group.
Definition core.hpp:983
Gecode::PropagateTraceInfo::group
PropagatorGroup group(void) const
Return propagator group.
Definition core.hpp:3386
Gecode::PropagatorGroup
Group of propagators.
Definition core.hpp:727
Gecode::PropagatorGroup::size
unsigned int size(Space &home) const
Return number of propagators in a group.
Definition core.cpp:955
Gecode::PropagatorGroup::operator==
bool operator==(PropagatorGroup g) const
Test whether this group is equal to group g.
Definition core.hpp:5001
Gecode::PropagatorGroup::def
static PropagatorGroup def
Group of propagators not in any user-defined group.
Definition core.hpp:792
Gecode::PropagatorGroup::move
PropagatorGroup & move(Space &home, PropagatorGroup g)
Move propagators from group g to this group.
Definition core.cpp:932
Gecode::PropagatorGroup::PostTraceInfo
friend class PostTraceInfo
Definition core.hpp:731
Gecode::PropagatorGroup::PropagatorGroup
PropagatorGroup(unsigned int gid)
Initialize with group id gid.
Definition core.hpp:4983
Gecode::PropagatorGroup::operator!=
bool operator!=(PropagatorGroup g) const
Test whether this group is different from group g.
Definition core.hpp:5005
Gecode::PropagatorGroup::PropagatorGroup
PropagatorGroup(void)
Constructor.
Definition core.hpp:4980
Gecode::PropagatorGroup::operator=
PropagatorGroup & operator=(const PropagatorGroup &g)
Assignment operator.
Definition core.hpp:4991
Gecode::PropagatorGroup::Propagator
friend class Propagator
Definition core.hpp:728
Gecode::PropagatorGroup::disable
void disable(Space &home)
Disable all propagators in a group.
Definition core.cpp:979
Gecode::PropagatorGroup::enable
void enable(Space &home, bool s=true)
Enable all propagators in a group.
Definition core.cpp:988
Gecode::PropagatorGroup::operator()
Home operator()(Space &home)
To augment a space argument.
Definition core.hpp:4996
Gecode::PropagatorGroup::PropagateTraceInfo
friend class PropagateTraceInfo
Definition core.hpp:730
Gecode::PropagatorGroup::kill
void kill(Space &home)
Kill all propagators in a group.
Definition core.cpp:966
Gecode::PropagatorGroup::ViewTraceInfo
friend class ViewTraceInfo
Definition core.hpp:729
Gecode::PropagatorGroup::all
static PropagatorGroup all
Group of all propagators.
Definition core.hpp:789
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Propagator::reschedule
virtual void reschedule(Space &home)=0
Schedule function.
Gecode::Propagator::size
size_t size
The size of the propagator (used during subsumption).
Definition core.hpp:1077
Gecode::Propagator::SubscribedPropagators
friend class SubscribedPropagators
Definition core.hpp:1070
Gecode::Propagator::Space
friend class Space
Definition core.hpp:1066
Gecode::Propagator::afc
double afc(void) const
Return the accumlated failure count.
Definition core.hpp:3525
Gecode::Propagator::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const =0
Cost function.
Gecode::Propagator::advise
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Advise function.
Definition core.cpp:67
Gecode::Propagator::ActorLink
friend class ActorLink
Definition core.hpp:1065
Gecode::Propagator::gpi
Kernel::GPI::Info & gpi(void)
Provide access to global propagator information.
Definition core.hpp:3493
Gecode::Propagator::id
unsigned int id(void) const
Return propagator id.
Definition core.hpp:3542
Gecode::Propagator::VarImp
friend class VarImp
Definition core.hpp:1067
Gecode::Propagator::Advisor
friend class Advisor
Definition core.hpp:1068
Gecode::Propagator::group
PropagatorGroup group(void) const
Return group propagator belongs to.
Definition core.hpp:3547
Gecode::Propagator::modeventdelta
ModEventDelta modeventdelta(void) const
Return the modification event delta.
Definition core.hpp:3520
Gecode::Propagator::fwd
Propagator * fwd(void) const
Return forwarding pointer during copying.
Definition core.hpp:3471
Gecode::Propagator::PropagatorGroup
friend class PropagatorGroup
Definition core.hpp:1071
Gecode::Propagator::Council
friend class Council
Definition core.hpp:1069
Gecode::Propagator::disabled
bool disabled(void) const
Whether propagator is currently disabled.
Definition core.hpp:3476
Gecode::Propagator::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)=0
Propagation function.
Gecode::Propagator::med
ModEventDelta med
A set of modification events (used during propagation).
Definition core.hpp:1075
Gecode::Propagator::Propagator
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3498
Gecode::Propagator::advisors
Gecode::ActorLink * advisors
A list of advisors (used during cloning).
Definition core.hpp:1079
Gecode::Propagators::operator()
bool operator()(void) const
Test whether there are propagators left.
Definition core.hpp:5066
Gecode::Propagators::propagator
const Propagator & propagator(void) const
Return propagator.
Definition core.hpp:5076
Gecode::Propagators::operator++
void operator++(void)
Move iterator to next propagator.
Definition core.hpp:5070
Gecode::Propagators::Propagators
Propagators(const Space &home, PropagatorGroup g)
Initialize.
Definition core.hpp:5060
Gecode::Space::Branchers
Class to iterate over branchers of a space.
Definition core.hpp:2735
Gecode::Space::Branchers::brancher
Brancher & brancher(void) const
Return propagator.
Definition core.hpp:4944
Gecode::Space::Branchers::operator++
void operator++(void)
Move iterator to next brancher.
Definition core.hpp:4940
Gecode::Space::Branchers::Branchers
Branchers(Space &home)
Initialize.
Definition core.hpp:4933
Gecode::Space::Branchers::operator()
bool operator()(void) const
Test whether there are branchers left.
Definition core.hpp:4936
Gecode::Space::IdlePropagators::operator++
void operator++(void)
Move iterator to next propagator.
Definition core.hpp:4923
Gecode::Space::IdlePropagators::propagator
Propagator & propagator(void) const
Return propagator.
Definition core.hpp:4927
Gecode::Space::IdlePropagators::operator()
bool operator()(void) const
Test whether there are propagators left.
Definition core.hpp:4919
Gecode::Space::IdlePropagators::IdlePropagators
IdlePropagators(Space &home)
Initialize.
Definition core.hpp:4914
Gecode::Space::Propagators
Class to iterate over propagators of a space.
Definition core.hpp:2664
Gecode::Space::Propagators::operator()
bool operator()(void) const
Test whether there are propagators left.
Definition core.hpp:4840
Gecode::Space::Propagators::Propagators
Propagators(Space &home)
Initialize.
Definition core.hpp:4822
Gecode::Space::Propagators::operator++
void operator++(void)
Move iterator to next propagator.
Definition core.hpp:4844
Gecode::Space::Propagators::propagator
Propagator & propagator(void) const
Return propagator.
Definition core.hpp:4868
Gecode::Space::ScheduledPropagators::ScheduledPropagators
ScheduledPropagators(Space &home)
Initialize.
Definition core.hpp:4874
Gecode::Space::ScheduledPropagators::propagator
Propagator & propagator(void) const
Return propagator.
Definition core.hpp:4908
Gecode::Space::ScheduledPropagators::operator()
bool operator()(void) const
Test whether there are propagators left.
Definition core.hpp:4886
Gecode::Space::ScheduledPropagators::operator++
void operator++(void)
Move iterator to next propagator.
Definition core.hpp:4890
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Space::realloc
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.
Definition core.hpp:2888
Gecode::Space::trace
friend void trace(Home home, TraceFilter tf, int te, Tracer &t)
Create tracer.
Definition general.cpp:39
Gecode::Space::p
struct Gecode::Space::@055132133326276162005044145100211202071356247106::@275070317317120154232063063134255170030071110047 p
Data only available during propagation or branching.
Gecode::Space::ralloc
void * ralloc(size_t s)
Allocate memory on space heap.
Definition core.hpp:2799
Gecode::Space::afc_decay
double afc_decay(void) const
Return AFC decay factor.
Definition core.hpp:3242
Gecode::Space::c
struct Gecode::Space::@055132133326276162005044145100211202071356247106::@155123175027073262103111264343315000271204104107 c
Data available only during copying.
Gecode::Space::afc_unshare
void afc_unshare(void)
Unshare AFC information for all propagators.
Definition core.cpp:869
Gecode::Space::construct
T & construct(void)
Construction routines.
Definition core.hpp:5108
Gecode::Space::LocalObject
friend class LocalObject
Definition core.hpp:1754
Gecode::Space::queue
ActorLink queue[PropCost::AC_MAX+1]
Scheduled propagators according to cost.
Definition core.hpp:1832
Gecode::Space::local
LocalObject * local
Linked list of local objects.
Definition core.hpp:1852
Gecode::Space::rrealloc
void * rrealloc(void *b, size_t n, size_t m)
Reallocate memory block starting at b from size n to size s.
Definition core.hpp:2807
Gecode::Space::VarImpDisposer
friend class VarImpDisposer
Definition core.hpp:1753
Gecode::Space::rfree
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later).
Definition core.hpp:2803
Gecode::Space::vars_noidx
VarImpBase * vars_noidx
Keep variables during copying without index structure.
Definition core.hpp:1850
Gecode::Space::fl_alloc
void * fl_alloc(void)
Allocate from freelist-managed memory.
Definition core.hpp:2822
Gecode::Space::AFC
friend class AFC
Definition core.hpp:1756
Gecode::Space::vars_u
VarImpBase * vars_u[AllVarConf::idx_c]
Entries for updating variables.
Definition core.hpp:1848
Gecode::Space::VarImp
friend class VarImp
Definition core.hpp:1752
Gecode::Space::Advisor
friend class Advisor
Definition core.hpp:1750
Gecode::Space::PostInfo
friend class PostInfo
Definition core.hpp:1757
Gecode::Space::afc_decay
void afc_decay(double d)
Set AFC decay factor to d
Definition core.hpp:3247
Gecode::Space::Propagator
friend class Propagator
Definition core.hpp:1744
Gecode::Space::fl_dispose
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
Definition core.hpp:2827
Gecode::Space::n_sub
unsigned int n_sub
Number of subscriptions.
Definition core.hpp:1841
Gecode::Space::PropagatorGroup
friend class PropagatorGroup
Definition core.hpp:1745
Gecode::Space::Region
friend class Region
Definition core.hpp:1755
Gecode::Space::Brancher
friend class Brancher
Definition core.hpp:1747
Gecode::Space::Council
friend class Council
Definition core.hpp:1751
Gecode::Space::alloc
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition core.hpp:2837
Gecode::Space::bid_sc
unsigned int bid_sc
Id of next brancher to be created plus status control.
Definition core.hpp:1839
Gecode::Space::BrancherGroup
friend class BrancherGroup
Definition core.hpp:1748
Gecode::Space::active
ActorLink * active
Cost level with next propagator to be executed.
Definition core.hpp:1830
Gecode::Space::free
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
Definition core.hpp:2863
Gecode::Space::vti
ViewTraceInfo vti
View trace information.
Definition core.hpp:1843
Gecode::Space::Actor
friend class Actor
Definition core.hpp:1743
Gecode::Space::operator()
Home operator()(Propagator &p)
Return a home for this space with the information that p is being rewritten.
Definition core.hpp:3287
Gecode::StatusStatistics
Statistics for execution of status
Definition core.hpp:1691
Gecode::StatusStatistics::propagate
unsigned long int propagate
Number of propagator executions.
Definition core.hpp:1694
Gecode::StatusStatistics::reset
void reset(void)
Reset information.
Definition core.hpp:4690
Gecode::StatusStatistics::StatusStatistics
StatusStatistics(void)
Initialize.
Definition core.hpp:4694
Gecode::StatusStatistics::operator+
StatusStatistics operator+(const StatusStatistics &s)
Return sum with s.
Definition core.hpp:4703
Gecode::StatusStatistics::operator+=
StatusStatistics & operator+=(const StatusStatistics &s)
Increment by statistics s.
Definition core.hpp:4698
Gecode::SubscribedPropagators
Iterator over subscribed propagators.
Definition subscribed.hpp:36
Gecode::Support::Mutex
A mutex for mutual exclausion among several threads.
Definition thread.hpp:96
Gecode::TooManyBranchers
Exception: too many branchers
Definition exception.hpp:93
Gecode::TraceFilter
Trace filters.
Definition filter.hpp:133
Gecode::TraceRecorder
Propagator for recording trace information.
Definition recorder.hpp:154
Gecode::Tracer
Tracer.
Definition tracer.hpp:149
Gecode::VarImpBase
Base-class for variable implementations.
Definition core.hpp:172
Gecode::VarImpDisposerBase
Base class for Variable type disposer.
Definition core.hpp:180
Gecode::VarImpDisposerBase::dispose
virtual void dispose(Space &home, VarImpBase *x)
Dispose list of variable implementations starting at x.
Definition core.cpp:47
Gecode::VarImpDisposer::VarImpDisposer
VarImpDisposer(void)
Constructor (registers disposer with kernel).
Definition core.hpp:4670
Gecode::VarImpDisposer::dispose
virtual void dispose(Space &home, VarImpBase *x)
Dispose list of variable implementations starting at x.
Definition core.hpp:4678
Gecode::VarImp
Base-class for variable implementations.
Definition core.hpp:219
Gecode::VarImp::subscribe
void subscribe(Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me, bool schedule)
Subscribe propagator p with propagation condition pc.
Definition core.hpp:4382
Gecode::VarImp::fail
ModEvent fail(Space &home)
Run advisors to be run on failure and returns ME_GEN_FAILED.
Definition core.hpp:4570
Gecode::VarImp::cancel
void cancel(Space &home)
Cancel all subscriptions when variable implementation is assigned.
Definition core.hpp:4487
Gecode::VarImp::advise
bool advise(Space &home, ModEvent me, Delta &d)
Run advisors when variable implementation has been modified with modification event me and domain cha...
Definition core.hpp:4504
Gecode::VarImp::VarImp
VarImp(void)
Creation of static instances.
Definition core.hpp:4137
Gecode::VarImp::SubscribedPropagators
friend class SubscribedPropagators
Definition core.hpp:223
Gecode::VarImp::Space
friend class Space
Definition core.hpp:220
Gecode::VarImp::afc
double afc(void) const
Return accumulated failure count (plus degree).
Definition core.hpp:4165
Gecode::VarImp::bits
unsigned int bits(void) const
Provide access to free bits.
Definition core.hpp:4196
Gecode::VarImp::base
ActorLink ** base
Subscribed actors.
Definition core.hpp:233
Gecode::VarImp::copied
bool copied(void) const
Is variable already copied.
Definition core.hpp:4222
Gecode::VarImp::VarImpDisposer
friend class VarImpDisposer
Definition core.hpp:222
Gecode::VarImp::reschedule
static void reschedule(Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me)
Schedule propagator p.
Definition core.hpp:4407
Gecode::VarImp< Gecode::Float::FloatVarImpConf >::schedule
static void schedule(Space &home, Propagator &p, ModEvent me, bool force=false)
Definition core.hpp:4288
Gecode::VarImp::idx
unsigned int idx[pc_max+1]
Indices of subscribed actors.
Definition core.hpp:273
Gecode::VarImp::forward
VarImp * forward(void) const
Use forward pointer if variable already copied.
Definition core.hpp:4228
Gecode::VarImp< Gecode::Float::FloatVarImpConf >::me
static ModEvent me(const ModEventDelta &med)
Definition core.hpp:4270
Gecode::VarImp::next
VarImp * next(void) const
Return next copied variable.
Gecode::VarImp::me_combine
static ModEvent me_combine(ModEvent me1, ModEvent me2)
Combine modifications events me1 and me2.
Definition core.hpp:4282
Gecode::VarImp::Propagator
friend class Propagator
Definition core.hpp:221
Gecode::VarImp::degree
unsigned int degree(void) const
Return degree (number of subscribed propagators and advisors).
Definition core.hpp:4158
Gecode::VarImp::VarImp
VarImp(Space &home)
Creation.
Definition core.hpp:4121
Gecode::VarImp< Gecode::Float::FloatVarImpConf >::med
static ModEventDelta med(ModEvent me)
Definition core.hpp:4276
Gecode::VarImp::fwd
VarImp< VIC > * fwd
Forwarding pointer.
Definition core.hpp:242
Gecode::VarImp::next
VarImp< VIC > * next
During cloning, points to the next copied variable.
Definition core.hpp:275
Gecode::VarImp::modevent
static ModEvent modevent(const Delta &d)
Return modification event.
Definition core.hpp:4190
Gecode::ViewTraceInfo
View trace information.
Definition core.hpp:908
Gecode::ViewTraceInfo::what
What what(void) const
Return what is currently executing.
Definition core.hpp:3332
Gecode::ViewTraceInfo::Space
friend class Space
Definition core.hpp:909
Gecode::ViewTraceInfo::brancher
const Brancher & brancher(void) const
Return currently executing brancher.
Definition core.hpp:3342
Gecode::ViewTraceInfo::propagator
const Propagator & propagator(void) const
Return currently executing propagator.
Definition core.hpp:3336
Gecode::ViewTraceInfo::other
void other(void)
Record that nothing is known at this point.
Definition core.hpp:3328
Gecode::ViewTraceInfo::PostInfo
friend class PostInfo
Definition core.hpp:910
Gecode::ViewTraceInfo::What
What
What is currently executing.
Definition core.hpp:913
Gecode::ViewTraceInfo::BRANCHER
@ BRANCHER
A brancher is executing.
Definition core.hpp:917
Gecode::ViewTraceInfo::OTHER
@ OTHER
Unknown.
Definition core.hpp:921
Gecode::ViewTraceInfo::POST
@ POST
A post function is executing.
Definition core.hpp:919
Gecode::ViewTraceInfo::PROPAGATOR
@ PROPAGATOR
A propagator is currently executing.
Definition core.hpp:915
Gecode::ViewTraceInfo::post
PropagatorGroup post(void) const
Return propagator group of currently executing post function.
Definition core.hpp:3347
Gecode::ViewTraceInfo::who
ptrdiff_t who
Encoding a tagged pointer or a tagged group id.
Definition core.hpp:925
GECODE_KERNEL_REALLOC
#define GECODE_KERNEL_REALLOC(T)
Definition core.hpp:2923
pi
const int * pi[]
Definition photo.cpp:14262
Gecode::Int::OffsetView::update
void update(const NoOffset &)
Integer-precision integer scale view.
Definition view.hpp:638
Gecode::Space::ES_NOFIX_PARTIAL
ExecStatus ES_NOFIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has not computed partial fixpoint
Definition core.hpp:3576
Gecode::Space::ES_FIX_PARTIAL
ExecStatus ES_FIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has computed partial fixpoint
Definition core.hpp:3569
Gecode::Space::ES_SUBSUMED_DISPOSED
ExecStatus ES_SUBSUMED_DISPOSED(Propagator &p, size_t s)
Propagator p is subsumed
Definition core.hpp:3557
Gecode::Space::ES_FIX_DISPOSE
ExecStatus ES_FIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed
Definition core.hpp:3880
Gecode::Space::ES_NOFIX_DISPOSE_FORCE
ExecStatus ES_NOFIX_DISPOSE_FORCE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be forcefully rescheduled
Definition core.hpp:3894
Gecode::Space::ES_NOFIX_DISPOSE
ExecStatus ES_NOFIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be run
Definition core.hpp:3887
Gecode::Space::ES_SUBSUMED
ExecStatus ES_SUBSUMED(Propagator &p)
Definition core.hpp:3563
Gecode::Space::ignore
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Definition core.hpp:4074
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::Space::failed
bool failed(void) const
Check whether space is failed.
Definition core.hpp:4044
Gecode::ActorProperty
ActorProperty
Actor properties.
Definition core.hpp:553
Gecode::Space::notice
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Definition core.hpp:4059
Gecode::Space::stable
bool stable(void) const
Return if space is stable (at fixpoint or failed).
Definition core.hpp:4053
Gecode::Space::fail
void fail(void)
Fail space.
Definition core.hpp:4030
Gecode::AP_VIEW_TRACE
@ AP_VIEW_TRACE
Definition core.hpp:573
Gecode::AP_DISPOSE
@ AP_DISPOSE
Actor must always be disposed.
Definition core.hpp:562
Gecode::AP_TRACE
@ AP_TRACE
Definition core.hpp:578
Gecode::AP_WEAKLY
@ AP_WEAKLY
Definition core.hpp:568
Gecode::Space::Space
Space(void)
Default constructor.
Definition core.cpp:115
Gecode::Space::slave
virtual bool slave(const MetaInfo &mi)
Slave configuration function for meta search engines.
Definition core.cpp:863
Gecode::Space::constrain
virtual void constrain(const Space &best)
Constrain function for best solution search.
Definition core.cpp:841
Gecode::Space::master
virtual bool master(const MetaInfo &mi)
Master configuration function for meta search engines.
Definition core.cpp:845
Gecode::Space::copy
virtual Space * copy(void)=0
Copying member function.
Gecode::Space::trycommit
void trycommit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
If possible, commit choice c for alternative a.
Definition core.hpp:3237
Gecode::Space::choice
const Choice * choice(void)
Create new choice for current brancher.
Definition core.cpp:537
Gecode::Space::commit
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
Definition core.hpp:3232
Gecode::Space::ngl
NGL * ngl(const Choice &c, unsigned int a)
Create no-good literal for choice c and alternative a.
Definition core.cpp:641
Gecode::Space::status
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Definition core.cpp:252
Gecode::Space::clone
Space * clone(CloneStatistics &stat=unused_clone) const
Clone space.
Definition core.hpp:3224
Gecode::SpaceStatus
SpaceStatus
Space status
Definition core.hpp:1681
Gecode::SS_BRANCH
@ SS_BRANCH
Space must be branched (at least one brancher left)
Definition core.hpp:1684
Gecode::SS_SOLVED
@ SS_SOLVED
Space is solved (no brancher left)
Definition core.hpp:1683
Gecode::SS_FAILED
@ SS_FAILED
Space is failed
Definition core.hpp:1682
print
void print(const Search::Statistics &stat, bool restart)
Print statistics.
Definition job-shop.cpp:606
GECODE_KERNEL_EXPORT
#define GECODE_KERNEL_EXPORT
Definition kernel.hh:70
Gecode::Support::ptrjoin
void * ptrjoin(void *p, ptrdiff_t m)
Join unmarked pointer p and m into marked pointer.
Definition marked-pointer.hpp:83
Gecode::Support::ptrsplit
void * ptrsplit(void *p, ptrdiff_t &m)
Split possibly marked pointer p into mark m and unmarked pointer.
Definition marked-pointer.hpp:77
Gecode::Support::unmark
void * unmark(void *p)
Return unmarked pointer for a marked pointer p.
Definition marked-pointer.hpp:63
Gecode::Support::fmark
void * fmark(void *p)
Return marked pointer for p (possibly already marked).
Definition marked-pointer.hpp:68
Gecode::Support::funmark
void * funmark(void *p)
Return unmarked pointer for a possibly marked pointer p.
Definition marked-pointer.hpp:72
Gecode::Support::mark
void * mark(void *p)
Return marked pointer for unmarked pointer p.
Definition marked-pointer.hpp:58
Gecode::Support::marked
bool marked(void *p)
Check whether p is marked.
Definition marked-pointer.hpp:54
Gecode
Gecode toplevel namespace
Gecode::PC_GEN_ASSIGNED
const PropCond PC_GEN_ASSIGNED
Propagation condition for an assigned variable.
Definition core.hpp:76
Gecode::ME_GEN_NONE
const ModEvent ME_GEN_NONE
Generic modification event: no modification.
Definition core.hpp:67
Gecode::propagator
TFE propagator(PropagatorGroup g)
Only propagators (but not post functions) from g are considered.
Definition filter.cpp:131
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition core.hpp:476
Gecode::ES_FIX
@ ES_FIX
Propagation has computed fixpoint.
Definition core.hpp:477
Gecode::ES_NOFIX_FORCE
@ ES_NOFIX_FORCE
Advisor forces rescheduling of propagator.
Definition core.hpp:478
Gecode::__ES_SUBSUMED
@ __ES_SUBSUMED
Internal: propagator is subsumed, do not use.
Definition core.hpp:473
Gecode::__ES_PARTIAL
@ __ES_PARTIAL
Internal: propagator has computed partial fixpoint, do not use.
Definition core.hpp:479
Gecode::ES_FAILED
@ ES_FAILED
Execution has resulted in failure.
Definition core.hpp:474
Gecode::ES_NOFIX
@ ES_NOFIX
Propagation has not computed fixpoint.
Definition core.hpp:475
Gecode::ME_GEN_FAILED
const ModEvent ME_GEN_FAILED
Generic modification event: failed variable.
Definition core.hpp:65
Gecode::PropCond
int PropCond
Type for propagation conditions.
Definition core.hpp:72
Gecode::ME_GEN_ASSIGNED
const ModEvent ME_GEN_ASSIGNED
Generic modification event: variable is assigned a value.
Definition core.hpp:69
Gecode::PC_GEN_NONE
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience).
Definition core.hpp:74
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
Test::Float::Arithmetic::b
Gecode::FloatVal b(9, 12)
Test::Float::Arithmetic::a
Gecode::FloatVal a(-8, 5)
Test::Int::Unshare::f
Failed f
Definition unshare.cpp:124
forceinline
#define forceinline
Definition config.hpp:187
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56
GECODE_NOT_NULL
#define GECODE_NOT_NULL(p)
Assert that a pointer is never NULL.
Definition macros.hpp:75
GECODE_VTABLE_EXPORT
#define GECODE_VTABLE_EXPORT
Definition support.hh:72
var-type.hpp