40 #ifdef GECODE_HAS_THREADS 44 namespace Gecode {
namespace Search {
namespace Parallel {
75 if (
this != engine().
worker(0))
79 switch (engine().
cmd()) {
86 engine().ack_terminate();
88 engine().wait_terminate();
90 engine().terminated();
94 engine().ack_reset_start();
96 engine().wait_reset();
98 engine().ack_reset_stop();
108 }
else if (cur != NULL) {
116 switch (cur->status(*
this)) {
127 (void) cur->choice();
133 engine().solution(s);
139 if ((
d == 0) || (
d >= engine().
opt().
c_d)) {
155 }
else if (!
path.empty()) {
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
Space must be branched (at least one brancher left)
void terminate(void)
For engine to peform thread termination.
void rfree(void *p)
Free memory block starting at p.
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.
Worker * worker(unsigned int i) const
Provide access to worker i.
void acquire(void)
Acquire the mutex and possibly block.
void stop(void)
Report that worker has been stopped.
virtual void run(void)
Start execution of worker.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntConLevel icl)
Post propagator such that x forms a Hamiltonian path.
void block(void)
Block all workers.
volatile unsigned int n_busy
Number of busy workers.
Heap heap
The single global heap.
void release(void)
Release the mutex.
Gecode::FloatVal c(-8, 8)
virtual NoGoods & nogoods(void)
Return no-goods.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Support::Mutex m_wait_reset
Mutex for waiting for reset.
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.
static void sleep(unsigned int ms)
Put current thread to sleep for ms milliseconds.
virtual void reset(Space *s)
Reset engine to restart at space s.
unsigned int workers(void) const
Return number of workers.
const Options & opt(void) const
Provide access to search options.
void reset(Space *s, unsigned int ngdl)
Reset worker to restart at space s.
virtual Statistics statistics(void) const
Return statistics.
Choice for performing commit
No-goods recorded from restarts.
void release(Cmd c)
Release all workers.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Gecode toplevel namespace
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Worker ** _worker
Array of worker references.
NoGoods & nogoods(void)
Return no-goods.
#define GECODE_NEVER
Assert that this command is never executed.
void wait(void)
Wait until the event becomes signalled.
Support::Event e_reset_ack_stop
Event for reset acknowledgment stopped.
virtual ~DFS(void)
Destructor.
Space is solved (no brancher left)