34 #ifndef __GECODE_SEARCH_PAR_ENGINE_HH__ 35 #define __GECODE_SEARCH_PAR_ENGINE_HH__ 42 namespace Gecode {
namespace Search {
namespace Par {
45 template<
class Tracer>
88 unsigned int workers(
void)
const;
194 virtual bool stopped(
void)
const;
virtual Space * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Statistics statistics(void)
Return statistics.
Support::Event e_reset_ack_stop
Event for reset acknowledgment stopped.
virtual ~Worker(void)
Destructor.
void ack_terminate(void)
For worker to acknowledge termination command.
Search engine implementation interface
Path< Tracer > path
Current path ins search tree.
unsigned int workers(void) const
Return number of workers.
Support::Event e_reset_ack_start
Event for reset acknowledgment started.
void terminate(void)
For engine to peform thread termination.
An interface for objects that can be run by a thread.
volatile bool has_stopped
Whether a worker had been stopped.
void wait_terminate(void)
For worker to wait until termination is legal.
bool signal(void) const
Whether search state changed such that signal is needed.
Engine & _engine
Reference to engine.
Support::Mutex _m_term
Mutex for access to termination information.
Support::Mutex m_search
Mutex for search.
void ack_reset_stop(void)
For worker to acknowledge stop of reset cycle.
bool stopped(void) const
Check whether engine has been stopped.
Parallel depth-first search engine
volatile unsigned int _n_reset_not_ack
Number of workers that have not yet acknowledged reset.
A mutex for mutual exclausion among several threads.
Cmd
Commands from engine to workers.
Gecode::FloatVal c(-8, 8)
An event for synchronization.
Space * cur
Current space being explored.
Engine(const Options &o)
Initialize with options o.
Cmd cmd(void) const
Return current command.
Support::Mutex m
Mutex for access to worker.
Options _opt
Search options.
void wait(void)
Ensure that worker waits.
volatile unsigned int _n_term_not_ack
Number of workers that have not yet acknowledged termination.
Support::Mutex m_wait_reset
Mutex for waiting for reset.
void release(Cmd c)
Release all workers.
bool idle
Whether the worker is idle.
Space * steal(unsigned long int &d, Tracer &myt, Tracer &ot)
Hand over some work (NULL if no work available)
Support::Mutex _m_reset
Mutex for access to reset information.
void busy(void)
Report that worker is busy.
const Options & opt(void) const
Provide access to search options.
unsigned int d
Distance until next clone.
Queue with arbitrary number of elements.
Support::Event e_search
Event for search (solution found, no more solutions, search stopped)
Support::DynamicQueue< Space *, Heap > solutions
Queue of solutions.
Support::Mutex _m_wait_terminate
Mutex for waiting for termination.
No-goods recorded from restarts.
Engine & engine(void) const
Provide access to engine.
void wait_reset(void)
For worker to wait for all workers to reset.
volatile Cmd _cmd
The current command.
NoGoods & nogoods(void)
Return no-goods.
void ack_reset_start(void)
For worker to acknowledge start of reset cycle.
An interface for objects that can be called after a thread has terminated (after running the thread's...
Support::Event _e_terminate
Event for termination (all threads have terminated)
Gecode toplevel namespace
virtual void terminated(void)
For worker to register termination.
volatile unsigned int n_busy
Number of busy workers.
volatile unsigned int _n_not_terminated
Number of not yet terminated workers.
virtual Support::Terminator * terminator(void) const
Terminator (engine)
void block(void)
Block all workers.
Tracer tracer
Search tracer.
Support::Mutex _m_wait
Mutex for forcing workers to wait.
Depth-first path (stack of edges) supporting recomputation.
Support::Event _e_term_ack
Event for termination acknowledgment.
bool stop(const Options &o)
Check whether engine must be stopped.
Parallel depth-first search worker