hops
ExpectedSquaredJumpDistanceTuner.hpp
Go to the documentation of this file.
1 #ifndef NEW_HOPS_EXPECTEDSQUAREDJUMPDISTANCETUNER_HPP
2 #define NEW_HOPS_EXPECTEDSQUAREDJUMPDISTANCETUNER_HPP
3 
12 
13 #include <Eigen/Core>
14 
15 #include <chrono>
16 #include <cmath>
17 #include <memory>
18 #include <stdexcept>
19 
20 #ifdef _OPENMP
21 #include <omp.h>
22 #endif
23 
24 namespace hops {
26  public:
27  struct param_type {
37  size_t randomSeed;
39  bool recordData;
40 
45  size_t stepSizeGridSize,
46  double stepSizeLowerBound,
47  double stepSizeUpperBound,
48  double smoothingLength,
49  size_t randomSeed,
50  bool considerTimeCost,
51  bool recordData = false
52  );
53  };
54 
63  static bool
64  tune(std::vector<std::shared_ptr<MarkovChain>>&,
65  std::vector<RandomNumberGenerator>&,
66  param_type&);
67 
76  static bool
77  tune(double&,
78  double&,
79  std::vector<std::shared_ptr<MarkovChain>>&,
80  std::vector<RandomNumberGenerator>&,
81  param_type&);
82 
91  static bool
92  tune(double&,
93  double&,
94  std::vector<std::shared_ptr<MarkovChain>>&,
95  std::vector<RandomNumberGenerator>&,
96  param_type&,
97  Eigen::MatrixXd& data,
98  Eigen::MatrixXd& posterior);
99 
101  };
102 
103  namespace internal {
104  struct ExpectedSquaredJumpDistanceTarget : public ThompsonSamplingTarget<double, Eigen::VectorXd> {
105  std::vector<std::shared_ptr<hops::MarkovChain>> markovChain;
106  std::vector<RandomNumberGenerator>* randomNumberGenerator;
108 
109  ExpectedSquaredJumpDistanceTarget(std::vector<std::shared_ptr<hops::MarkovChain>>& markovChain,
110  std::vector<hops::RandomNumberGenerator>& randomNumberGenerator,
115  //
116  }
117 
118  virtual std::tuple<double, double> operator()(const Eigen::VectorXd& x) override;
119  };
120  }
121 }
122 
123 #endif //HOPS_EXPECTEDSQUAREDJUMPDISTANCETUNER_HPP
hops::ExpectedSquaredJumpDistanceTuner::param_type::considerTimeCost
bool considerTimeCost
Definition: ExpectedSquaredJumpDistanceTuner.hpp:38
hops::ExpectedSquaredJumpDistanceTuner::param_type::stepSizeGridSize
size_t stepSizeGridSize
Definition: ExpectedSquaredJumpDistanceTuner.hpp:33
hops::ExpectedSquaredJumpDistanceTuner::ExpectedSquaredJumpDistanceTuner
ExpectedSquaredJumpDistanceTuner()=delete
hops::ExpectedSquaredJumpDistanceTuner::param_type::smoothingLength
double smoothingLength
Definition: ExpectedSquaredJumpDistanceTuner.hpp:36
hops::ExpectedSquaredJumpDistanceTuner::param_type::pureSamplingIterations
size_t pureSamplingIterations
Definition: ExpectedSquaredJumpDistanceTuner.hpp:30
hops::internal::ThompsonSamplingTarget
Definition: ThompsonSampling.hpp:17
hops::ExpectedSquaredJumpDistanceTuner::param_type::posteriorUpdateIterationsNeeded
size_t posteriorUpdateIterationsNeeded
Definition: ExpectedSquaredJumpDistanceTuner.hpp:32
hops::internal::ExpectedSquaredJumpDistanceTarget
Definition: ExpectedSquaredJumpDistanceTuner.hpp:104
hops::internal::ExpectedSquaredJumpDistanceTarget::markovChain
std::vector< std::shared_ptr< hops::MarkovChain > > markovChain
Definition: ExpectedSquaredJumpDistanceTuner.hpp:105
hops::ExpectedSquaredJumpDistanceTuner::param_type::stepSizeUpperBound
double stepSizeUpperBound
Definition: ExpectedSquaredJumpDistanceTuner.hpp:35
hops::internal::ExpectedSquaredJumpDistanceTarget::ExpectedSquaredJumpDistanceTarget
ExpectedSquaredJumpDistanceTarget(std::vector< std::shared_ptr< hops::MarkovChain >> &markovChain, std::vector< hops::RandomNumberGenerator > &randomNumberGenerator, const hops::ExpectedSquaredJumpDistanceTuner::param_type &parameters)
Definition: ExpectedSquaredJumpDistanceTuner.hpp:109
hops::internal::ExpectedSquaredJumpDistanceTarget::operator()
virtual std::tuple< double, double > operator()(const Eigen::VectorXd &x) override
measures the stepsize of a configured step size
Definition: ExpectedSquaredJumpDistanceTuner.cpp:9
hops::ExpectedSquaredJumpDistanceTuner::tune
static bool tune(std::vector< std::shared_ptr< MarkovChain >> &, std::vector< RandomNumberGenerator > &, param_type &)
tunes markov chain acceptance rate by nested intervals. The chain is not guaranteed to have converged...
hops::ExpectedSquaredJumpDistanceTuner::param_type::recordData
bool recordData
Definition: ExpectedSquaredJumpDistanceTuner.hpp:39
FileWriterType.hpp
hops::internal::ExpectedSquaredJumpDistanceTarget::parameters
ExpectedSquaredJumpDistanceTuner::param_type parameters
Definition: ExpectedSquaredJumpDistanceTuner.hpp:107
FileWriterFactory.hpp
hops::ExpectedSquaredJumpDistanceTuner::param_type::param_type
param_type(size_t iterationsToTestStepSize, size_t posteriorUpdateIterations, size_t pureSamplingIterations, size_t iterationsForConvergence, size_t stepSizeGridSize, double stepSizeLowerBound, double stepSizeUpperBound, double smoothingLength, size_t randomSeed, bool considerTimeCost, bool recordData=false)
Definition: ExpectedSquaredJumpDistanceTuner.cpp:135
ExpectedSquaredJumpDistance.hpp
hops::ExpectedSquaredJumpDistanceTuner::param_type::randomSeed
size_t randomSeed
Definition: ExpectedSquaredJumpDistanceTuner.hpp:37
GaussianProcess.hpp
hops::ExpectedSquaredJumpDistanceTuner::param_type::stepSizeLowerBound
double stepSizeLowerBound
Definition: ExpectedSquaredJumpDistanceTuner.hpp:34
hops::ExpectedSquaredJumpDistanceTuner::param_type
Definition: ExpectedSquaredJumpDistanceTuner.hpp:27
hops::ExpectedSquaredJumpDistanceTuner::param_type::iterationsToTestStepSize
size_t iterationsToTestStepSize
Definition: ExpectedSquaredJumpDistanceTuner.hpp:28
hops
Definition: CsvReader.hpp:8
MarkovChain.hpp
MarkovChainAttribute.hpp
hops::internal::ExpectedSquaredJumpDistanceTarget::randomNumberGenerator
std::vector< RandomNumberGenerator > * randomNumberGenerator
Definition: ExpectedSquaredJumpDistanceTuner.hpp:106
ThompsonSampling.hpp
FileWriter.hpp
hops::ExpectedSquaredJumpDistanceTuner::param_type::posteriorUpdateIterations
size_t posteriorUpdateIterations
Definition: ExpectedSquaredJumpDistanceTuner.hpp:29
hops::ExpectedSquaredJumpDistanceTuner
Definition: ExpectedSquaredJumpDistanceTuner.hpp:25
hops::ExpectedSquaredJumpDistanceTuner::param_type::iterationsForConvergence
size_t iterationsForConvergence
Definition: ExpectedSquaredJumpDistanceTuner.hpp:31