58 unsigned long long int lf;
74 unsigned long long int nf;
86 void update(
int i,
bool failed);
99 void update(
int i,
bool failed);
126 operator bool(
void)
const;
146 int size(
void)
const;
205 template<
class Char,
class Traits>
206 std::basic_ostream<Char,Traits>&
207 operator <<(std::basic_ostream<Char,Traits>& os,
223 :
Advisor(home,share,
a), _info(
a._info) {
233 return (_info & 1) != 0;
258 for (
int i=
x.size();
i--; )
283 for (
int i=
n;
i--; ) {
284 typename View::VarType xi(
x[
i].varimp());
289 for (
int i=
n;
i--; ) {
306 double reward = 1.0 / (nf - chb[
i].lf + 1);
307 chb[
i].qs = (1.0 - alpha) * chb[
i].qs + alpha * reward;
309 double reward = 0.9 / (nf - chb[
i].lf + 1);
310 chb[
i].qs = (1.0 - alpha) * chb[
i].qs + alpha * reward;
326 assert((
i >= 0) && (i < storage->
n));
354 CHB::operator bool(
void)
const {
355 return storage != NULL;
375 template<
class Char,
class Traits>
376 std::basic_ostream<Char,Traits>&
377 operator <<(std::basic_ostream<Char,Traits>& os,
379 std::basic_ostringstream<Char,Traits> s;
380 s.copyfmt(os); s.width(0);
382 if (chb.size() > 0) {
384 for (
int i=1;
i<chb.
size();
i++)
388 return os << s.str();
401 c.update(home, share,
p.c);
418 x[as.advisor().idx()].cancel(home,as.advisor(),
true);
421 return sizeof(*this);
457 int i = as.advisor().idx();
458 if (as.advisor().marked()) {
459 as.advisor().unmark();
462 as.advisor().dispose(home,
c);
467 int i = as.advisor().idx();
468 if (as.advisor().marked()) {
469 as.advisor().unmark();
472 as.advisor().dispose(home,
c);
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience)
bool marked(void *p)
Check whether p is marked.
CHB & operator=(const CHB &a)
Assignment operator.
unsigned int use_cnt
How many references exist for this object.
int size(void) const
Return size of array (number of elements)
int n
Number of chb values.
ExecStatus ES_SUBSUMED(Propagator &p)
void bump(void)
Bump failure count and alpha.
Actor must always be disposed.
Info * chb
CHB information.
Object for storing chb information.
Advisor with index and change information.
static ExecStatus post(Home home, ViewArray< View > &x, CHB &chb)
Post chb recorder propagator.
int idx(void) const
Get index of view.
void bump(void)
Bump failure count and alpha.
void update(int i)
Update chb value at position i.
const ModEvent ME_GEN_ASSIGNED
Generic modification event: variable is assigned a value.
ViewArray< View > x
Array of views.
void acquire(void)
Acquire the mutex and possibly block.
Propagator for recording chb information.
Base-class for propagators.
virtual void reschedule(Space &home)
Schedule function.
static PropCost record(void)
For recording information (no propagation allowed)
Class to iterate over advisors of a council.
void * mark(void *p)
Return marked pointer for unmarked pointer p.
int size(void) const
Return number of chb values.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagation has computed fixpoint.
~Storage(void)
Delete object.
void acquire(void)
Acquire mutex.
A mutex for mutual exclausion among several threads.
void release(void)
Release the mutex.
CHB(void)
Construct as not yet intialized.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
void update(int i, bool failed)
Update chb information at position i.
unsigned long long int nf
Number of failures.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void mark(void)
Mark advisor as modified.
int n
Number of negative literals for node type.
void subscribe(Space &home, Propagator &p, IntSet &y)
Idx(Space &home, Propagator &p, Council< Idx > &c, int i)
Constructor for creation.
bool failed(void) const
Check whether space is failed.
ModEventDelta med
A set of modification events (used during propagation)
Class for CHB management.
Recorder(Space &home, bool share, Recorder< View > &p)
Constructor for cloning p.
const double chb_alpha_init
Initial value for alpha in CHB.
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.
double operator[](int i) const
Return chb value at position i.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
#define GECODE_KERNEL_EXPORT
CHB chb
Access to chb information.
Council< Idx > c
The advisor council.
void release(void)
Release mutex.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
static const CHB def
Default (empty) chb information.
void free(T *b, long unsigned int n)
Delete n objects starting at b.
bool marked(void) const
Whether advisor's view has been marked.
Generic domain change information to be supplied to advisors.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Storage(Home home, ViewArray< View > &x, typename BranchTraits< typename View::VarType >::Merit bm)
Allocate CHB info.
unsigned long long int lf
Last failure.
Heap heap
The single global heap.
bool assigned(View x, int v)
Whether x is assigned to value v.
const double chb_alpha_limit
Limit for decreasing alpha in CHB.
Storage * storage
Pointer to storage object.
Post propagator for SetVar x
Propagation has not computed fixpoint.
int _info
Index and mark information.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
const double chb_alpha_decrement
Alpha decrement in CHB.
Gecode toplevel namespace
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (record so that propagator runs last)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
Base class for heap allocated objects.
const double chb_qscore_init
Initial value for Q-score in CHB.
Support::Mutex m
Mutex to synchronize globally shared access.
void unmark(void)
Mark advisor as unmodified.
virtual Propagator * copy(Space &home, bool share)
Copy propagator during cloning.