54 unsigned long long int lf;
81 void update(
int i,
bool failed);
96 void update(
int i,
bool failed);
135 int size(
void)
const;
194 template<
class Char,
class Traits>
195 std::basic_ostream<Char,Traits>&
222 return (
_info & 1) != 0;
247 for (
int i=0; i<
x.size(); i++)
248 if (!
x[i].assigned())
249 x[i].subscribe(home,*
new (home)
Idx(home,*
this,
c,i),
true);
272 for (
int i=0; i<
n; i++) {
273 typename View::VarType xi(
x[i].varimp());
275 chb[i].qs = bm(home,xi,i);
278 for (
int i=0; i<
n; i++) {
295 double reward = 1.0 / (
nf -
chb[i].lf + 1);
298 double reward = 0.9 / (
nf -
chb[i].lf + 1);
321 assert((i >= 0) && (i <
object().n));
365 template<
class Char,
class Traits>
366 std::basic_ostream<Char,Traits>&
369 std::basic_ostringstream<Char,Traits> s;
370 s.copyfmt(os); s.width(0);
372 if (chb.
size() > 0) {
374 for (
int i=1; i<chb.
size(); i++)
378 return os << s.str();
407 x[as.advisor().idx()].cancel(home,as.advisor(),
true);
410 return sizeof(*this);
428 static_cast<Idx&
>(a).mark();
435 static_cast<Idx&
>(a).mark();
446 int i = as.advisor().idx();
447 if (as.advisor().marked()) {
448 as.advisor().unmark();
451 as.advisor().dispose(home,
c);
456 int i = as.advisor().idx();
457 if (as.advisor().marked()) {
458 as.advisor().unmark();
461 as.advisor().dispose(home,
c);
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Class to iterate over advisors of a council.
int size(void) const
Return size of array (number of elements)
unsigned long long int lf
Last failure.
Advisor with index and change information.
void unmark(void)
Mark advisor as unmodified.
bool marked(void) const
Whether advisor's view has been marked.
int idx(void) const
Get index of view.
void mark(void)
Mark advisor as modified.
Idx(Space &home, Propagator &p, Council< Idx > &c, int i)
Constructor for creation.
int _info
Index and mark information.
Propagator for recording chb information.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (record so that propagator runs last)
Recorder(Space &home, Recorder< View > &p)
Constructor for cloning p.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Council< Idx > c
The advisor council.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual void reschedule(Space &home)
Schedule function.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
static ExecStatus post(Home home, ViewArray< View > &x, CHB &chb)
Post chb recorder propagator.
CHB chb
Access to chb information.
Object for storing chb information.
int n
Number of chb values.
static Support::Mutex m
Mutex to synchronize globally shared access.
void bump(void)
Bump failure count and alpha.
void update(int i, bool failed)
Update chb information at position i.
Info * chb
CHB information.
Storage(Home home, ViewArray< View > &x, typename BranchTraits< typename View::VarType >::Merit bm)
Initialize CHB info.
unsigned long int nf
Number of failures.
Class for CHB management.
void update(int i)
Update chb value at position i.
CHB(void)
Construct as not yet intialized.
void init(Home home, ViewArray< View > &x, typename BranchTraits< typename View::VarType >::Merit bm)
Initialize for views x and Q-score as defined by bm.
int size(void) const
Return number of chb values.
Storage & object(void) const
Return object of correct type.
CHB & operator=(const CHB &a)
Assignment operator.
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const CHB &a)
Print chb values enclosed in curly brackets.
void bump(void)
Bump failure count and alpha.
void release(void)
Release mutex.
double operator[](int i) const
Return chb value at position i.
static const CHB def
Default (empty) chb information.
void acquire(void)
Acquire mutex.
Generic domain change information to be supplied to advisors.
Home class for posting propagators
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
NaryPropagator(Space &home, NaryPropagator &p)
static PropCost record(void)
For recording information (no propagation allowed)
Base-class for propagators.
ModEventDelta med
A set of modification events (used during propagation)
Propagator(Home home)
Constructor for posting.
SharedHandle(void)
Create shared handle with no object pointing to.
SharedHandle::Object * object(void) const
Access to the shared object.
A mutex for mutual exclausion among several threads.
void release(void)
Release the mutex.
void acquire(void)
Acquire the mutex and possibly block.
Heap heap
The single global heap.
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
int ModEventDelta
Modification event deltas.
bool failed(void) const
Check whether space is failed.
@ AP_DISPOSE
Actor must always be disposed.
#define GECODE_KERNEL_EXPORT
const double chb_alpha_decrement
Alpha decrement in CHB.
const double chb_qscore_init
Initial value for Q-score in CHB.
const double chb_alpha_limit
Limit for decreasing alpha in CHB.
Gecode toplevel namespace
Archive & operator<<(Archive &e, FloatNumBranch nl)
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_NOFIX
Propagation has not computed fixpoint.
const ModEvent ME_GEN_ASSIGNED
Generic modification event: variable is assigned a value.
Post propagator for SetVar x
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience)
#define GECODE_VTABLE_EXPORT