38 #ifndef __GECODE_SEARCH_PARALLEL_BAB_HH__
39 #define __GECODE_SEARCH_PARALLEL_BAB_HH__
43 namespace Gecode {
namespace Search {
namespace Parallel {
61 virtual void run(
void);
119 path.reset((s == NULL) ? 0 : ngdl);
204 for (
unsigned int i=0;
i<engine().workers();
i++) {
205 unsigned long int r_d = 0ul;
206 if (
Space* s = engine().worker(
i)->steal(r_d)) {
216 cur->constrain(*
best);
Worker * worker(unsigned int i) const
Provide access to worker i.
Path path
Current path ins search tree.
virtual ~BAB(void)
Destructor.
virtual Statistics statistics(void) const
Return statistics.
Space * clone(bool share=true, CloneStatistics &stat=unused_clone) const
Clone space.
void idle(void)
Report that worker is idle.
static void run(Runnable *r)
Construct a new thread and run r.
virtual void reset(Space *s)
Reset engine to restart at space s.
void acquire(void)
Acquire the mutex and possibly block.
void * ralloc(size_t s)
Allocate s bytes from heap.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntConLevel icl)
Post propagator such that x forms a Hamiltonian path.
void * mark(void *p)
Return marked pointer for p.
void block(void)
Block all workers.
void signal(void)
Signal the event.
Parallel branch-and-bound search worker
void better(Space *b)
Accept better solution b.
Heap heap
The single global heap.
void release(void)
Release the mutex.
BAB(Space *s, const Options &o)
Initialize for space s with options o.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual void constrain(const Space &best)
Constrain function for best solution search.
int entries(void) const
Return number of entries on stack.
Space * cur
Current space being explored.
unsigned int workers(void) const
Return number of workers.
virtual ~Worker(void)
Destructor.
void find(void)
Try to find some work.
virtual NoGoods & nogoods(void)
Return no-goods.
Support::Event e_search
Event for search (solution found, no more solutions, search stopped)
Space * best
Best solution found so far.
Parallel depth-first search engine
int mark
Number of entries not yet constrained to be better.
BAB & engine(void) const
Provide access to engine.
No-goods recorded from restarts.
Parallel branch-and-bound engine
void solution(Space *s)
Report solution s.
Parallel depth-first search worker
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Support::DynamicQueue< Space *, Heap > solutions
Queue of solutions.
Engine & _engine
Reference to engine.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
Worker ** _worker
Array of worker references.
Space * best
Best solution so far.
virtual void run(void)
Start execution of worker.
Support::Mutex m
Mutex for access to worker.
bool signal(void) const
Whether search state changed such that signal is needed.
Support::Mutex m_search
Mutex for search.