58 unsigned long long int lf;
85 void update(
int i,
bool failed);
100 void update(
int i,
bool failed);
139 int size(
void)
const;
189 virtual size_t dispose(
Space& home);
198 template<
class Char,
class Traits>
199 std::basic_ostream<Char,Traits>&
200 operator <<(std::basic_ostream<Char,Traits>& os,
212 :
Advisor(home,p,c), _info(i << 1) {}
226 return (
_info & 1) != 0;
251 for (
int i=x.
size();
i--; )
253 x[
i].subscribe(home,*
new (home)
Idx(home,*
this,
c,
i),
true);
276 for (
int i=
n;
i--; ) {
277 typename View::VarType xi(x[
i].varimp());
282 for (
int i=
n;
i--; ) {
299 double reward = 1.0 / (
nf -
chb[
i].
lf + 1);
302 double reward = 0.9 / (
nf -
chb[
i].
lf + 1);
325 assert((i >= 0) && (i <
object().
n));
369 template<
class Char,
class Traits>
370 std::basic_ostream<Char,Traits>&
371 operator <<(std::basic_ostream<Char,Traits>& os,
373 std::basic_ostringstream<Char,Traits> s;
374 s.copyfmt(os); s.width(0);
376 if (
chb.size() > 0) {
378 for (
int i=1;
i<chb.
size();
i++)
382 return os << s.str();
411 x[as.advisor().idx()].cancel(home,as.advisor(),
true);
414 return sizeof(*this);
450 int i = as.advisor().idx();
451 if (as.advisor().marked()) {
452 as.advisor().unmark();
455 as.advisor().dispose(home,
c);
460 int i = as.advisor().idx();
461 if (as.advisor().marked()) {
462 as.advisor().unmark();
465 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.
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.
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.
Gecode::FloatVal c(-8, 8)
void update(int i, bool failed)
Update chb information at position i.
int p
Number of positive literals for node type.
Storage & object(void) const
Return object of correct 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.
SharedHandle::Object * object(void) const
Access to the shared object.
Idx(Space &home, Propagator &p, Council< Idx > &c, int i)
Constructor for creation.
bool failed(void) const
Check whether space is failed.
Class for CHB management.
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.
size_t size
The size of the propagator (used during subsumption)
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
void * unmark(void *p)
Return unmarked pointer for a marked pointer p.
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.
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.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Storage(Home home, ViewArray< View > &x, typename BranchTraits< typename View::VarType >::Merit bm)
Initialize 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.
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.
Recorder(Space &home, Recorder< View > &p)
Constructor for cloning p.
const double chb_alpha_decrement
Alpha decrement in CHB.
Gecode toplevel namespace
#define GECODE_VTABLE_EXPORT
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (record so that propagator runs last)
void reschedule(Space &home, Propagator &p, IntSet &y)
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
const double chb_qscore_init
Initial value for Q-score in CHB.
static Support::Mutex m
Mutex to synchronize globally shared access.
void unmark(void)
Mark advisor as unmodified.
unsigned long int nf
Number of failures.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.