Generated on Tue Mar 24 2020 14:04:04 for Gecode by doxygen 1.8.17
Gecode::Search::Par::PBS< Collect > Class Template Reference

Parallel portfolio engine implementation. More...

#include <pbs.hh>

Public Member Functions

 PBS (Engine **s, Stop **so, unsigned int n, const Statistics &stat)
 Initialize. More...
 
virtual Spacenext (void)
 Return next solution (NULL, if none exists or search has been stopped) More...
 
virtual Statistics statistics (void) const
 Return statistics. More...
 
virtual bool stopped (void) const
 Check whether engine has been stopped. More...
 
virtual void constrain (const Space &b)
 Constrain future solutions to be better than b. More...
 
virtual ~PBS (void)
 Destructor. More...
 

Protected Member Functions

bool report (Slave< Collect > *slave, Space *s)
 Process report from slave, return false if solution was ignored. More...
 

Protected Attributes

Statistics stat
 Master statistics. More...
 
Slave< Collect > ** slaves
 Slave engines. More...
 
unsigned int n_slaves
 Number of slave engines. More...
 
unsigned int n_active
 Number of active slave engines. More...
 
bool slave_stop
 Whether a slave has been stopped. More...
 
volatile bool tostop
 Shared stop flag. More...
 
Collect solutions
 Collect solutions in this. More...
 
Support::Mutex m
 Mutex for synchronization. More...
 
unsigned int n_busy
 Number of busy slaves. More...
 
Support::Event idle
 Signal that number of busy slaves becomes zero. More...
 

Detailed Description

template<class Collect>
class Gecode::Search::Par::PBS< Collect >

Parallel portfolio engine implementation.

Definition at line 63 of file pbs.hh.

Constructor & Destructor Documentation

◆ PBS()

template<class Collect >
Gecode::Search::Par::PBS< Collect >::PBS ( Engine **  s,
Stop **  so,
unsigned int  n,
const Statistics stat 
)
inline

Initialize.

The key invariant of the engine is as follows:

  • n_busy is always zero outside the next() function.
  • that entails, that locking is only needed insided next().
  • the slaves 0..n_active-1 still might not have exausted their search space.
  • the slaves n_active..n_slaves-1 have exhausted their search space.

Definition at line 155 of file pbs.hpp.

◆ ~PBS()

template<class Collect >
Gecode::Search::Par::PBS< Collect >::~PBS ( void  )
virtual

Destructor.

Definition at line 284 of file pbs.hpp.

Member Function Documentation

◆ report()

template<class Collect >
bool Gecode::Search::Par::PBS< Collect >::report ( Slave< Collect > *  slave,
Space s 
)
inlineprotected

Process report from slave, return false if solution was ignored.

Definition at line 170 of file pbs.hpp.

◆ next()

template<class Collect >
Space * Gecode::Search::Par::PBS< Collect >::next ( void  )
virtual

Return next solution (NULL, if none exists or search has been stopped)

Definition at line 210 of file pbs.hpp.

◆ statistics()

template<class Collect >
Statistics Gecode::Search::Par::PBS< Collect >::statistics ( void  ) const
virtual

Return statistics.

Definition at line 262 of file pbs.hpp.

◆ stopped()

template<class Collect >
bool Gecode::Search::Par::PBS< Collect >::stopped ( void  ) const
virtual

Check whether engine has been stopped.

Definition at line 256 of file pbs.hpp.

◆ constrain()

template<class Collect >
void Gecode::Search::Par::PBS< Collect >::constrain ( const Space b)
virtual

Constrain future solutions to be better than b.

Definition at line 272 of file pbs.hpp.

Member Data Documentation

◆ stat

template<class Collect >
Statistics Gecode::Search::Par::PBS< Collect >::stat
protected

Master statistics.

Definition at line 142 of file pbs.hh.

◆ slaves

template<class Collect >
Slave<Collect>** Gecode::Search::Par::PBS< Collect >::slaves
protected

Slave engines.

Definition at line 144 of file pbs.hh.

◆ n_slaves

template<class Collect >
unsigned int Gecode::Search::Par::PBS< Collect >::n_slaves
protected

Number of slave engines.

Definition at line 146 of file pbs.hh.

◆ n_active

template<class Collect >
unsigned int Gecode::Search::Par::PBS< Collect >::n_active
protected

Number of active slave engines.

Definition at line 148 of file pbs.hh.

◆ slave_stop

template<class Collect >
bool Gecode::Search::Par::PBS< Collect >::slave_stop
protected

Whether a slave has been stopped.

Definition at line 150 of file pbs.hh.

◆ tostop

template<class Collect >
volatile bool Gecode::Search::Par::PBS< Collect >::tostop
protected

Shared stop flag.

Definition at line 152 of file pbs.hh.

◆ solutions

template<class Collect >
Collect Gecode::Search::Par::PBS< Collect >::solutions
protected

Collect solutions in this.

Definition at line 154 of file pbs.hh.

◆ m

template<class Collect >
Support::Mutex Gecode::Search::Par::PBS< Collect >::m
protected

Mutex for synchronization.

Definition at line 156 of file pbs.hh.

◆ n_busy

template<class Collect >
unsigned int Gecode::Search::Par::PBS< Collect >::n_busy
protected

Number of busy slaves.

Definition at line 158 of file pbs.hh.

◆ idle

template<class Collect >
Support::Event Gecode::Search::Par::PBS< Collect >::idle
protected

Signal that number of busy slaves becomes zero.

Definition at line 160 of file pbs.hh.


The documentation for this class was generated from the following files: