115 int size(
void)
const;
184 template<
class Char,
class Traits>
185 std::basic_ostream<Char,Traits>&
198 :
Advisor(home,p,c), _info(i << 1) {}
212 return (_info & 1) != 0;
237 for (
int i=0; i<
x.
size(); i++)
238 if (!
x[i].assigned())
239 x[i].subscribe(home,*
new (home)
Idx(home,*
this,
c,i),
true);
262 for (
int i=0; i<
n; i++) {
263 typename View::VarType xi(
x[i].varimp());
264 a[i] = bm(home,xi,i);
267 for (
int i=0; i<
n; i++)
276 assert((i >= 0) && (i < n));
277 a[i] = invd * (a[i] + 1.0);
279 for (
int j=0; j<n; j++)
305 assert((i >= 0) && (i <
object().n));
342 template<
class Char,
class Traits>
343 std::basic_ostream<Char,Traits>&
346 std::basic_ostringstream<Char,Traits> s;
347 s.copyfmt(os); s.width(0);
351 for (
int i=1; i<a.
size(); i++)
355 return os << s.str();
384 x[as.advisor().idx()].cancel(home,as.advisor(),
true);
387 return sizeof(*this);
405 static_cast<Idx&
>(a).mark();
412 static_cast<Idx&
>(a).mark();
421 int i = as.advisor().idx();
422 if (as.advisor().marked()) {
423 as.advisor().unmark();
426 as.advisor().dispose(home,c);
Advisor with index and change information.
Idx(Space &home, Propagator &p, Council< Idx > &c, int i)
Constructor for creation.
int idx(void) const
Get index of view.
void unmark(void)
Mark advisor as unmodified.
int _info
Index and mark information.
void mark(void)
Mark advisor as modified.
bool marked(void) const
Whether advisor's view has been marked.
Propagator for recording action information.
Action a
Access to action information.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Council< Idx > c
The advisor council.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (record so that propagator runs last)
static ExecStatus post(Home home, ViewArray< View > &x, Action &a)
Post action recorder propagator.
virtual void reschedule(Space &home)
Schedule function.
Recorder(Space &home, Recorder< View > &p)
Constructor for cloning p.
Object for storing action values.
void update(int i)
Update action value at position i.
double invd
Inverse decay factor.
double * a
Action values (more follow)
static Support::Mutex m
Mutex to synchronize globally shared access.
Storage(Home home, ViewArray< View > &x, double d, typename BranchTraits< typename View::VarType >::Merit bm)
Initialize action values.
int n
Number of action values.
Class for action management.
Storage & object(void) const
Return object of correct type.
void update(int i)
Update action value at position i.
Action & operator=(const Action &a)
Assignment operator.
int size(void) const
Return number of action values.
double operator[](int i) const
Return action value at position i.
void init(Home home, ViewArray< View > &x, double d, typename BranchTraits< typename View::VarType >::Merit bm)
Initialize for views x and decay factor d and action as defined by bm.
void acquire(void)
Acquire mutex.
void release(void)
Release mutex.
static const Action def
Default (empty) action information.
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const Action &a)
Print action values enclosed in curly brackets.
Action(void)
Construct as not yet intialized.
void decay(Space &home, double d)
Set decay factor to d.
Class to iterate over advisors of a council.
int size(void) const
Return size of array (number of elements)
Generic domain change information to be supplied to advisors.
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
Home class for posting propagators
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
static PropCost record(void)
For recording information (no propagation allowed)
Base-class for propagators.
ModEventDelta med
A set of modification events (used during propagation)
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.
@ AP_DISPOSE
Actor must always be disposed.
#define GECODE_KERNEL_EXPORT
const double rescale_limit
Rescale action and afc values when larger than this.
const double rescale
Rescale factor for action and afc values.
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