81 virtual bool best(
void)
const = 0;
85 if (mi.
last() != NULL)
86 constrain(*mi.
last());
121 virtual bool best(
void)
const {
125 static std::string
name(
void) {
156 virtual bool best(
void)
const {
160 static std::string
name(
void) {
193 : x(*this,6,0,5), htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {
204 htb1(s.htb1), htb2(s.htb2), htb3(s.htb3), htc(s.htc) {
221 for (
int i=0;
i<6;
i++)
230 for (
int i=0;
i<6;
i++)
232 IntVar xs(*
this, -18, 18);
233 IntVar ys(*
this, -18, 18);
234 rel(*
this, x[0]+x[1]+x[2]-x[3]-x[4]-x[5] == xs);
235 rel(*
this, y[0]+y[1]+y[2]-y[3]-y[4]-y[5] == ys);
257 virtual bool best(
void)
const {
265 return ((x[0].val()==4) && (x[1].val()==5) &&
266 (x[2].val()==2) && (x[3].val()==3) &&
267 (x[4].val()==0) && (x[5].val()==1));
269 return ((x[0].val()==5) && (x[1].val()==4) &&
270 (x[2].val()==3) && (x[3].val()==2) &&
271 (x[4].val()==1) && (x[5].val()==0));
273 return ((x[0].val()==4) && (x[1].val()==5) &&
274 (x[2].val()==2) && (x[3].val()==3) &&
275 (x[4].val()==0) && (x[5].val()==1));
277 return ((x[0].val()==4) && (x[1].val()==5) &&
278 (x[2].val()==3) && (x[3].val()==2) &&
279 (x[4].val()==0) && (x[5].val()==1));
285 static std::string
name(
void) {
292 if (mi.
last() != NULL) {
297 b <<
expr(*
this, x[
i] == s->
x[
i]);
319 static std::string
str(
unsigned int i) {
353 :
Base(
"Search::"+s),
354 htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {}
358 template<
class Model>
370 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
371 :
Test(
"DFS::"+Model::name()+
"::"+
372 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
373 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
374 htb1,htb2,htb3), c_d(c_d0), a_d(a_d0), t(t0) {}
377 Model* m =
new Model(htb1,htb2,htb3);
385 int n = m->solutions();
388 Model* s = dfs.
next();
392 if ((s == NULL) && !dfs.
stopped())
401 template<
class Model>
410 :
Test(
"LDS::"+Model::name()+
"::"+
411 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+str(t0),
412 htb1,htb2,htb3), t(t0) {}
415 Model* m =
new Model(htb1,htb2,htb3);
422 int n = m->solutions();
425 Model* s = lds.
next();
429 if ((s == NULL) && !lds.
stopped())
438 template<
class Model>
451 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
452 :
Test(
"BAB::"+Model::name()+
"::"+str(htc)+
"::"+
453 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
454 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
455 htb1,htb2,htb3,htc), c_d(c_d0), a_d(a_d0), t(t0) {}
458 Model* m =
new Model(htb1,htb2,htb3,htc);
469 Model* s = bab.
next();
473 if ((s == NULL) && !bab.
stopped())
477 bool ok = (b == NULL) || b->best();
484 template<
class Model,
template<
class>
class Engine>
491 RBS(
const std::string& e,
unsigned int t0)
492 :
Test(
"RBS::"+e+
"::"+Model::name()+
"::"+str(t0),
496 Model* m =
new Model(htb1,htb2,htb3);
504 int n = m->solutions();
507 Model* s = rbs.
next();
511 if ((s == NULL) && !rbs.
stopped())
520 template<
class Model,
template<
class>
class Engine>
531 PBS(
const std::string& e,
bool b,
unsigned int a0,
unsigned int t0)
532 :
Test(
"PBS::"+e+
"::"+Model::name()+
"::"+str(a0)+
"::"+str(t0),
536 Model* m =
new Model(htb1,htb2,htb3);
547 Model* s = pbs.
next();
551 if ((s == NULL) && !pbs.
stopped())
555 bool ok = (b == NULL) || b->best();
559 int n = ((t > 1) ?
std::min(a,t) :
a) * m->solutions();
562 Model* s = pbs.
next();
566 if ((s == NULL) && !pbs.
stopped())
576 template<
class Model>
587 SEBPBS(
const std::string& e,
bool b,
unsigned int mt0,
unsigned int st0)
588 :
Test(
"PBS::SEB::"+e+
"::"+Model::name()+
"::"+str(mt0)+
"::"+str(st0),
593 Model* m =
new Model(htb1,htb2,htb3);
607 sebs[0] = bab<Model>(so);
608 sebs[1] = bab<Model>(so);
609 sebs[2] = rbs<Model,Gecode::BAB>(so);
615 Model* s = pbs.next();
619 if ((s == NULL) && !pbs.stopped())
623 bool ok = (b == NULL) || b->best();
628 sebs[0] = dfs<Model>(so);
629 sebs[1] = lds<Model>(so);
630 sebs[2] = rbs<Model,Gecode::DFS>(so);
633 int n = 3 * m->solutions();
637 Model* s = pbs.next();
641 if ((s == NULL) && !pbs.stopped())
710 for (
unsigned int t = 1;
t<=4;
t++)
711 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
717 (htb1.htb(),htb2.htb(),htb3.htb(),
c_d,
a_d,
t);
727 for (
unsigned int t = 1;
t<=4;
t++) {
738 for (
unsigned int t = 1;
t<=4;
t++)
739 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
746 (htc.htc(),htb1.htb(),htb2.htb(),htb3.htb(),
757 for (
unsigned int t=1;
t<=4;
t++) {
769 for (
unsigned int a=1;
a<=4;
a++)
770 for (
unsigned int t=1;
t<=2*
a;
t++) {
782 for (
unsigned int mt=1; mt<=3; mt += 2)
783 for (
unsigned int st=1; st<=8; 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.
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.
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.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
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.
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.
virtual Space * copy(void)
Copy during cloning.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
Create(void)
Perform creation and registration.
Test(const std::string &s, HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Initialize test.
Model that fails immediately.
Cutoff * cutoff
Cutoff for restart-based search.
double threads
Number of threads to use.
Constrain for lexically smallest.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
TestSpace(TestSpace &s)
Constructor for cloning s.
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.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
virtual bool run(void)
Run test.
Branch with many alternatives.
static Cutoff * geometric(unsigned long int scale=Config::slice, double base=Config::base)
T * lds(T *s, const Search::Options &o)
Invoke limited-discrepancy search for s as root node and optionso.
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.
HasSolutions(HasSolutions &s)
Constructor for cloning s.
T * pbs(T *s, const Search::Options &o)
Run a portfolio of search engines.
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Post propagator for SetVar SetOpType SetVar y
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.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
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
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
bool operator()(void) const
Test whether iterator is done.
RBS(const std::string &e, unsigned int t0)
Initialize test.
#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.