40 #ifdef GECODE_HAS_THREADS
44 namespace Gecode {
namespace Search {
namespace Parallel {
112 }
else if (
cur != NULL) {
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
Worker * worker(unsigned int i) const
Provide access to worker i.
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.
Path path
Current path ins search tree.
void rfree(void *p)
Free memory block starting at p.
virtual ~BAB(void)
Destructor.
virtual Statistics statistics(void) const
Return statistics.
Space * clone(bool share=true, CloneStatistics &stat=unused_clone) const
Clone space.
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.
void block(void)
Block all workers.
void reset(Space *s, int ngdl)
Reset engine to restart at space s.
volatile unsigned int n_busy
Number of busy workers.
Heap heap
The single global heap.
void start(void)
Reset stop information.
void release(void)
Release the mutex.
Gecode::FloatVal c(-8, 8)
bool empty(void) const
Test whether path is empty.
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.
unsigned int d
Distance until next clone.
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) ...
Cmd cmd(void) const
Return current command.
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.
void terminated(void)
For worker to register termination.
Space * cur
Current space being explored.
unsigned int workers(void) const
Return number of workers.
virtual ~Worker(void)
Destructor.
void find(void)
Try to find some work.
const Options & opt(void) const
Provide access to search options.
Space * recompute(unsigned int &d, unsigned int a_d, Worker &s)
Recompute space according to path.
virtual NoGoods & nogoods(void)
Return no-goods.
Space * best
Best solution found so far.
void next(void)
Generate path for next node.
int mark
Number of entries not yet constrained to be better.
BAB & engine(void) const
Provide access to engine.
int ngdl(void) const
Return no-good depth limit.
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.
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)
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.
Space is solved (no brancher left)