Go to the documentation of this file.
81 virtual bool best(
void)
const = 0;
85 if (mi.
last() != NULL)
86 constrain(*mi.
last());
107 x.update(*
this, s.
x);
121 virtual bool best(
void)
const {
125 static std::string
name(
void) {
141 x.update(*
this, s.
x);
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) {
205 x.update(*
this, s.
x);
213 const HasSolutions& s = static_cast<const HasSolutions&>(_s);
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) {
294 = static_cast<const HasSolutions*>(mi.
last());
296 for (
int i=0;
i<
x.size();
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())
394 f.limit(
f.limit()+2);
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())
431 f.limit(
f.limit()+2);
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())
475 f.limit(
f.limit()+2);
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())
513 f.limit(
f.limit()+2);
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())
553 f.limit(
f.limit()+2);
555 bool ok = (
b == NULL) ||
b->best();
562 Model* s =
pbs.next();
566 if ((s == NULL) && !
pbs.stopped())
568 f.limit(
f.limit()+2);
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())
621 f.limit(
f.limit()+2);
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())
643 f.limit(
f.limit()+2);
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++) {
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
IntVarArray x
Variables used.
Test for portfolio-based search using SEBs
static std::string name(void)
Return name.
BAB(HowToConstrain htc, HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0)
Initialize test.
Post propagator for SetVar SetOpType SetVar y
Branch with two alternatives.
Branch with single alternative.
virtual bool run(void)
Run test.
Constrain for lexically biggest.
HasSolutions(HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Constructor for space creation.
Model that fails immediately.
void operator++(void)
Increment to next branching type.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Depth-first branch-and-bound search engine.
static Cutoff * constant(unsigned long int scale=Config::slice)
Create generator for constant sequence with constant s.
Passing integer variables.
virtual bool run(void)
Run test.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
Limited discrepancy search engine.
HowToBranch
Values for selecting branchers.
const FloatNum min
Smallest allowed float value.
static std::string str(HowToBranch htb)
Map branching to string.
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.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
Depth-first search engine.
HowToConstrain htc
How to constrain.
LDS(HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int t0)
Initialize test.
ConstrainTypes(void)
Initialize iterator.
Constrain for largest balance.
RBS(const std::string &e, unsigned int t0)
Initialize test.
static Cutoff * geometric(unsigned long int scale=Config::slice, double base=Config::base)
void branch(const IntVarArgs &x, HowToBranch htb)
Branch on x according to htb.
T * pbs(T *s, const Search::Options &o)
Run a portfolio of search engines.
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
virtual bool run(void)
Run test.
Gecode toplevel namespace
Passing search engine builder arguments.
Constrain for smallest balance.
Base class for all tests to be run
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
virtual bool master(const MetaInfo &mi)
Rule out that solution is found more than once during restarts.
Cutoff * cutoff
Cutoff for restart-based search.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Meta-engine performing restart-based search.
Node * x
Pointer to corresponding Boolean expression node.
Meta engine using a portfolio of search engines.
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
Stop * stop
Stop object for stopping search.
Passing Boolean variables.
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
WhichModel
Values for selecting models.
virtual Space * copy(void)
Copy during cloning.
virtual bool master(const MetaInfo &mi)
Master configuration function that does not restart.
Iterator for constrain types.
Test(const std::string &s, HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Initialize test.
HasSolutions(HasSolutions &s)
Constructor for cloning s.
HowToBranch htb(void) const
Return current branching type.
Iterator for branching types.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with variable selection vars and value selection vals.
void operator++(void)
Increment to next constrain type.
virtual bool run(void)
Run test.
HowToConstrain
Values for selecting how to constrain.
static std::string str(HowToConstrain htc)
Map constrain to string.
PBS(const std::string &e, bool b, unsigned int a0, unsigned int t0)
Initialize test.
#define GECODE_NEVER
Assert that this command is never executed.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
bool operator()(void) const
Test whether iterator is done.
HowToConstrain htc(void) const
Return current constrain type.
void lex(Home home, const IntVarArgs &x, IntRelType r, const IntVarArgs &y, IntPropLevel ipl)
Post lexical order between x and y.
virtual bool run(void)
Run test.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Branch with many alternatives.
unsigned int assets
Number of assets (engines) in a portfolio.
virtual bool run(void)
Run test.
bool operator()(void) const
Test whether iterator is done.
TestSpace(void)
Constructor for space creation.
DFS(HowToBranch htb1, HowToBranch htb2, HowToBranch htb3, unsigned int c_d0, unsigned int a_d0, unsigned int t0)
Initialize test.
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
Create(void)
Perform creation and registration.
virtual int solutions(void) const
Return number of solutions.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Constrain for lexically smallest.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
SEBPBS(const std::string &e, bool b, unsigned int mt0, unsigned int st0)
Initialize test.
Stop-object based on number of failures
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
Space that requires propagation and has solutions.
int n
Number of negative literals for node type.
virtual bool best(void) const
Verify that this is best solution.
unsigned int d_l
Discrepancy limit (for LDS)
Gecode::IntArgs i({1, 2, 3, 4})
virtual void constrain(const Space &_s)
Add constraint for next better solution.
HowToConstrain htc
How to constrain.
Help class to create and register tests.
T * lds(T *s, const Search::Options &o)
Invoke limited-discrepancy search for s as root node and optionso.
TestSpace(TestSpace &s)
Constructor for cloning s.
BranchTypes(void)
Initialize iterator.
double threads
Number of threads to use.
T * rbs(T *s, const Search::Options &o)
Perform restart-based search.
static std::string str(unsigned int i)
Map unsigned integer to string.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.