main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Jan 1 2020 10:37:59 for Gecode by
doxygen
1.8.16
gecode
search
bab.hpp
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
* Contributing authors:
7
* Guido Tack <tack@gecode.org>
8
*
9
* Copyright:
10
* Christian Schulte, 2004
11
* Guido Tack, 2004
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
namespace
Gecode
{
namespace
Search {
39
41
GECODE_SEARCH_EXPORT
Engine*
42
babengine
(Space* s,
const
Options& o);
43
45
template
<
class
T>
46
class
BabBuilder
:
public
Builder
{
47
using
Builder::opt
;
48
public
:
50
BabBuilder
(
const
Options
&
opt
);
52
virtual
Engine
*
operator()
(
Space
* s)
const
;
53
};
54
55
template
<
class
T>
56
inline
57
BabBuilder<T>::BabBuilder
(
const
Options
&
opt
)
58
:
Builder
(
opt
,
BAB
<T>::best) {}
59
60
template
<
class
T>
61
Engine
*
62
BabBuilder<T>::operator()
(
Space
* s)
const
{
63
return
build<T,BAB>(s,
opt
);
64
}
65
66
}}
67
68
namespace
Gecode
{
69
70
template
<
class
T>
71
inline
72
BAB<T>::BAB
(T* s,
const
Search::Options
& o)
73
: Search::Base<T>(Search::
babengine
(s,o)) {}
74
75
template
<
class
T>
76
inline
T*
77
bab
(T* s,
const
Search::Options
& o) {
78
BAB<T>
b
(s,o);
79
T*
l
= NULL;
80
while
(T*
n
=
b
.next()) {
81
delete
l
;
l
=
n
;
82
}
83
return
l
;
84
}
85
86
template
<
class
T>
87
SEB
88
bab
(
const
Search::Options
& o) {
89
return
new
Search::BabBuilder<T>
(o);
90
}
91
92
}
93
94
// STATISTICS: search-other
b
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
GECODE_SEARCH_EXPORT
#define GECODE_SEARCH_EXPORT
Definition:
search.hh:67
Gecode::Search::Options
Search engine options
Definition:
search.hh:746
Gecode::Search::Builder
A class for building search engines.
Definition:
search.hh:965
Gecode::BAB
Depth-first branch-and-bound search engine.
Definition:
search.hh:1070
Gecode::Search::BabBuilder::BabBuilder
BabBuilder(const Options &opt)
The constructor.
Definition:
bab.hpp:57
Gecode::Search::BabBuilder
A BAB engine builder.
Definition:
bab.hpp:46
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode
Gecode toplevel namespace
Gecode::SEB
Search::Builder * SEB
Type for a search engine builder.
Definition:
search.hh:993
Gecode::bab
T * bab(T *s, const Search::Options &o)
Perform depth-first branch-and-bound search for subclass T of space s and options o.
Definition:
bab.hpp:77
Test::opt
Options opt
The options.
Definition:
test.cpp:97
Gecode::Search::Engine
Search engine implementation interface
Definition:
search.hh:899
Gecode::Search::babengine
Engine * babengine(Space *s, const Options &o)
Create branch and bound engine.
Definition:
bab.cpp:45
l
NNF * l
Left subtree.
Definition:
bool-expr.cpp:240
Gecode::BAB::BAB
BAB(T *s, const Search::Options &o=Search::Options::def)
Initialize engine for space s and options o.
Definition:
bab.hpp:72
Gecode::Search::Builder::opt
Options opt
Stored and already expanded options.
Definition:
search.hh:968
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234
Gecode::Search::BabBuilder::operator()
virtual Engine * operator()(Space *s) const
The actual build function.
Definition:
bab.hpp:62