59 void init(
unsigned int pid,
unsigned int gid);
71 static Block*
allocate(
unsigned int n, Block*
p=NULL);
81 static const unsigned int n_dpow = 8U;
92 unsigned int pid(
void);
96 double decay(
void)
const;
100 void set(
Info&
c,
double a);
105 static const unsigned int size_min = 32;
107 static const unsigned int size_max = 32 * 1024;
118 unsigned int use_cnt;
131 Object* object(
void)
const;
133 bool local(
void)
const;
135 void local(Object* o);
137 void global(
void* mo);
150 double decay(
void)
const;
154 void set(
Info&
c,
double a);
169 GPI::Manager::decay(
double d0) {
180 GPI::Manager::Manager(
void)
181 : next(0),
d(1.0),
t(0UL) {}
184 GPI::Manager::pid(
void) {
188 GPI::Manager::decay(
void)
const {
192 GPI::Manager::decay(
Info&
c) {
193 assert((
t >= c.
t) && (
d != 1.0));
194 unsigned int n =
t - c.
t;
199 c.
c *=
pow(
d,static_cast<double>(n));
205 GPI::Manager::inc(
Info& c) {
210 c.
c += 1.0; c.
t = ++
t;
214 GPI::Manager::val(
Info& c) {
220 GPI::Manager::set(
Info& c,
double a) {
230 GPI::Block::allocate(
unsigned int n, GPI::Block*
p) {
231 Block*
b =
static_cast<Block*
>(
heap.
ralloc(
sizeof(Block)+
232 (n-1)*
sizeof(
Info)));
239 : mutex(m), parent(p), use_cnt(1),
size(size_min), free(size_min),
240 cur(Block::allocate(
size)) {
241 if (parent == NULL) {
242 manager =
new Manager;
244 manager = parent->manager;
249 GPI::object(
void)
const {
253 GPI::local(
void)
const {
257 GPI::local(Object* o) {
262 GPI::global(
void* o) {
275 Object* o = object();
285 Object* c = object();
286 Manager* manager = c->manager;
287 while ((c != NULL) && (--c->use_cnt == 0)) {
291 Block*
d =
b; b=b->next;
295 Object*
d =
c; c = c->parent;
315 object()->manager->inc(c);
323 object()->manager->set(c,a);
332 d = object()->manager->val(c);
342 d = object()->manager->decay();
351 object()->manager->decay(d);
364 local(
new Object(
object()->mutex,
object()));
368 Object* o = object();
371 if (2*o->size <= size_max)
374 o->cur = Block::allocate(o->size,o->cur);
377 Info* c = &o->cur->c[--o->free];
378 c->
init(o->manager->pid(),
gid);
bool marked(void *p)
Check whether p is marked.
void rfree(void *p)
Free memory block starting at p.
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
void acquire(void)
Acquire the mutex and possibly block.
void * ralloc(size_t s)
Allocate s bytes from heap.
A mutex for mutual exclausion among several threads.
void * funmark(void *p)
Return unmarked pointer for a possibly marked pointer p.
void release(void)
Release the mutex.
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Global propagator information.
unsigned int pid
Propagator identifier.
Info * allocate(unsigned int gid)
Allocate new actor info.
unsigned int size(I &i)
Size of all ranges of range iterator i.
void set(Info &c, double a)
Set failure count to a.
double afc(Info &c)
Return failure count.
double c
The counter value.
double decay(void) const
Return decay factor.
unsigned int gid
Group identifier.
void init(unsigned int pid, unsigned int gid)
Initialize.
Heap heap
The single global heap.
void fail(Info &c)
Increment failure count.
void * fmark(void *p)
Return marked pointer for p (possibly already marked)
Gecode toplevel namespace
Class for storing timed-decay value.
struct Gecode::@554::NNF::@60::@61 b
For binary nodes (and, or, eqv)
unsigned long int t
The time-stamp.
Base class for heap allocated objects.