main page
modules
namespaces
classes
files
Gecode home
Generated on Mon Feb 8 2021 00:00:00 for Gecode by
doxygen
1.8.20
gecode
search
seq
lds.hh
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Christian Schulte <schulte@gecode.org>
5
*
6
* Copyright:
7
* Christian Schulte, 2004, 2016
8
*
9
* This file is part of Gecode, the generic constraint
10
* development environment:
11
* http://www.gecode.org
12
*
13
* Permission is hereby granted, free of charge, to any person obtaining
14
* a copy of this software and associated documentation files (the
15
* "Software"), to deal in the Software without restriction, including
16
* without limitation the rights to use, copy, modify, merge, publish,
17
* distribute, sublicense, and/or sell copies of the Software, and to
18
* permit persons to whom the Software is furnished to do so, subject to
19
* the following conditions:
20
*
21
* The above copyright notice and this permission notice shall be
22
* included in all copies or substantial portions of the Software.
23
*
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
*
32
*/
33
34
#ifndef __GECODE_SEARCH_SEQ_LDS_HH__
35
#define __GECODE_SEARCH_SEQ_LDS_HH__
36
37
#include <
gecode/search.hh
>
38
#include <
gecode/search/support.hh
>
39
#include <
gecode/search/worker.hh
>
40
41
namespace
Gecode
{
namespace
Search {
namespace
Seq {
42
44
template
<
class
Tracer>
45
class
Probe
:
public
Worker
{
46
protected
:
48
typedef
typename
Tracer::ID
ID
;
50
class
Node
{
51
private
:
53
Space
* _space;
55
const
Choice
* _choice;
57
unsigned
int
_alt;
59
ID
_nid;
60
public
:
62
Node
(
void
);
64
Node
(
Space
* s,
const
Choice
*
c
,
unsigned
int
a
,
unsigned
int
nid
);
66
Space
*
space
(
void
)
const
;
68
const
Choice
*
choice
(
void
)
const
;
70
unsigned
int
alt
(
void
)
const
;
72
unsigned
int
nid
(
void
)
const
;
74
void
next
(
void
);
75
};
77
Tracer
tracer
;
79
Support::DynamicStack<Node,Heap>
ds
;
81
Space
*
cur
;
83
unsigned
int
d
;
85
bool
exhausted
;
86
public
:
88
Probe
(
const
Options
&
opt
);
90
void
init
(
Space
* s);
92
void
reset
(
Space
* s,
unsigned
int
d
);
94
Statistics
statistics
(
void
)
const
;
96
~Probe
(
void
);
98
Space
*
next
(
const
Options
& o);
100
bool
done
(
void
)
const
;
101
};
102
104
template
<
class
Tracer>
105
class
LDS
:
public
Engine
{
106
protected
:
108
Options
opt
;
110
Probe<Tracer>
e
;
112
Space
*
root
;
114
unsigned
int
d
;
116
bool
no_solution
;
117
public
:
119
LDS
(
Space
* s,
const
Options
& o);
121
virtual
Space
*
next
(
void
);
123
virtual
Statistics
statistics
(
void
)
const
;
125
void
constrain
(
const
Space
&
b
);
127
void
reset
(
Space
* s);
129
virtual
bool
stopped
(
void
)
const
;
131
virtual
~LDS
(
void
);
132
};
133
134
}}}
135
136
#include <
gecode/search/seq/lds.hpp
>
137
138
#endif
139
140
// STATISTICS: search-seq
Gecode::Search::Seq::Probe::Node::alt
unsigned int alt(void) const
Return next alternative.
Definition:
lds.hpp:66
Gecode::Search::Seq::Probe::Node::choice
const Choice * choice(void) const
Return choice.
Definition:
lds.hpp:60
Gecode::Search::Worker
Search worker statistics
Definition:
worker.hh:44
worker.hh
Gecode::Search::Seq::LDS::e
Probe< Tracer > e
The probe engine.
Definition:
lds.hh:110
Gecode::Search::Seq::Probe::statistics
Statistics statistics(void) const
Return statistics.
Definition:
lds.hpp:121
Gecode::Search::Seq::LDS::LDS
LDS(Space *s, const Options &o)
Initialize for space s with options o.
Definition:
lds.hpp:272
Gecode::Search::Options
Search engine options
Definition:
search.hh:746
Gecode::Search::Seq::Probe::~Probe
~Probe(void)
Destructor.
Definition:
lds.hpp:133
Gecode::Search::Seq::Probe::cur
Space * cur
Current space.
Definition:
lds.hh:81
search.hh
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
support.hh
Gecode::Search::Seq::LDS::~LDS
virtual ~LDS(void)
Destructor.
Definition:
lds.hpp:345
Gecode::Search::Seq::Probe::done
bool done(void) const
Test whether probing is done.
Definition:
lds.hpp:127
Gecode::Search::Seq::Probe::Node
Node in the search tree for LDS
Definition:
lds.hh:50
Gecode::Search::Seq::LDS::d
unsigned int d
Current discrepancy.
Definition:
lds.hh:114
Gecode
Gecode toplevel namespace
Gecode::Search::Seq::LDS::root
Space * root
Root node for problem.
Definition:
lds.hh:112
Test::opt
Options opt
The options.
Definition:
test.cpp:97
Gecode::Search::Seq::Probe::next
Space * next(const Options &o)
Search for next solution
Definition:
lds.hpp:142
Gecode::Search::Engine
Search engine implementation interface
Definition:
search.hh:899
b
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
Gecode::Search::Seq::LDS::no_solution
bool no_solution
Solution found for current discrepancy.
Definition:
lds.hh:116
Gecode::Search::Seq::LDS
Limited discrepancy search engine implementation.
Definition:
lds.hh:105
Gecode::Search::Seq::Probe::ds
Support::DynamicStack< Node, Heap > ds
Stack storing current path in search tree
Definition:
lds.hh:79
Gecode::Search::Seq::Probe::exhausted
bool exhausted
Whether entire search space has been exhausted.
Definition:
lds.hh:85
Gecode::Search::Seq::LDS::opt
Options opt
Search options.
Definition:
lds.hh:108
Gecode::Search::Seq::Probe
Probe engine for LDS
Definition:
lds.hh:45
a
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Gecode::Search::Seq::Probe::Node::space
Space * space(void) const
Return space.
Definition:
lds.hpp:54
Gecode::Tracer
Tracer.
Definition:
tracer.hpp:149
Gecode::Search::Seq::Probe::Node::nid
unsigned int nid(void) const
Return node identifier.
Definition:
lds.hpp:72
Gecode::Search::Seq::LDS::statistics
virtual Statistics statistics(void) const
Return statistics.
Definition:
lds.hpp:315
lds.hpp
Gecode::Search::Seq::LDS::reset
void reset(Space *s)
Reset engine to restart at space s.
Definition:
lds.hpp:322
Gecode::Search::Seq::Probe::init
void init(Space *s)
Initialize with space s.
Definition:
lds.hpp:100
Gecode::Search::Seq::Probe::Probe
Probe(const Options &opt)
Initialize.
Definition:
lds.hpp:92
Gecode::Search::Seq::Probe::ID
Tracer::ID ID
Node identity type.
Definition:
lds.hh:48
Gecode::Support::DynamicStack
Stack with arbitrary number of elements.
Definition:
dynamic-stack.hpp:42
Gecode::Search::Seq::Probe::Node::next
void next(void)
Set next alternative
Definition:
lds.hpp:78
Test::Float::Arithmetic::c
Gecode::FloatVal c(-8, 8)
Gecode::Search::Statistics::reset
void reset(void)
Reset.
Definition:
statistics.hpp:39
Gecode::Search::Seq::Probe::Node::Node
Node(void)
Default constructor.
Definition:
lds.hpp:44
Gecode::Search::Seq::LDS::stopped
virtual bool stopped(void) const
Check whether engine has been stopped.
Definition:
lds.hpp:309
Gecode::Choice
Choice for performing commit
Definition:
core.hpp:1412
Gecode::Search::Seq::LDS::next
virtual Space * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Definition:
lds.hpp:289
Gecode::Search::Statistics
Search engine statistics
Definition:
search.hh:147
Gecode::Search::Seq::Probe::tracer
Tracer tracer
Search tracer.
Definition:
lds.hh:77
Gecode::Search::Seq::LDS::constrain
void constrain(const Space &b)
Constrain future solutions to be better than b (should never be called)
Definition:
lds.hpp:339
Gecode::Search::Seq::Probe::d
unsigned int d
Current discrepancy.
Definition:
lds.hh:83