40 #ifdef GECODE_HAS_THREADS 44 namespace Gecode {
namespace Search {
namespace Parallel {
68 best =
b.clone(
false);
130 }
else if (
cur != NULL) {
unsigned int workers(void) const
Return number of workers.
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
Space must be branched (at least one brancher left)
void ack_terminate(void)
For worker to acknowledge termination command.
void wait_terminate(void)
For worker to wait until termination is legal.
void wait_reset(void)
For worker to wait for all workers to reset.
void terminate(void)
For engine to peform thread termination.
bool empty(void) const
Test whether path is empty.
Path path
Current path ins search tree.
void rfree(void *p)
Free memory block starting at p.
virtual ~BAB(void)
Destructor.
Worker * worker(unsigned int i) const
Provide access to worker i.
void idle(void)
Report that worker is idle.
Statistics statistics(void)
Return statistics.
const unsigned int initial_delay
Initial delay in milliseconds for all but first worker thread.
virtual void reset(Space *s)
Reset engine to restart at space s.
void acquire(void)
Acquire the mutex and possibly block.
unsigned long int fail
Number of failed nodes in search tree.
void stop(void)
Report that worker has been stopped.
Space * clone(bool share_data=true, bool share_info=true, CloneStatistics &stat=unused_clone) const
Clone space.
void block(void)
Block all workers.
const Options & opt(void) const
Provide access to search options.
void better(Space *b)
Accept better solution b.
volatile unsigned int n_busy
Number of busy workers.
void start(void)
Reset stop information.
void release(void)
Release the mutex.
Gecode::FloatVal c(-8, 8)
void wait(void)
Ensure that worker waits.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Support::Mutex m_wait_reset
Mutex for waiting for reset.
virtual void constrain(const Space &b)
Constrain future solutions to be better than b.
unsigned int d
Distance until next clone.
virtual Statistics statistics(void) const
Return statistics.
bool idle
Whether the worker is idle.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
const Choice * push(Worker &stat, Space *s, Space *c)
Push space c (a clone of s or NULL)
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
static void sleep(unsigned int ms)
Put current thread to sleep for ms milliseconds.
virtual void constrain(const Space &best)
Constrain function for best solution search.
void terminated(void)
For worker to register termination.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Space * cur
Current space being explored.
virtual ~Worker(void)
Destructor.
void find(void)
Try to find some work.
Space * recompute(unsigned int &d, unsigned int a_d, Worker &s)
Recompute space according to path.
virtual NoGoods & nogoods(void)
Constrain Return no-goods.
Space * best
Best solution found so far.
unsigned int ngdl(void) const
Return no-good depth limit.
void next(void)
Generate path for next node.
int mark
Number of entries not yet constrained to be better.
void ack_reset_stop(void)
For worker to acknowledge stop of reset cycle.
Choice for performing commit
No-goods recorded from restarts.
void release(Cmd c)
Release all workers.
Heap heap
The single global heap.
BAB & engine(void) const
Provide access to engine.
void solution(Space *s)
Report solution s.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
void reset(Space *s, unsigned int ngdl)
Reset engine to restart at space s.
Gecode toplevel namespace
unsigned long int node
Number of nodes expanded.
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Worker ** _worker
Array of worker references.
Space * best
Best solution so far.
virtual void run(void)
Start execution of worker.
const Choice * choice(void)
Create new choice for current brancher.
NoGoods & nogoods(void)
Return no-goods.
void ack_reset_start(void)
For worker to acknowledge start of reset cycle.
#define GECODE_NEVER
Assert that this command is never executed.
void wait(void)
Wait until the event becomes signalled.
bool stop(const Options &o)
Check whether engine must be stopped.
Support::Event e_reset_ack_stop
Event for reset acknowledgment stopped.
Support::Mutex m
Mutex for access to worker.
Cmd cmd(void) const
Return current command.
Space is solved (no brancher left)
Support::Mutex m_search
Mutex for search.