38 #ifndef __GECODE_SEARCH_SEQUENTIAL_LDS_HH__ 39 #define __GECODE_SEARCH_SEQUENTIAL_LDS_HH__ 45 namespace Gecode {
namespace Search {
namespace Sequential {
69 unsigned int alt(
void)
const;
95 bool done(
void)
const;
123 virtual bool stopped(
void)
const;
139 : _space(s), _choice(
c), _alt(
a) {}
182 delete ds.pop().space();
201 delete ds.pop().space();
214 unsigned int a =
ds.top().alt();
215 const Choice* ch =
ds.top().choice();
217 cur =
ds.pop().space();
222 cur =
ds.top().space()->clone();
268 unsigned int d_a = (
d >= alt-1) ? alt-1 :
d;
270 Node sn(cc,ch,d_a-1);
280 goto check_discrepancy;
289 :
opt(o), root(NULL),
d(0) {
unsigned int alternatives(void) const
Return number of alternatives.
Search engine implementation interface
Space must be branched (at least one brancher left)
Space * root
Root node for problem.
Space * next(const Options &o)
Search for next solution
unsigned long int fail
Number of failed nodes in search tree.
unsigned int d
Current discrepancy.
Space * clone(bool share_data=true, bool share_info=true, CloneStatistics &stat=unused_clone) const
Clone space.
void reset(Space *s)
Reset engine to restart at space s.
unsigned int d_l
Discrepancy limit (for LDS)
void start(void)
Reset stop information.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
virtual Space * next(void)
Return next solution (NULL, if none exists or search has been stopped)
void reset(Space *s, unsigned int d)
Reset with space s and discrepancy d.
Statistics statistics(void) const
Return statistics.
bool failed(void) const
Check whether space is failed.
void commit(const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
Commit choice c for alternative a.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Options opt
Search options.
Node(void)
Default constructor.
Node in the search tree for LDS
Space * space(void) const
Return space.
void constrain(const Space &b)
Constrain future solutions to be better than b (should never be called)
const Choice * choice(void) const
Return choice.
unsigned int alt(void) const
Return next alternative.
void next(void)
Set next alternative
Choice for performing commit
LDS(Space *s, const Options &o)
Initialize for space s with options o.
Heap heap
The single global heap.
bool exhausted
Whether entire search space has been exhausted.
Stack with arbitrary number of elements.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Space * snapshot(Space *s, const Options &o, bool share=true)
Clone space s dependening on options o.
void stack_depth(unsigned long int d)
Record stack depth d.
Gecode toplevel namespace
unsigned long int node
Number of nodes expanded.
Support::DynamicStack< Node, Heap > ds
Stack storing current path in search tree
Space * cur
Current space.
virtual Statistics statistics(void) const
Return statistics.
virtual bool stopped(void) const
Check whether engine has been stopped.
const Choice * choice(void)
Create new choice for current brancher.
virtual ~LDS(void)
Destructor.
bool done(void) const
Test whether probing is done.
unsigned int d
Current discrepancy.
#define GECODE_NEVER
Assert that this command is never executed.
void init(Space *s)
Initialize with space s.
bool stop(const Options &o)
Check whether engine must be stopped.
Space is solved (no brancher left)
Limited discrepancy search engine implementation.
bool no_solution
Solution found for current discrepancy.