Gecode::Search::Parallel::Engine Class Reference
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. | |
unsigned int | workers (void) const |
Return number of workers. | |
Protected Attributes | |
const Options | _opt |
Search options. | |
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. | |
Support::Mutex | _m_wait |
Mutex for forcing workers to wait. | |
Cmd | cmd (void) const |
Return current command. | |
void | block (void) |
Block all workers. | |
void | release (Cmd c) |
Release all workers. | |
void | wait (void) |
Ensure that worker waits. | |
Termination control | |
| |
Support::Mutex | _m_term |
Mutex for access to termination information. | |
volatile unsigned int | _n_term_not_ack |
Number of workers that have not yet acknowledged termination. | |
Support::Event | _e_term_ack |
Event for termination acknowledgment. | |
Support::Mutex | _m_wait_terminate |
Mutex for waiting for termination. | |
volatile unsigned int | _n_not_terminated |
Number of not yet terminated workers. | |
Support::Event | _e_terminate |
Event for termination (all threads have terminated). | |
void | ack_terminate (void) |
For worker to acknowledge termination command. | |
void | terminated (void) |
For worker to register termination. | |
void | wait_terminate (void) |
For worker to wait until termination is legal. | |
void | terminate (void) |
For engine to peform thread termination. | |
Reset control | |
| |
Support::Mutex | _m_reset |
Mutex for access to reset information. | |
volatile unsigned int | _n_reset_not_ack |
Number of workers that have not yet acknowledged reset. | |
Support::Event | e_reset_ack_start |
Event for reset acknowledgment started. | |
Support::Event | e_reset_ack_stop |
Event for reset acknowledgment stopped. | |
Support::Mutex | m_wait_reset |
Mutex for waiting for reset. | |
void | ack_reset_start (void) |
For worker to acknowledge start of reset cycle. | |
void | ack_reset_stop (void) |
For worker to acknowledge stop of reset cycle. | |
void | wait_reset (void) |
For worker to wait for all workers to reset. | |
Search control | |
| |
Support::Mutex | m_search |
Mutex for search. | |
Support::Event | e_search |
Event for search (solution found, no more solutions, search stopped). | |
Support::DynamicQueue< Space *, Heap > | solutions |
Queue of solutions. | |
volatile unsigned int | n_busy |
Number of busy workers. | |
volatile bool | has_stopped |
Whether a worker had been stopped. | |
void | idle (void) |
Report that worker is idle. | |
void | busy (void) |
Report that worker is busy. | |
void | stop (void) |
Report that worker has been stopped. | |
bool | signal (void) const |
Whether search state changed such that signal is needed. | |
Engine interface | |
| |
Engine (const Options &o) | |
Initialize with options o. | |
virtual Space * | next (void) |
Return next solution (NULL, if none exists or search has been stopped). | |
virtual bool | stopped (void) const |
Check whether engine has been stopped. |
Detailed Description
Parallel depth-first search engine
Definition at line 49 of file engine.hh.
Member Enumeration Documentation
Constructor & Destructor Documentation
Gecode::Search::Parallel::Engine::Engine | ( | const Options & | o | ) | [inline] |
Member Function Documentation
const Options & Gecode::Search::Parallel::Engine::opt | ( | void | ) | const [inline] |
unsigned int Gecode::Search::Parallel::Engine::workers | ( | void | ) | const [inline] |
Engine::Cmd Gecode::Search::Parallel::Engine::cmd | ( | void | ) | const [inline] |
void Gecode::Search::Parallel::Engine::block | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::release | ( | Cmd | c | ) | [inline] |
void Gecode::Search::Parallel::Engine::wait | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::ack_terminate | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::terminated | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::wait_terminate | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::terminate | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::ack_reset_start | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::ack_reset_stop | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::wait_reset | ( | void | ) | [inline] |
bool Gecode::Search::Parallel::Engine::signal | ( | void | ) | const [inline, protected] |
void Gecode::Search::Parallel::Engine::idle | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::busy | ( | void | ) | [inline] |
void Gecode::Search::Parallel::Engine::stop | ( | void | ) | [inline] |
Space * Gecode::Search::Parallel::Engine::next | ( | void | ) | [virtual] |
Return next solution (NULL, if none exists or search has been stopped).
Implements Gecode::Search::Engine.
Reimplemented in Gecode::Search::Parallel::Restart.
Definition at line 50 of file engine.cpp.
bool Gecode::Search::Parallel::Engine::stopped | ( | void | ) | const [virtual] |
Check whether engine has been stopped.
Implements Gecode::Search::Engine.
Definition at line 101 of file engine.cpp.
Member Data Documentation
const Options Gecode::Search::Parallel::Engine::_opt [protected] |
volatile Cmd Gecode::Search::Parallel::Engine::_cmd [protected] |
volatile unsigned int Gecode::Search::Parallel::Engine::_n_term_not_ack [protected] |
volatile unsigned int Gecode::Search::Parallel::Engine::_n_not_terminated [protected] |
volatile unsigned int Gecode::Search::Parallel::Engine::_n_reset_not_ack [protected] |
volatile unsigned int Gecode::Search::Parallel::Engine::n_busy [protected] |
volatile bool Gecode::Search::Parallel::Engine::has_stopped [protected] |
The documentation for this class was generated from the following files:
- gecode/search/parallel/engine.hh (Revision: 11992)
- gecode/search/parallel/engine.cpp (Revision: 9585)