37namespace Gecode {
namespace Search {
40 template<
class T,
template<
class>
class E>
50 template<
class T,
template<
class>
class E>
55 template<
class T,
template<
class>
class E>
58 return build<T,PBS<T,E> >(s,
opt);
65namespace Gecode {
namespace Search {
namespace Seq {
73 pbsengine(Engine** slaves, Stop** stops,
unsigned int n_slaves,
74 const Statistics& stat,
const Search::Options&
opt,
bool best);
78namespace Gecode {
namespace Search {
namespace Par {
86 pbsengine(Engine** slaves, Stop** stops,
unsigned int n_slaves,
87 const Statistics& stat,
bool best);
91namespace Gecode {
namespace Search {
93 template<
class T,
template<
class>
class E>
108 SearchTracer::EngineType::PBS, n_slaves);
110 for (
unsigned int i=0U;
i<n_slaves;
i++) {
112 Space* slave = (
i == n_slaves-1) ?
113 master : master->
clone();
115 slaves[
i] = build<T,E>(slave,
opt);
121 template<
class T,
template<
class>
class E>
127 int n_slaves = sebs.
size();
132 SearchTracer::EngineType::PBS, n_slaves);
134 for (
int i=0;
i<n_slaves;
i++) {
137 sebs[
i]->options().stop = stops[
i];
138 sebs[
i]->options().clone =
false;
139 Space* slave = (
i == n_slaves-1) ?
140 master : master->
clone();
142 slaves[
i] = (*sebs[
i])(slave);
149#ifdef GECODE_HAS_THREADS
151 template<
class T,
template<
class>
class E>
164 SearchTracer::EngineType::PBS, n_slaves);
169 for (
unsigned int i=0U;
i<n_slaves;
i++) {
171 Space* slave = (
i == n_slaves-1) ?
172 master : master->
clone();
174 slaves[
i] = build<T,E>(slave,
opt);
180 template<
class T,
template<
class>
class E>
191 SearchTracer::EngineType::PBS, n_slaves);
196 for (
int i=0;
i<n_slaves;
i++) {
199 sebs[
i]->options().stop = stops[
i];
200 sebs[
i]->options().clone =
false;
201 Space* slave = (
i == n_slaves-1) ?
202 master : master->
clone();
204 slaves[
i] = (*sebs[
i])(slave);
208 for (
int i=n_slaves;
i<sebs.
size();
i++)
220 template<
class T,
template<
class>
class E>
238 T* master =
opt.clone ?
239 dynamic_cast<T*
>(s->clone()) : s;
243 (void) master->master(0);
247 (void) master->slave(0);
248 e = Search::build<T,E>(master,
opt);
252#ifdef GECODE_HAS_THREADS
254 e = Search::pbspar<T,E>(master,stat,
opt);
257 e = Search::pbsseq<T,E>(master,stat,
opt);
260 template<
class T,
template<
class>
class E>
267 for (
int i=0;
i<sebs.
size();
i++)
268 b += sebs[
i]->best() ? 1 : 0;
269 if ((
b > 0) && (
b < sebs.
size()))
271 best = (
b == sebs.
size());
286 T* master =
opt.clone ?
287 dynamic_cast<T*
>(s->clone()) : s;
291 (void) master->master(0);
293#ifdef GECODE_HAS_THREADS
295 e = Search::pbspar<T,E>(master,sebs,stat,
opt,best);
298 e = Search::pbsseq<T,E>(master,sebs,stat,
opt,best);
301 template<
class T,
template<
class>
class E>
307 template<
class T,
template<
class>
class E>
314 template<
class T,
template<
class>
class E>
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int size(void) const
Return size of array (number of elements)
void assets(unsigned int n)
Set default number of assets in a portfolio.
void threads(double n)
Set number of parallel threads.
Meta engine using a portfolio of search engines.
void build(T *s, SEBs &sebs, const Search::Options &o)
The actual build function.
PBS(T *s, const Search::Options &o=Search::Options::def)
Initialize with engines running copies of s with options o.
Passing search engine builder arguments.
A class for building search engines.
Options opt
Stored and already expanded options.
Search engine implementation interface
Exception: Mixed non-best and best solution search requested
Exception: No assets requested for portfolio-based search
Options expand(void) const
Expand with real number of threads.
Stop * stop
Stop object for stopping search.
SearchTracer * tracer
Tracer object for tracing search.
unsigned int assets
Number of assets (engines) in a portfolio.
double threads
Number of threads to use.
PbsBuilder(const Options &opt)
The constructor.
virtual Engine * operator()(Space *s) const
The actual build function.
unsigned long int fail
Number of failed nodes in search tree.
Base-class for Stop-object.
static void engine(SearchTracer *tracer, SearchTracer::EngineType t, unsigned int n)
Register engine.
virtual bool slave(const MetaInfo &mi)
Slave configuration function for meta search engines.
T * pbs(T *s, const Search::Options &o=Search::Options::def)
Run a portfolio of search engines.
Space * clone(CloneStatistics &stat=unused_clone) const
Clone space.
@ SS_FAILED
Space is failed
void stop(Support::Timer &timer, std::ostream &os)
Get time since start of timer and print user friendly time information.
const FloatNum max
Largest allowed float value.
const FloatNum min
Smallest allowed float value.
Engine * pbsengine(Engine **slaves, Stop **stops, unsigned int n_slaves, const Statistics &stat, bool best)
Create parallel portfolio engine.
Stop * pbsstop(Stop *so)
Create stop object.
Engine * dead(const Options &o, const Statistics &stat)
Stop * pbsstop(Stop *so)
Create stop object.
Engine * pbsengine(Engine **slaves, Stop **stops, unsigned int n_slaves, const Statistics &stat, const Search::Options &opt, bool best)
Create sequential portfolio engine.
Engine * build(Space *s, const Options &opt)
Build an engine of type E for a script T.
Engine * pbspar(T *master, const Search::Statistics &stat, Options &opt)
Engine * pbsseq(T *master, const Search::Statistics &stat, Options &opt)
Gecode toplevel namespace
Search::Builder * SEB
Type for a search engine builder.
Post propagator for SetVar SetOpType SetVar SetRelType r
Gecode::IntArgs i({1, 2, 3, 4})
#define GECODE_SEARCH_EXPORT