main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Jan 28 2020 00:00:00 for Gecode by
doxygen
1.8.17
gecode
search
dfs.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
* Copyright:
7
* Christian Schulte, 2003
8
*
9
* Last modified:
10
* $Date: 2016-04-19 17:19:45 +0200 (Tue, 19 Apr 2016) $ by $Author: schulte $
11
* $Revision: 14967 $
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
dfs
(Space* s,
const
Options& o);
43
45
template
<
class
T>
46
class
DfsBuilder
:
public
Builder
{
47
using
Builder::opt
;
48
public
:
50
DfsBuilder
(
const
Options
&
opt
);
52
virtual
Engine
*
operator()
(
Space
* s)
const
;
53
};
54
55
template
<
class
T>
56
inline
57
DfsBuilder<T>::DfsBuilder
(
const
Options
&
opt
)
58
:
Builder
(
opt
,
DFS
<T>::best) {}
59
60
template
<
class
T>
61
Engine
*
62
DfsBuilder<T>::operator()
(
Space
* s)
const
{
63
return
build<T,DFS>(s,
opt
);
64
}
65
66
}}
67
68
namespace
Gecode
{
69
70
template
<
class
T>
71
inline
72
DFS<T>::DFS
(T* s,
const
Search::Options
& o)
73
: Search::Base<T>(Search::
dfs
(s,o)) {}
74
75
template
<
class
T>
76
inline
T*
77
dfs
(T* s,
const
Search::Options
& o) {
78
DFS<T>
d
(s,o);
79
return
d
.next();
80
}
81
82
template
<
class
T>
83
SEB
84
dfs
(
const
Search::Options
& o) {
85
return
new
Search::DfsBuilder<T>
(o);
86
}
87
88
}
89
90
// STATISTICS: search-other
GECODE_SEARCH_EXPORT
#define GECODE_SEARCH_EXPORT
Definition:
search.hh:63
Gecode::Search::Options
Search engine options
Definition:
search.hh:446
Gecode::Search::Builder
A class for building search engines.
Definition:
search.hh:667
Gecode::dfs
T * dfs(T *s, const Search::Options &o)
Invoke depth-first search engine for subclass T of space s with options o.
Definition:
dfs.hpp:77
Gecode::Search::dfs
Engine * dfs(Space *s, const Options &o)
Create depth-first engine.
Definition:
dfs.cpp:48
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::DFS
Depth-first search engine.
Definition:
search.hh:739
Gecode::DFS::DFS
DFS(T *s, const Search::Options &o=Search::Options::def)
Initialize search engine for space s with options o.
Definition:
dfs.hpp:72
Gecode
Gecode toplevel namespace
Gecode::SEB
Search::Builder * SEB
Type for a search engine builder.
Definition:
search.hh:695
Test::opt
Options opt
The options.
Definition:
test.cpp:101
Gecode::Search::Engine
Search engine implementation interface
Definition:
search.hh:601
Gecode::Search::DfsBuilder
A DFS engine builder.
Definition:
dfs.hpp:46
Gecode::Search::DfsBuilder::DfsBuilder
DfsBuilder(const Options &opt)
The constructor.
Definition:
dfs.hpp:57
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Gecode::dfs
SEB dfs(const Search::Options &o)
Return a depth-first search engine builder.
Definition:
dfs.hpp:84
Gecode::Search::Builder::opt
Options opt
Stored and already expanded options.
Definition:
search.hh:670
Gecode::Search::DfsBuilder::operator()
virtual Engine * operator()(Space *s) const
The actual build function.
Definition:
dfs.hpp:62