Go to the documentation of this file.
34 namespace 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),
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>
@ C_WAIT
Run into wait lock.
void release(Cmd c)
Release all workers.
volatile bool has_stopped
Whether a worker had been stopped.
void terminate(void)
For engine to peform thread termination.
volatile unsigned int _n_not_terminated
Number of not yet terminated workers.
NoGoods & nogoods(void)
Return no-goods.
Support::Event _e_term_ack
Event for termination acknowledgment.
Support::Mutex m_search
Mutex for search.
void acquire(void)
Acquire the mutex and possibly block.
unsigned long int fail
Number of failed nodes in search tree.
Statistics statistics(void)
Return statistics.
Cmd
Commands from engine to workers.
Space * snapshot(Space *s, const Options &o)
Clone space s dependening on options o.
virtual Space * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
void busy(void)
Report that worker is busy.
volatile Cmd _cmd
The current command.
const bool clone
Whether engines create a clone when being initialized.
void stop(void)
Report that worker has been stopped.
virtual ~Worker(void)
Destructor.
Support::Event e_search
Event for search (solution found, no more solutions, search stopped)
Gecode toplevel namespace
No-goods recorded from restarts.
volatile unsigned int _n_term_not_ack
Number of workers that have not yet acknowledged termination.
Support::DynamicQueue< Space *, Heap > solutions
Queue of solutions.
Engine & _engine
Reference to engine.
Engine & engine(void) const
Provide access to engine.
Parallel depth-first search engine
void idle(void)
Report that worker is idle.
Support::Mutex _m_term
Mutex for access to termination information.
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Support::Event e_reset_ack_stop
Event for reset acknowledgment stopped.
An interface for objects that can be called after a thread has terminated (after running the thread's...
Engine(const Options &o)
Initialize with options o.
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.
Space * cur
Current space being explored.
virtual void terminated(void)
For worker to register termination.
void wait(void)
Ensure that worker waits.
#define GECODE_NEVER
Assert that this command is never executed.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Support::Mutex _m_reset
Mutex for access to reset information.
Support::Mutex m_wait_reset
Mutex for waiting for reset.
Heap heap
The single global heap.
virtual Support::Terminator * terminator(void) const
Terminator (engine)
void wait_terminate(void)
For worker to wait until termination is legal.
const Options & opt(void) const
Provide access to search options.
void signal(void)
Signal the event.
volatile unsigned int n_busy
Number of busy workers.
Support::Event _e_terminate
Event for termination (all threads have terminated)
virtual bool stopped(void) const
Check whether engine has been stopped.
void ack_reset_stop(void)
For worker to acknowledge stop of reset cycle.
Options _opt
Search options.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl)
Post propagator such that x forms a Hamiltonian path.
void block(void)
Block all workers.
Space * steal(unsigned long int &d, Tracer &myt, Tracer &ot)
Hand over some work (NULL if no work available)
Gecode::FloatVal c(-8, 8)
void release(void)
Release the mutex.
int n
Number of negative literals for node type.
void wait(void)
Wait until the event becomes signalled.
unsigned int workers(void) const
Return number of workers.
void wait_reset(void)
For worker to wait for all workers to reset.
Cmd cmd(void) const
Return current command.
@ SS_FAILED
Space is failed
Tracer tracer
Search tracer.
Support::Mutex m
Mutex for access to worker.
double threads
Number of threads to use.
void ack_terminate(void)
For worker to acknowledge termination command.
Support::Mutex _m_wait
Mutex for forcing workers to wait.
volatile unsigned int _n_reset_not_ack
Number of workers that have not yet acknowledged reset.
Support::Mutex _m_wait_terminate
Mutex for waiting for termination.