34#ifndef __GECODE_SEARCH_PAR_ENGINE_HH__
35#define __GECODE_SEARCH_PAR_ENGINE_HH__
42namespace Gecode {
namespace Search {
namespace Par {
45 template<
class Tracer>
88 unsigned int workers(
void)
const;
194 virtual bool stopped(
void)
const;
No-goods recorded from restarts.
Search engine implementation interface
Parallel depth-first search worker
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)
unsigned int d
Distance until next clone.
bool idle
Whether the worker is idle.
Path< Tracer > path
Current path ins search tree.
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_RESET
Perform reset operation.
@ C_WAIT
Run into wait lock.
void ack_terminate(void)
For worker to acknowledge termination command.
Depth-first path (stack of edges) supporting recomputation.
Queue with arbitrary number of elements.
An event for synchronization.
A mutex for mutual exclausion among several threads.
An interface for objects that can be run by a thread.
An interface for objects that can be called after a thread has terminated (after running the thread's...
Gecode toplevel namespace