Generated on Tue Jul 18 2017 18:41:42 for Gecode by doxygen 1.8.13
lds.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, 2004, 2016
8  *
9  * Last modified:
10  * $Date: 2016-09-22 16:19:20 +0200 (Thu, 22 Sep 2016) $ by $Author: schulte $
11  * $Revision: 15169 $
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  lds(Space* s, const Options& o);
43 
45  template<class T>
46  class LdsBuilder : public Builder {
47  using Builder::opt;
48  public:
50  LdsBuilder(const Options& opt);
52  virtual Engine* operator() (Space* s) const;
53  };
54 
55  template<class T>
56  inline
58  : Builder(opt,LDS<T>::best) {}
59 
60  template<class T>
61  Engine*
63  return build<T,LDS>(s,opt);
64  }
65 
66 
67 }}
68 
69 namespace Gecode {
70 
71  template<class T>
73  LDS<T>::LDS(T* s, const Search::Options& o)
74  : Search::Base<T>(Search::lds(s,o)) {}
75 
76  template<class T>
77  T*
78  lds(T* s, const Search::Options& o) {
79  LDS<T> lds(s,o);
80  return lds.next();
81  }
82 
83  template<class T>
84  SEB
85  lds(const Search::Options& o) {
86  return new Search::LdsBuilder<T>(o);
87  }
88 
89 }
90 
91 // STATISTICS: search-other
Search engine implementation interface
Definition: search.hh:601
Limited discrepancy search engine.
Definition: search.hh:811
#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
A DFS engine builder.
Definition: lds.hpp:46
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
Definition: base.hpp:50
virtual Engine * operator()(Space *s) const
The actual build function.
Definition: lds.hpp:62
Computation spaces.
Definition: core.hpp:1748
LdsBuilder(const Options &opt)
The constructor.
Definition: lds.hpp:57
T * lds(T *s, const Search::Options &o)
Invoke limited-discrepancy search for s as root node and optionso.
Definition: lds.hpp:78
LDS(T *s, const Search::Options &o=Search::Options::def)
Initialize engine for space s and options o.
Definition: lds.hpp:73
bool best(void) const
Whether engine is a best solution search engine.
Definition: build.hpp:52
#define forceinline
Definition: config.hpp:173
Gecode toplevel namespace
Engine * lds(Space *s, const Options &o)
Create lds engine.
Definition: lds.cpp:48