libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
policy.hpp
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
37 #ifndef POLICY_H_
38 #define POLICY_H_
39 
40 #include <vector>
41 
42 #include <Eigen/Core>
43 
44 namespace stomp_motion_planner
45 {
46 
47 class Policy
48 {
49 public:
50 
51  Policy(){};
52  virtual ~Policy(){};
53 
59  virtual bool setNumTimeSteps(const int num_time_steps) = 0;
60 
66  virtual bool getNumTimeSteps(int& num_time_steps) = 0;
67 
73  virtual bool getNumDimensions(int& num_dimensions) = 0;
74 
81  virtual bool getNumParameters(std::vector<int>& num_params) = 0;
82 
88  virtual bool getBasisFunctions(std::vector<Eigen::MatrixXd>& basis_functions) = 0;
89 
97  virtual bool getControlCosts(std::vector<Eigen::MatrixXd>& control_costs) = 0;
98 
104  virtual bool updateParameters(const std::vector<Eigen::MatrixXd>& updates) = 0;
105 
111  virtual bool getParameters(std::vector<Eigen::VectorXd>& parameters) = 0;
112 
118  virtual bool setParameters(const std::vector<Eigen::VectorXd>& parameters) = 0;
119 
128  virtual bool computeControlCosts(const std::vector<Eigen::MatrixXd>& control_cost_matrices, const std::vector<std::vector<Eigen::VectorXd> >& parameters,
129  const double weight, std::vector<Eigen::VectorXd>& control_costs) = 0;
130 
131  virtual bool computeControlCosts(const std::vector<Eigen::MatrixXd>& control_cost_matrices, const std::vector<Eigen::VectorXd>& parameters,
132  const std::vector<Eigen::VectorXd>& noise, const double weight, std::vector<Eigen::VectorXd>& control_costs) = 0;
133 
134 };
135 
136 }
137 
138 #endif /* POLICY_H_ */
Definition: policy.hpp:47
virtual bool getBasisFunctions(std::vector< Eigen::MatrixXd > &basis_functions)=0
Gets the basis functions that multiply the policy parameters in the dynamical system.
virtual bool getControlCosts(std::vector< Eigen::MatrixXd > &control_costs)=0
Gets the positive semi-definite matrix of the quadratic control cost The weight of this control cost ...
virtual bool setParameters(const std::vector< Eigen::VectorXd > &parameters)=0
Set the policy parameters per dimension.
virtual bool getParameters(std::vector< Eigen::VectorXd > &parameters)=0
Get the policy parameters per dimension.
virtual bool computeControlCosts(const std::vector< Eigen::MatrixXd > &control_cost_matrices, const std::vector< std::vector< Eigen::VectorXd > > &parameters, const double weight, std::vector< Eigen::VectorXd > &control_costs)=0
Compute the control costs over time, given the control cost matrix per dimension and parameters over ...
virtual bool getNumTimeSteps(int &num_time_steps)=0
Gets the number of time steps used in reinforcement learning.
virtual bool setNumTimeSteps(const int num_time_steps)=0
Sets the number of time steps used in reinforcement learning.
virtual bool getNumParameters(std::vector< int > &num_params)=0
Gets the number of policy parameters per dimension.
virtual bool getNumDimensions(int &num_dimensions)=0
Gets the number of dimensions.
virtual bool updateParameters(const std::vector< Eigen::MatrixXd > &updates)=0
Update the policy parameters based on the updates per timestep.