36namespace Gecode {
namespace Search {
namespace Seq {
80 : stat(stat0), slice(opt.slice),
86 for (
unsigned int i=0U; i<
n; i++) {
96 unsigned int n_exhausted = 0;
97 while (n_slaves > 0) {
98 if (
Space* s = slaves[cur].next()) {
101 for (
unsigned int i=0U; i<cur; i++)
102 slaves[i].constrain(*s);
103 for (
unsigned int i=cur+1; i<n_slaves; i++)
104 slaves[i].constrain(*s);
108 if (slaves[cur].stopped()) {
110 cur++; n_exhausted++;
117 stat += slaves[cur].statistics();
118 slaves[cur].~Slave();
119 slaves[cur] = slaves[--n_slaves];
124 if (n_exhausted == n_slaves) {
145 for (
unsigned int i=0U; i<n_slaves; i++)
146 s += slaves[i].statistics();
154 throw NoBest(
"PBS::constrain");
155 for (
unsigned int i=0U; i<n_slaves; i++)
156 slaves[i].constrain(
b);
161 for (
unsigned int i=0U; i<n_slaves; i++)
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
void rfree(void *p)
Free memory block starting at p.
Search engine implementation interface
virtual void constrain(const Space &b)
Constrain future solutions to be better than b (raises exception)
virtual Statistics statistics(void) const =0
Return statistics.
virtual Space * next(void)=0
Return next solution (NULL, if none exists or search has been stopped)
virtual bool stopped(void) const =0
Check whether engine has been stopped.
Exception: Best solution search is not supported
SharedStopInfo ssi
Shared slave information.
virtual ~PBS(void)
Destructor.
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.
virtual Statistics statistics(void) const
Return statistics.
virtual void constrain(const Space &b)
Constrain future solutions to be better than b.
PBS(Engine **slaves, Stop **stops, unsigned int n, const Statistics &stat, const Search::Options &opt)
Initialize.
Stop object used for controling slaves in a portfolio.
void share(SharedStopInfo *ssi)
Intialize shared stop information.
PortfolioStop(Stop *so)
Initialize.
unsigned long int l
The current failure limit, incremented for each slice.
bool done
Whether search stopped because the slice is done.
Runnable slave of a portfolio master.
bool stopped(void) const
Check whether slave has been stopped.
Space * next(void)
Return next solution.
Engine * slave
The slave engine.
void constrain(const Space &b)
Constrain with better solution b.
void init(Engine *s, Stop *so)
Initialize with slave s and its stop object so.
Statistics statistics(void) const
Return statistics of slave.
~Slave(void)
Delete slave.
Base-class for Stop-object.
Heap heap
The single global heap.
Gecode toplevel namespace