85 virtual bool best(
void)
const = 0;
89 if (mi.
last() != NULL)
90 constrain(*mi.
last());
125 virtual bool best(
void)
const {
129 static std::string
name(
void) {
160 virtual bool best(
void)
const {
164 static std::string
name(
void) {
197 : x(*this,6,0,5), htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {
208 htb1(s.htb1), htb2(s.htb2), htb3(s.htb3), htc(s.htc) {
225 for (
int i=0;
i<6;
i++)
234 for (
int i=0;
i<6;
i++)
236 IntVar xs(*
this, -18, 18);
237 IntVar ys(*
this, -18, 18);
238 rel(*
this, x[0]+x[1]+x[2]-x[3]-x[4]-x[5] == xs);
239 rel(*
this, y[0]+y[1]+y[2]-y[3]-y[4]-y[5] == ys);
261 virtual bool best(
void)
const {
269 return ((x[0].val()==4) && (x[1].val()==5) &&
270 (x[2].val()==2) && (x[3].val()==3) &&
271 (x[4].val()==0) && (x[5].val()==1));
273 return ((x[0].val()==5) && (x[1].val()==4) &&
274 (x[2].val()==3) && (x[3].val()==2) &&
275 (x[4].val()==1) && (x[5].val()==0));
277 return ((x[0].val()==4) && (x[1].val()==5) &&
278 (x[2].val()==2) && (x[3].val()==3) &&
279 (x[4].val()==0) && (x[5].val()==1));
281 return ((x[0].val()==4) && (x[1].val()==5) &&
282 (x[2].val()==3) && (x[3].val()==2) &&
283 (x[4].val()==0) && (x[5].val()==1));
289 static std::string
name(
void) {
296 if (mi.
last() != NULL) {
301 b <<
expr(*
this, x[
i] == s->
x[
i]);
323 static std::string
str(
unsigned int i) {
357 :
Base(
"Search::"+s),
358 htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {}
362 template<
class Model>
374 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
375 :
Test(
"DFS::"+Model::name()+
"::"+
376 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
377 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
378 htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) {}
381 Model* m =
new Model(htb1,htb2,htb3);
389 int n = m->solutions();
392 Model* s = dfs.
next();
396 if ((s == NULL) && !dfs.
stopped())
405 template<
class Model>
414 :
Test(
"LDS::"+Model::name()+
"::"+
415 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+str(t0),
416 htb1,htb2,htb3), t(t0) {}
419 Model* m =
new Model(htb1,htb2,htb3);
426 int n = m->solutions();
429 Model* s = lds.
next();
433 if ((s == NULL) && !lds.
stopped())
442 template<
class Model>
455 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
456 :
Test(
"BAB::"+Model::name()+
"::"+str(htc)+
"::"+
457 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
458 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
459 htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) {}
462 Model* m =
new Model(htb1,htb2,htb3,htc);
473 Model* s = bab.
next();
477 if ((s == NULL) && !bab.
stopped())
481 bool ok = (b == NULL) || b->best();
488 template<
class Model,
template<
class>
class Engine>
495 RBS(
const std::string& e,
unsigned int t0)
496 :
Test(
"RBS::"+e+
"::"+Model::name()+
"::"+str(t0),
500 Model* m =
new Model(htb1,htb2,htb3);
508 int n = m->solutions();
511 Model* s = rbs.
next();
515 if ((s == NULL) && !rbs.
stopped())
524 template<
class Model,
template<
class>
class Engine>
535 PBS(
const std::string& e,
bool b,
unsigned int a0,
unsigned int t0)
536 :
Test(
"PBS::"+e+
"::"+Model::name()+
"::"+str(a0)+
"::"+str(t0),
540 Model* m =
new Model(htb1,htb2,htb3);
551 Model* s = pbs.
next();
555 if ((s == NULL) && !pbs.
stopped())
559 bool ok = (b == NULL) || b->best();
563 int n = ((t > 1) ?
std::min(a,t) :
a) * m->solutions();
566 Model* s = pbs.
next();
570 if ((s == NULL) && !pbs.
stopped())
580 template<
class Model>
591 SEBPBS(
const std::string& e,
bool b,
unsigned int mt0,
unsigned int st0)
592 :
Test(
"PBS::SEB::"+e+
"::"+Model::name()+
"::"+str(mt0)+
"::"+str(st0),
597 Model* m =
new Model(htb1,htb2,htb3);
611 sebs[0] = bab<Model>(so);
612 sebs[1] = bab<Model>(so);
613 sebs[2] = rbs<Model,Gecode::BAB>(so);
619 Model* s = pbs.next();
623 if ((s == NULL) && !pbs.stopped())
627 bool ok = (b == NULL) || b->best();
632 sebs[0] = dfs<Model>(so);
633 sebs[1] = lds<Model>(so);
634 sebs[2] = rbs<Model,Gecode::DFS>(so);
637 int n = 3 * m->solutions();
641 Model* s = pbs.next();
645 if ((s == NULL) && !pbs.stopped())
714 for (
unsigned int t = 1;
t<=4;
t++)
715 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
721 (htb1.htb(),htb2.htb(),htb3.htb(),
c_d,
a_d,
t);
731 for (
unsigned int t = 1;
t<=4;
t++) {
742 for (
unsigned int t = 1;
t<=4;
t++)
743 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
750 (htc.htc(),htb1.htb(),htb2.htb(),htb3.htb(),
761 for (
unsigned int t=1;
t<=4;
t++) {
773 for (
unsigned int a=1;
a<=4;
a++)
774 for (
unsigned int t=1;
t<=2*
a;
t++) {
786 for (
unsigned int mt=1; mt<=3; mt += 2)
787 for (
unsigned int st=1; st<=2; st++) {
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Iterator for branching types.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Limited discrepancy search engine.
void lex(Home home, const IntVarArgs &x, IntRelType r, const IntVarArgs &y, IntPropLevel ipl=IPL_DEF)
Post lexical order between x and y.
SEBPBS(const std::string &e, bool b, unsigned int mt0, unsigned int st0)
Initialize test.
static std::string name(void)
Return name.
TestSpace(bool share, TestSpace &s)
Constructor for cloning s.
virtual bool best(void) const
Verify that this is best solution.
Meta-engine performing restart-based search.
int size(void) const
Return size of array (number of elements)
Meta engine using a portfolio of search engines.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
static std::string str(HowToConstrain htc)
Map constrain to string.
BAB(HowToConstrain htc, HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0)
Initialize test.
HasSolutions(bool share, HasSolutions &s)
Constructor for cloning s.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
HowToConstrain htc
How to constrain.
HowToConstrain htc(void) const
Return current constrain type.
DFS(HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0)
Initialize test.
void operator++(void)
Increment to next branching type.
HowToConstrain htc
How to constrain.
unsigned long int limit(void) const
Return current limit.
virtual bool run(void)
Run test.
unsigned int d_l
Discrepancy limit (for LDS)
void branch(const IntVarArgs &x, HowToBranch htb)
Branch on x according to htb.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
Create(void)
Perform creation and registration.
virtual Space * copy(bool share)
Copy during cloning.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
Test(const std::string &s, HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Initialize test.
Model that fails immediately.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
Cutoff * cutoff
Cutoff for restart-based search.
double threads
Number of threads to use.
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
Constrain for lexically smallest.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
int n
Number of negative literals for node type.
virtual bool run(void)
Run test.
static std::string str(HowToBranch htb)
Map branching to string.
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
Depth-first branch-and-bound search engine.
void operator++(void)
Increment to next constrain type.
LDS(HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int t0)
Initialize test.
static std::string str(unsigned int i)
Map unsigned integer to string.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
WhichModel
Values for selecting models.
Branch with two alternatives.
HowToBranch htb(void) const
Return current branching type.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
TestSpace(void)
Constructor for space creation.
Base class for all tests to be run
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
virtual bool master(const MetaInfo &mi)
Rule out that solution is found more than once during restarts.
virtual bool run(void)
Run test.
Branch with many alternatives.
static Cutoff * geometric(unsigned long int scale=Config::slice, double base=Config::base)
Passing integer variables.
Passing Boolean variables.
virtual bool master(const MetaInfo &mi)
Master configuration function that does not restart.
unsigned int assets
Number of assets (engines) in a portfolio.
Space that requires propagation and has solutions.
Branch with single alternative.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
T * pbs(T *s, const Search::Options &o)
Run a portfolio of search engines.
virtual bool run(void)
Run test.
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
Iterator for constrain types.
Constrain for smallest balance.
Help class to create and register tests.
HowToConstrain
Values for selecting how to constrain.
HasSolutions(HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Constructor for space creation.
ConstrainTypes(void)
Initialize iterator.
IntVarArray x
Variables used.
bool operator()(void) const
Test whether iterator is done.
PBS(const std::string &e, bool b, unsigned int a0, unsigned int t0)
Initialize test.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
HowToBranch
Values for selecting branchers.
Constrain for lexically biggest.
virtual bool run(void)
Run test.
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
virtual bool stopped(void) const
Check whether engine has been stopped.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
BranchTypes(void)
Initialize iterator.
Passing search engine builder arguments.
virtual int solutions(void) const
Return number of solutions.
static Cutoff * constant(unsigned long int scale=Config::slice)
Create generator for constant sequence with constant s.
Stop * stop
Stop object for stopping search.
virtual void constrain(const Space &_s)
Add constraint for next better solution.
virtual bool run(void)
Run test.
Gecode toplevel namespace
Constrain for largest balance.
Test for portfolio-based search using SEBs
struct Gecode::@554::NNF::@60::@61 b
For binary nodes (and, or, eqv)
bool operator()(void) const
Test whether iterator is done.
RBS(const std::string &e, unsigned int t0)
Initialize test.
Engine * lds(Space *s, const Options &o)
Create lds engine.
#define GECODE_NEVER
Assert that this command is never executed.
T * rbs(T *s, const Search::Options &o)
Perform restart-based search.
Depth-first search engine.
Stop-object based on number of failures
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.