SGSolve
sgenv.hpp
1 // This file is part of the SGSolve library for stochastic games
2 // Copyright (C) 2019 Benjamin A. Brooks
3 //
4 // SGSolve free software: you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // SGSolve is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see
16 // <http://www.gnu.org/licenses/>.
17 //
18 // Benjamin A. Brooks
19 // ben@benjaminbrooks.net
20 // Chicago, IL
21 
22 #ifndef _SGENV_HPP
23 #define _SGENV_HPP
24 
25 #include "sgexception.hpp"
26 
28 
34 class SGEnv
35 {
36 private:
37  // Parameters
38 
40  vector<double> doubleParams;
41 
43  vector<bool> boolParams;
44 
46  vector<int> intParams;
47 
48 public:
49 
51 
53  SGEnv();
54 
55  ~SGEnv() {}
56 
58  void setParam(SG::DBL_PARAM param, double value);
59 
61  void setParam(SG::BOOL_PARAM param, bool value);
62 
64  void setParam(SG::INT_PARAM param, int value);
65 
67  double getParam(SG::DBL_PARAM param) const;
68 
70  bool getParam(SG::BOOL_PARAM param) const;
71 
73  int getParam(SG::INT_PARAM param) const;
74 
76  void restoreDefaults();
77 
78 
80  template<class Archive>
81  void serialize(Archive &ar, const unsigned int version)
82  {
83  ar & doubleParams;
84  ar & boolParams;
85  ar & intParams;
86  } // serialize
87 
88 };
89 
90 #endif
SGEnv::getParam
double getParam(SG::DBL_PARAM param) const
Method for getting double parameters.
Definition: sgenv.cpp:96
SGEnv::doubleParams
vector< double > doubleParams
Double parameters.
Definition: sgenv.hpp:40
SGEnv::SGEnv
SGEnv()
Constructor.
Definition: sgenv.cpp:24
SG::INT_PARAM
INT_PARAM
Integer parameters.
Definition: sgnamespace.hpp:142
SG::DBL_PARAM
DBL_PARAM
Double parameters.
Definition: sgnamespace.hpp:68
SGEnv::serialize
void serialize(Archive &ar, const unsigned int version)
Serializes the action using the boost::serialization library.
Definition: sgenv.hpp:81
SGEnv::boolParams
vector< bool > boolParams
Bool parameters.
Definition: sgenv.hpp:43
SGEnv
Manages parameters for algorithm behavior.
Definition: sgenv.hpp:35
SGEnv::intParams
vector< int > intParams
Int parameters.
Definition: sgenv.hpp:46
SGEnv::setParam
void setParam(SG::DBL_PARAM param, double value)
Method for setting double parameters.
Definition: sgenv.cpp:68
SG::BOOL_PARAM
BOOL_PARAM
Boolean parameters.
Definition: sgnamespace.hpp:116
SGEnv::restoreDefaults
void restoreDefaults()
Method for restoring default values for all parameters.
Definition: sgenv.cpp:32