BayesOpt
param_loader.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 _PARAM_LOADER_HPP_
27 #define _PARAM_LOADER_HPP_
28 
29 #include <fstream>
30 #include <iostream>
31 #include <string.h>
32 
33 #include "bayesopt/parameters.hpp"
34 #include "specialtypes.hpp"
35 #include "fileparser.hpp"
36 
37 
41 namespace bayesopt {
42  namespace utils{
43  class ParamLoader{
44  public:
45  /* Loads params from provided file, returns true if file exists */
46  static bool load(std::string filename, Parameters &par);
47  /* This one could be useful to create param files from existing hard-coded params */
48  static void save(std::string filename, Parameters &par);
49  private:
50  ParamLoader(){}
51 
52  /* private function to be used by load and save functions */
53  static void loadOrSave(utils::FileParser &fp, Parameters &par);
54  };
55  }
56 } //namespace bayesopt
57 
58 
59 #endif
Boost vector and matrix types.
Namespace of the library interface.
Definition: using.dox:1
Functions to write and parse data files.
Parameter definitions.