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