DMP_BBO library
MetaParametersGPR.cpp
Go to the documentation of this file.
1 
24 #include <boost/serialization/export.hpp>
25 #include <boost/archive/text_iarchive.hpp>
26 #include <boost/archive/text_oarchive.hpp>
27 #include <boost/archive/xml_iarchive.hpp>
28 #include <boost/archive/xml_oarchive.hpp>
30 
33 
34 
37 
38 #include <iostream>
39 #include <unordered_map>
40 
41 #include <boost/serialization/base_object.hpp>
42 #include <boost/serialization/nvp.hpp>
43 #include <boost/serialization/vector.hpp>
44 
45 
46 
47 using namespace Eigen;
48 using namespace std;
49 
50 namespace DmpBbo {
51 
52 MetaParametersGPR::MetaParametersGPR(int expected_input_dim, double maximum_covariance, double length)
53 :
54  MetaParameters(expected_input_dim),
55  maximum_covariance_(maximum_covariance),
56  sigmas_(VectorXd::Constant(expected_input_dim,length))
57 {
58  assert(maximum_covariance_>0);
59  assert(length>0);
60 }
61 
62 MetaParametersGPR::MetaParametersGPR(int expected_input_dim, double maximum_covariance, const Eigen::VectorXd& sigmas)
63 :
64  MetaParameters(expected_input_dim),
65  maximum_covariance_(maximum_covariance),
66  sigmas_(sigmas)
67 {
68  assert(maximum_covariance_>0);
69  assert(sigmas.size()==expected_input_dim);
70 }
71 
73 {
74  return new MetaParametersGPR(getExpectedInputDim(),maximum_covariance_,sigmas_);
75 }
76 
77 template<class Archive>
78 void MetaParametersGPR::serialize(Archive & ar, const unsigned int version)
79 {
80  // serialize base class information
81  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(MetaParameters);
82 
83  ar & BOOST_SERIALIZATION_NVP(maximum_covariance_);
84  ar & BOOST_SERIALIZATION_NVP(sigmas_);
85 }
86 
87 string MetaParametersGPR::toString(void) const
88 {
89  RETURN_STRING_FROM_BOOST_SERIALIZATION_XML("MetaParametersGPR");
90 }
91 
92 }
int getExpectedInputDim(void) const
The expected dimensionality of the input data.
Meta-parameters for the Gaussian Process Regression (GPR) function approximator.
std::string toString(void) const
Returns a string representation of the object.
#define RETURN_STRING_FROM_BOOST_SERIALIZATION_XML(name)
Macro to convert the boost XML serialization of an object into a string.
double maximum_covariance() const
Return the maximum covariance of the covariance function.
const Eigen::VectorXd & sigmas() const
Return the sqrt of the diagonal of the covariance matrix in the Gaussian covariance function...
BOOST_CLASS_EXPORT_IMPLEMENT(DmpBbo::MetaParametersGPR)
For boost::serialization.
Base class for all meta-parameters of function approximators.
MetaParametersGPR class header file.
Header file to generate strings from boost serialized files.
MetaParametersGPR * clone(void) const
Return a pointer to a deep copy of the MetaParameters object.
Header file for serialization of Eigen matrices.