34namespace Gecode {
namespace Search {
namespace Par {
40 template<
class Tracer>
45 template<
class Tracer>
50 template<
class Tracer>
53 return static_cast<unsigned int>(
opt().
threads);
55 template<
class Tracer>
66 template<
class Tracer>
71 template<
class Tracer>
77 template<
class Tracer>
83 template<
class Tracer>
93 template<
class Tracer>
96 : tracer(e.
opt().tracer), _engine(e),
97 path(s == NULL ? 0 : e.
opt().nogoods_limit), d(0),
114 template<
class Tracer>
132 template<
class Tracer>
145 template<
class Tracer>
150 template<
class Tracer>
161 template<
class Tracer>
170 template<
class Tracer>
185 template<
class Tracer>
198 template<
class Tracer>
207 template<
class Tracer>
214 template<
class Tracer>
233 template<
class Tracer>
242 template<
class Tracer>
251 template<
class Tracer>
263 template<
class Tracer>
287 template<
class Tracer>
296 template<
class Tracer>
348 template<
class Tracer>
357 template<
class Tracer>
int n
Number of negative literals for node type.
No-goods recorded from restarts.
double threads
Number of threads to use.
Support::Mutex m
Mutex for access to worker.
Engine & _engine
Reference to engine.
NoGoods & nogoods(void)
Return no-goods.
Statistics statistics(void)
Return statistics.
Space * cur
Current space being explored.
virtual ~Worker(void)
Destructor.
Tracer tracer
Search tracer.
Space * steal(unsigned long int &d, Tracer &myt, Tracer &ot)
Hand over some work (NULL if no work available)
virtual Support::Terminator * terminator(void) const
Terminator (engine)
Engine & engine(void) const
Provide access to engine.
Parallel depth-first search engine
void idle(void)
Report that worker is idle.
void wait(void)
Ensure that worker waits.
Support::Event _e_terminate
Event for termination (all threads have terminated)
void ack_reset_stop(void)
For worker to acknowledge stop of reset cycle.
const Options & opt(void) const
Provide access to search options.
Support::Mutex _m_wait_terminate
Mutex for waiting for termination.
Support::Event e_reset_ack_stop
Event for reset acknowledgment stopped.
Support::Mutex _m_wait
Mutex for forcing workers to wait.
Support::Event e_search
Event for search (solution found, no more solutions, search stopped)
volatile bool has_stopped
Whether a worker had been stopped.
virtual Space * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Support::Event _e_term_ack
Event for termination acknowledgment.
Support::DynamicQueue< Space *, Heap > solutions
Queue of solutions.
virtual bool stopped(void) const
Check whether engine has been stopped.
void stop(void)
Report that worker has been stopped.
void block(void)
Block all workers.
Support::Mutex m_wait_reset
Mutex for waiting for reset.
Support::Mutex m_search
Mutex for search.
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
Support::Mutex _m_term
Mutex for access to termination information.
Cmd cmd(void) const
Return current command.
Engine(const Options &o)
Initialize with options o.
Options _opt
Search options.
void busy(void)
Report that worker is busy.
volatile Cmd _cmd
The current command.
volatile unsigned int _n_reset_not_ack
Number of workers that have not yet acknowledged reset.
void release(Cmd c)
Release all workers.
bool signal(void) const
Whether search state changed such that signal is needed.
void ack_reset_start(void)
For worker to acknowledge start of reset cycle.
volatile unsigned int _n_term_not_ack
Number of workers that have not yet acknowledged termination.
void wait_reset(void)
For worker to wait for all workers to reset.
volatile unsigned int _n_not_terminated
Number of not yet terminated workers.
virtual void terminated(void)
For worker to register termination.
void terminate(void)
For engine to peform thread termination.
Support::Mutex _m_reset
Mutex for access to reset information.
volatile unsigned int n_busy
Number of busy workers.
void wait_terminate(void)
For worker to wait until termination is legal.
unsigned int workers(void) const
Return number of workers.
Cmd
Commands from engine to workers.
@ C_WAIT
Run into wait lock.
void ack_terminate(void)
For worker to acknowledge termination command.
unsigned long int fail
Number of failed nodes in search tree.
void wait(void)
Wait until the event becomes signalled.
void signal(void)
Signal the event.
void release(void)
Release the mutex.
void acquire(void)
Acquire the mutex and possibly block.
An interface for objects that can be called after a thread has terminated (after running the thread's...
Heap heap
The single global heap.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
@ SS_FAILED
Space is failed
Space * snapshot(Space *s, const Options &o)
Clone space s dependening on options o.
Gecode toplevel namespace
void path(Home home, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a Hamiltonian path.
#define GECODE_NEVER
Assert that this command is never executed.