Generated on Fri Jul 13 2018 06:08:30 for Gecode by doxygen 1.8.14
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
58  : Builder(opt,DFS<T>::best) {}
59 
60  template<class T>
61  Engine*
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
Search engine implementation interface
Definition: search.hh:601
DfsBuilder(const Options &opt)
The constructor.
Definition: dfs.hpp:57
#define GECODE_SEARCH_EXPORT
Definition: search.hh:63
Search engine options
Definition: search.hh:446
A class for building search engines.
Definition: search.hh:667
Options opt
Stored and already expanded options.
Definition: search.hh:670
Computation spaces.
Definition: core.hpp:1748
Engine * dfs(Space *s, const Options &o)
Create depth-first engine.
Definition: dfs.cpp:48
Gecode::IntSet d(v, 7)
Options opt
The options.
Definition: test.cpp:101
virtual Engine * operator()(Space *s) const
The actual build function.
Definition: dfs.hpp:62
Search::Builder * SEB
Type for a search engine builder.
Definition: search.hh:695
A DFS engine builder.
Definition: dfs.hpp:46
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
SEB dfs(const Search::Options &o)
Return a depth-first search engine builder.
Definition: dfs.hpp:84
Gecode toplevel namespace
Depth-first search engine.
Definition: search.hh:739
DFS(T *s, const Search::Options &o=Search::Options::def)
Initialize search engine for space s with options o.
Definition: dfs.hpp:72