Drake
system_identification.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <set>
5 #include <stdexcept>
6 #include <vector>
7 
9 #include "drake/drakeOptimization_export.h"
10 
11 namespace drake {
12 namespace solvers {
13 
15 
36 template <typename CoefficientType>
37 class DRAKEOPTIMIZATION_EXPORT SystemIdentification {
38  public:
39  typedef ::Polynomial<CoefficientType> PolyType;
40  typedef typename PolyType::Monomial MonomialType;
41  typedef typename PolyType::Term TermType;
42  typedef typename PolyType::VarType VarType;
43  typedef std::map<PolyType, VarType> LumpingMapType;
44 
46 
63  static LumpingMapType GetLumpedParametersFromPolynomial(
64  const PolyType& poly,
65  const std::set<VarType>& parameter_vars);
66 
68 
73  static LumpingMapType GetLumpedParametersFromPolynomials(
74  const std::vector<PolyType>& polys,
75  const std::set<VarType>& parameter_vars);
76 
78 
86  static PolyType RewritePolynomialWithLumpedParameters(
87  const PolyType& poly,
88  const LumpingMapType& lumped_parameters);
89 
91 
104  typedef std::map<VarType, CoefficientType> PartialEvalType;
105  static std::pair<PartialEvalType, CoefficientType> EstimateParameters(
106  const VectorXPoly& polys,
107  const std::vector<PartialEvalType>& active_var_values);
108 
109  private:
112 
114 
124  static std::set<MonomialType>
125  GetAllCombinationsOfVars(
126  const std::vector<PolyType>& polys,
127  const std::set<VarType>& vars);
128 
130 
138  static bool MonomialMatches(
139  const MonomialType& haystack,
140  const MonomialType& needle,
141  const std::set<VarType>& active_vars);
142 
144 
154  static std::pair<CoefficientType, PolyType>
155  CanonicalizePolynomial(const PolyType& poly);
156 
159  static VarType CreateUnusedVar(const std::string& prefix,
160  const std::set<VarType>& vars_in_use);
161 };
162 } // namespace solvers
163 } // namespace drake
Eigen::Matrix< Polynomiald, Eigen::Dynamic, 1 > VectorXPoly
A column vector of polynomials; used in several optimization classes.
Definition: Polynomial.h:500
Definition: constants.h:3
std::map< VarType, CoefficientType > PartialEvalType
Estimate some parameters of a polynomial based on empirical data.
Definition: system_identification.h:104
Utility functions for system identification.
Definition: system_identification.h:37
PolyType::Term TermType
Definition: system_identification.h:41
::Polynomial< CoefficientType > PolyType
Definition: system_identification.h:39
unsigned int VarType
Definition: Polynomial.h:45
std::map< PolyType, VarType > LumpingMapType
Definition: system_identification.h:43
PolyType::Monomial MonomialType
Definition: system_identification.h:40
PolyType::VarType VarType
Definition: system_identification.h:42