38 namespace Gecode {
namespace Search {
namespace Par {
44 template<
class Tracer>
49 template<
class Tracer>
54 template<
class Tracer>
57 return static_cast<unsigned int>(
opt().
threads);
59 template<
class Tracer>
70 template<
class Tracer>
75 template<
class Tracer>
81 template<
class Tracer>
87 template<
class Tracer>
97 template<
class Tracer>
118 template<
class Tracer>
136 template<
class Tracer>
149 template<
class Tracer>
154 template<
class Tracer>
165 template<
class Tracer>
174 template<
class Tracer>
189 template<
class Tracer>
202 template<
class Tracer>
211 template<
class Tracer>
218 template<
class Tracer>
237 template<
class Tracer>
246 template<
class Tracer>
255 template<
class Tracer>
267 template<
class Tracer>
291 template<
class Tracer>
300 template<
class Tracer>
352 template<
class Tracer>
361 template<
class Tracer>
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 stop(void)
Report that worker has been stopped.
void ack_terminate(void)
For worker to acknowledge termination command.
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.
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.
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 acquire(void)
Acquire the mutex and possibly block.
Support::Mutex _m_term
Mutex for access to termination information.
unsigned long int fail
Number of failed nodes in search tree.
Support::Mutex m_search
Mutex for search.
void ack_reset_stop(void)
For worker to acknowledge stop of reset cycle.
Parallel depth-first search engine
void signal(void)
Signal the event.
volatile unsigned int _n_reset_not_ack
Number of workers that have not yet acknowledged reset.
Cmd
Commands from engine to workers.
void release(void)
Release the mutex.
Gecode::FloatVal c(-8, 8)
double threads
Number of threads to use.
int n
Number of negative literals for node type.
Space * cur
Current space being explored.
Engine(const Options &o)
Initialize with options o.
Cmd cmd(void) const
Return current command.
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.
bool clone
Whether engines create a clone when being initialized.
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.
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.
virtual bool stopped(void) const
Check whether engine has been stopped.
Heap heap
The single global heap.
Engine & engine(void) const
Provide access to engine.
void idle(void)
Report that worker is idle.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
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.
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
volatile unsigned int n_busy
Number of busy workers.
volatile unsigned int _n_not_terminated
Number of not yet terminated workers.
Space * snapshot(Space *s, const Options &o)
Clone space s dependening on options o.
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.
#define GECODE_NEVER
Assert that this command is never executed.
Support::Event _e_term_ack
Event for termination acknowledgment.
void wait(void)
Wait until the event becomes signalled.