Parallel depth-first search engine More...
#include <engine.hh>
Classes | |
class | Worker |
Parallel depth-first search worker More... | |
Public Member Functions | |
const Options & | opt (void) const |
Provide access to search options. More... | |
unsigned int | workers (void) const |
Return number of workers. More... | |
![]() | |
virtual Statistics | statistics (void) const =0 |
Return statistics. More... | |
virtual void | constrain (const Space &b) |
Constrain future solutions to be better than b (raises exception) More... | |
virtual void | reset (Space *s) |
Reset engine to restart at space s (does nothing) More... | |
virtual NoGoods & | nogoods (void) |
Return no-goods (the no-goods are empty) More... | |
virtual | ~Engine (void) |
Destructor. More... | |
![]() | |
virtual | ~Terminator () |
Destructor. More... | |
Protected Attributes | |
Options | _opt |
Search options. More... | |
Commands from engine to workers and wait management | |
enum | Cmd { C_WORK, C_WAIT, C_RESET, C_TERMINATE } |
Commands from engine to workers. More... | |
volatile Cmd | _cmd |
The current command. More... | |
Support::Mutex | _m_wait |
Mutex for forcing workers to wait. More... | |
Cmd | cmd (void) const |
Return current command. More... | |
void | block (void) |
Block all workers. More... | |
void | release (Cmd c) |
Release all workers. More... | |
void | wait (void) |
Ensure that worker waits. More... | |
Termination control | |
Support::Mutex | _m_term |
Mutex for access to termination information. More... | |
volatile unsigned int | _n_term_not_ack |
Number of workers that have not yet acknowledged termination. More... | |
Support::Event | _e_term_ack |
Event for termination acknowledgment. More... | |
Support::Mutex | _m_wait_terminate |
Mutex for waiting for termination. More... | |
volatile unsigned int | _n_not_terminated |
Number of not yet terminated workers. More... | |
Support::Event | _e_terminate |
Event for termination (all threads have terminated) More... | |
void | ack_terminate (void) |
For worker to acknowledge termination command. More... | |
virtual void | terminated (void) |
For worker to register termination. More... | |
void | wait_terminate (void) |
For worker to wait until termination is legal. More... | |
void | terminate (void) |
For engine to peform thread termination. More... | |
Reset control | |
Support::Mutex | _m_reset |
Mutex for access to reset information. More... | |
volatile unsigned int | _n_reset_not_ack |
Number of workers that have not yet acknowledged reset. More... | |
Support::Event | e_reset_ack_start |
Event for reset acknowledgment started. More... | |
Support::Event | e_reset_ack_stop |
Event for reset acknowledgment stopped. More... | |
Support::Mutex | m_wait_reset |
Mutex for waiting for reset. More... | |
void | ack_reset_start (void) |
For worker to acknowledge start of reset cycle. More... | |
void | ack_reset_stop (void) |
For worker to acknowledge stop of reset cycle. More... | |
void | wait_reset (void) |
For worker to wait for all workers to reset. More... | |
Search control | |
Support::Mutex | m_search |
Mutex for search. More... | |
Support::Event | e_search |
Event for search (solution found, no more solutions, search stopped) More... | |
Support::DynamicQueue< Space *, Heap > | solutions |
Queue of solutions. More... | |
volatile unsigned int | n_busy |
Number of busy workers. More... | |
volatile bool | has_stopped |
Whether a worker had been stopped. More... | |
void | idle (void) |
Report that worker is idle. More... | |
void | busy (void) |
Report that worker is busy. More... | |
void | stop (void) |
Report that worker has been stopped. More... | |
bool | signal (void) const |
Whether search state changed such that signal is needed. More... | |
Engine interface | |
Engine (const Options &o) | |
Initialize with options o. More... | |
virtual Space * | next (void) |
Return next solution (NULL, if none exists or search has been stopped) More... | |
virtual bool | stopped (void) const |
Check whether engine has been stopped. More... | |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t s) |
Memory management. More... | |
static void | operator delete (void *p) |
Free memory allocated from heap. More... | |
Parallel depth-first search engine
enum Gecode::Search::Par::Engine::Cmd |
|
inline |
Initialize with options o.
Definition at line 120 of file engine.hpp.
|
inline |
Provide access to search options.
Definition at line 51 of file engine.hpp.
|
inline |
Return number of workers.
Definition at line 56 of file engine.hpp.
|
inline |
Return current command.
Definition at line 72 of file engine.hpp.
|
inline |
Block all workers.
Definition at line 77 of file engine.hpp.
|
inline |
Release all workers.
Definition at line 83 of file engine.hpp.
|
inline |
Ensure that worker waits.
Definition at line 89 of file engine.hpp.
|
inline |
For worker to acknowledge termination command.
Definition at line 204 of file engine.hpp.
|
inlinevirtual |
For worker to register termination.
Implements Gecode::Support::Terminator.
Definition at line 191 of file engine.hpp.
|
inline |
For worker to wait until termination is legal.
Definition at line 213 of file engine.hpp.
|
inline |
For engine to peform thread termination.
Definition at line 220 of file engine.hpp.
|
inline |
For worker to acknowledge start of reset cycle.
Definition at line 239 of file engine.hpp.
|
inline |
For worker to acknowledge stop of reset cycle.
Definition at line 248 of file engine.hpp.
|
inline |
For worker to wait for all workers to reset.
Definition at line 257 of file engine.hpp.
|
inlineprotected |
Whether search state changed such that signal is needed.
Definition at line 151 of file engine.hpp.
|
inline |
Report that worker is idle.
Definition at line 156 of file engine.hpp.
|
inline |
Report that worker is busy.
Definition at line 167 of file engine.hpp.
|
inline |
Report that worker has been stopped.
Definition at line 176 of file engine.hpp.
|
virtual |
Return next solution (NULL, if none exists or search has been stopped)
Implements Gecode::Search::Engine.
Reimplemented in Gecode::Search::Par::PBS< Collect >, and Gecode::Search::Par::PBS< Gecode::Search::Par::CollectBest >.
Definition at line 302 of file engine.hpp.
|
inlinevirtual |
Check whether engine has been stopped.
Implements Gecode::Search::Engine.
Reimplemented in Gecode::Search::Par::PBS< Collect >, and Gecode::Search::Par::PBS< Gecode::Search::Par::CollectBest >.
Definition at line 61 of file engine.hpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |