BayesOpt
bopt_state.hpp
Go to the documentation of this file.
1 
3 /*
4 -------------------------------------------------------------------------
5  This file is part of BayesOpt, an efficient C++ library for
6  Bayesian optimization.
7 
8  Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
9 
10  BayesOpt is free software: you can redistribute it and/or modify it
11  under the terms of the GNU Affero General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  BayesOpt is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Affero General Public License for more details.
19 
20  You should have received a copy of the GNU Affero General Public License
21  along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
22 ------------------------------------------------------------------------
23 */
24 
25 
26 #ifndef _BOPT_STATE_HPP_
27 #define _BOPT_STATE_HPP_
28 
29 #include "bayesopt/parameters.hpp"
30 #include "specialtypes.hpp"
31 #include "fileparser.hpp"
32 
33 
37 namespace bayesopt {
38 
46  class BOptState{
47  public:
49  BOptState();
50 
52  void saveToFile(std::string filename);
53 
55  bool loadFromFile(std::string filename, Parameters &program_params);
56 
57  // BayesOptBase members
58  size_t mCurrentIter;
59  size_t mCounterStuck;
60  double mYPrev;
61  Parameters mParameters;
62 
63  // Optimization samples
64  vecOfvec mX;
65  vectord mY;
66  private:
67  void loadOrSave(utils::FileParser &fp);
68  };
69 } //namespace bayesopt
70 
71 
72 #endif
Boost vector and matrix types.
void saveToFile(std::string filename)
Creates or overwrites the provided file with the state.
Definition: bopt_state.cpp:33
Class that represents the state of an optimization.
Definition: bopt_state.hpp:46
Namespace of the library interface.
Definition: using.dox:1
bool loadFromFile(std::string filename, Parameters &program_params)
Loads the state from the provided file and takes program_params values if needed. ...
Definition: bopt_state.cpp:39
BOptState()
Constructor, parameters set into default.
Definition: bopt_state.cpp:31
Functions to write and parse data files.
Parameter definitions.