85 virtual bool best(
void)
const = 0;
101 x.update(*
this, share, s.
x);
115 virtual bool best(
void)
const {
119 static std::string
name(
void) {
135 x.update(*
this, share, s.
x);
150 virtual bool best(
void)
const {
154 static std::string
name(
void) {
187 :
x(*this,6,0,5), htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {
198 htb1(s.htb1), htb2(s.htb2), htb3(s.htb3), htc(s.htc) {
199 x.update(*
this, share, s.
x);
207 const HasSolutions& s = static_cast<const HasSolutions&>(_s);
215 for (
int i=0;
i<6;
i++)
224 for (
int i=0;
i<6;
i++)
226 IntVar xs(*
this, -18, 18);
227 IntVar ys(*
this, -18, 18);
228 rel(*
this,
x[0]+
x[1]+
x[2]-
x[3]-
x[4]-
x[5] == xs);
229 rel(*
this, y[0]+y[1]+y[2]-y[3]-y[4]-y[5] == ys);
251 virtual bool best(
void)
const {
259 return ((
x[0].val()==4) && (
x[1].val()==5) &&
260 (
x[2].val()==2) && (
x[3].val()==3) &&
261 (
x[4].val()==0) && (
x[5].val()==1));
263 return ((
x[0].val()==5) && (
x[1].val()==4) &&
264 (
x[2].val()==3) && (
x[3].val()==2) &&
265 (
x[4].val()==1) && (
x[5].val()==0));
267 return ((
x[0].val()==4) && (
x[1].val()==5) &&
268 (
x[2].val()==2) && (
x[3].val()==3) &&
269 (
x[4].val()==0) && (
x[5].val()==1));
271 return ((
x[0].val()==4) && (
x[1].val()==5) &&
272 (
x[2].val()==3) && (
x[3].val()==2) &&
273 (
x[4].val()==0) && (
x[5].val()==1));
279 static std::string
name(
void) {
285 const HasSolutions* s = static_cast<const HasSolutions*>(_s);
288 for (
int i=0;
i<
x.size();
i++)
303 static std::string
str(
unsigned int i) {
337 :
Base(
"Search::"+s),
338 htb1(_htb1), htb2(_htb2), htb3(_htb3), htc(_htc) {}
342 template<
class Model>
354 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
355 :
Test(
"DFS::"+Model::name()+
"::"+
356 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
357 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
358 htb1,htb2,htb3),
c_d(c_d0),
a_d(a_d0),
t(t0) {}
361 Model* m =
new Model(htb1,htb2,htb3);
369 int n = m->solutions();
372 Model* s =
dfs.next();
376 if ((s == NULL) && !
dfs.stopped())
385 template<
class Model>
398 unsigned int c_d0,
unsigned int a_d0,
unsigned int t0)
399 :
Test(
"BAB::"+Model::name()+
"::"+str(htc)+
"::"+
400 str(htb1)+
"::"+str(htb2)+
"::"+str(htb3)+
"::"+
401 str(c_d0)+
"::"+str(a_d0)+
"::"+str(t0),
402 htb1,htb2,htb3,htc),
c_d(c_d0),
a_d(a_d0),
t(t0) {}
405 Model* m =
new Model(htb1,htb2,htb3,htc);
416 Model* s =
bab.next();
420 if ((s == NULL) && !
bab.stopped())
424 bool ok = (
b == NULL) ||
b->best();
431 template<
class Model,
template<
class>
class Engine>
438 RBS(
const std::string& e,
unsigned int t0)
439 :
Test(
"RBS::"+e+
"::"+Model::name()+
"::"+str(t0),
443 Model* m =
new Model(htb1,htb2,htb3);
450 int n = m->solutions();
525 for (
unsigned int t = 1;
t<=4;
t++)
526 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
532 (htb1.htb(),htb2.htb(),htb3.htb(),
c_d,
a_d,
t);
542 for (
unsigned int t = 1;
t<=4;
t++)
543 for (
unsigned int c_d = 1;
c_d<10;
c_d++)
550 (htc.htc(),htb1.htb(),htb2.htb(),htb3.htb(),
561 for (
unsigned int t = 1;
t<=4;
t++) {
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.
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.
static Cutoff * geometric(unsigned long int scale=1U, double base=1.5)
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 .
HowToConstrain htc
How to constrain.
struct Gecode::@511::NNF::@54::@55 b
For binary nodes (and, or, eqv)
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.
void branch(const IntVarArgs &x, HowToBranch htb)
Branch on x according to htb.
virtual void master(unsigned long int i, const Space *_s, NoGoods &)
Rule out that solution is found more than once during restarts.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
Create(void)
Perform creation and registration.
virtual Space * copy(bool share)
Copy during cloning.
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.
Gecode::IntArgs i(4, 1, 2, 3, 4)
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.
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.
void lex(Home home, const IntVarArgs &x, IntRelType r, const IntVarArgs &y, IntConLevel icl=ICL_DEF)
Post lexical order between x and y.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
TestSpace(void)
Constructor for space creation.
Base class for all tests to be run
Branch with many alternatives.
Passing integer variables.
Passing Boolean variables.
Space that requires propagation and has solutions.
Branch with single alternative.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
Iterator for constrain types.
BrancherHandle assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
Node * x
Pointer to corresponding Boolean expression node.
Constrain for smallest balance.
Help class to create and register tests.
HowToConstrain
Values for selecting how to constrain.
No-goods recorded from restarts.
HasSolutions(HowToBranch _htb1, HowToBranch _htb2, HowToBranch _htb3, HowToConstrain _htc=HTC_NONE)
Constructor for space creation.
ConstrainTypes(void)
Initialize iterator.
virtual Space * next(void)=0
Return next solution (NULL, if none exists or search has been stopped)
IntVarArray x
Variables used.
bool operator()(void) const
Test whether iterator is done.
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.
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
BranchTypes(void)
Initialize iterator.
virtual int solutions(void) const
Return number of solutions.
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.
BrancherHandle 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.
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.
Engine * rbs(Space *s, MetaStop *stop, Engine *e, const Options &o)
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.
virtual bool stopped(void) const =0
Check whether engine has been stopped.