BayesOpt
bayesopt.hpp
Go to the documentation of this file.
1 
2 /*
3 -------------------------------------------------------------------------
4  This file is part of BayesOpt, an efficient C++ library for
5  Bayesian optimization.
6 
7  Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
8 
9  BayesOpt is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Affero General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  BayesOpt is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Affero General Public License for more details.
18 
19  You should have received a copy of the GNU Affero General Public License
20  along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
21 ------------------------------------------------------------------------
22 */
23 
24 #ifndef _BAYESOPTAPI_HPP_
25 #define _BAYESOPTAPI_HPP_
26 
27 #include "bayesoptbase.hpp"
28 
29 namespace bayesopt {
30 
31  // Forward declarations
32  namespace utils
33  {
34  template <class V>
35  class BoundingBox;
36  }
37  class NLOPT_Optimization;
38  class CritCallback;
39 
40 
41 
78  class BAYESOPT_API ContinuousModel: public BayesOptBase
79  {
80  public:
86  ContinuousModel(size_t dim, Parameters params);
87 
89  virtual ~ContinuousModel();
90 
97  void setBoundingBox(const vectord &lowerBound,
98  const vectord &upperBound);
99 
100 
101  protected:
104  vectord samplePoint();
105 
111  void findOptimal(vectord &xOpt);
112 
115  vectord remapPoint(const vectord& x);
116 
118  void generateInitialPoints(matrixd& xPoints);
119 
120  private:
121  boost::scoped_ptr<utils::BoundingBox<vectord> > mBB;
122  boost::scoped_ptr<NLOPT_Optimization> cOptimizer;
123  boost::scoped_ptr<CritCallback> mCallback;
124 
125  private:
126  ContinuousModel();
127  };
128 
129 
166  class BAYESOPT_API DiscreteModel : public BayesOptBase
167  {
168  public:
174  DiscreteModel(const vecOfvec &validSet, Parameters params);
175 
181  DiscreteModel(const vectori &categories, Parameters params);
182 
184  virtual ~DiscreteModel();
185 
186  protected:
189  vectord samplePoint();
190 
196  void findOptimal(vectord &xOpt);
197 
199  vectord remapPoint(const vectord& x);
200 
202  void generateInitialPoints(matrixd& xPoints);
203 
204  private:
205  vecOfvec mInputSet;
206 
207  DiscreteModel();
208  };
209 
210 
214 } //namespace bayesopt
215 
216 
217 #endif
Namespace of the library interface.
Definition: using.dox:1
Bayesian optimization for functions in continuous input spaces.
Definition: bayesopt.hpp:78
Defines a bounding box or axis-alligned bound constraints.
Definition: bayesopt.hpp:35
Abstract module for Bayesian optimization.
boost::scoped_ptr< utils::BoundingBox< vectord > > mBB
Bounding Box (input space limits)
Definition: bayesopt.hpp:121
Bayesian optimization for functions in discrete spaces.
Definition: bayesopt.hpp:166
vecOfvec mInputSet
List of input points.
Definition: bayesopt.hpp:205
BayesOpt common module for interfaces.