Exotica
bounded_time_indexed_problem.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019, University of Edinburgh
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #ifndef EXOTICA_CORE_BOUNDED_TIME_INDEXED_PROBLEM_H_
31 #define EXOTICA_CORE_BOUNDED_TIME_INDEXED_PROBLEM_H_
32 
33 #include <exotica_core/bounded_time_indexed_problem_initializer.h>
35 
36 namespace exotica
37 {
39 class BoundedTimeIndexedProblem : public AbstractTimeIndexedProblem, public Instantiable<BoundedTimeIndexedProblemInitializer>
40 {
41 public:
43 
44  BoundedTimeIndexedProblem() = default;
45  virtual ~BoundedTimeIndexedProblem() = default;
46 
48  void Instantiate(const BoundedTimeIndexedProblemInitializer& init) override;
49 
51  void PreUpdate() override;
52 
56  void Update(Eigen::VectorXdRefConst x, int t) override;
57 
58  // Checks bound constraints
59  bool IsValid() override;
60 
61  // Delete general constraints
62  void SetGoalEQ(const std::string& task_name, Eigen::VectorXdRefConst goal, int t = 0) = delete;
63  Eigen::VectorXd GetGoalEQ(const std::string& task_name, int t = 0) = delete;
64  void SetRhoEQ(const std::string& task_name, const double rho, int t = 0) = delete;
65  double GetRhoEQ(const std::string& task_name, int t = 0) = delete;
66  void SetGoalNEQ(const std::string& task_name, Eigen::VectorXdRefConst goal, int t = 0) = delete;
67  Eigen::VectorXd GetGoalNEQ(const std::string& task_name, int t = 0) = delete;
68  void SetRhoNEQ(const std::string& task_name, const double rho, int t = 0) = delete;
69  double GetRhoNEQ(const std::string& task_name, int t = 0) = delete;
70  Eigen::VectorXd GetEquality() const = delete;
71  Eigen::VectorXd GetInequality() const = delete;
72  Eigen::SparseMatrix<double> GetEqualityJacobian() const = delete;
73  Eigen::SparseMatrix<double> GetInequalityJacobian() const = delete;
74  std::vector<Eigen::Triplet<double>> GetEqualityJacobianTriplets() const = delete;
76  Eigen::VectorXd GetEquality(int t) const = delete;
77  Eigen::MatrixXd GetEqualityJacobian(int t) const = delete;
78  Eigen::VectorXd GetInequality(int t) const = delete;
79  Eigen::MatrixXd GetInequalityJacobian(int t) const = delete;
80  std::vector<Eigen::Triplet<double>> GetInequalityJacobianTriplets() const = delete;
82  int get_joint_velocity_constraint_dimension() const = delete;
83  Eigen::VectorXd GetJointVelocityConstraint() const = delete;
84  Eigen::MatrixXd GetJointVelocityConstraintBounds() const = delete;
85  std::vector<Eigen::Triplet<double>> GetJointVelocityConstraintJacobianTriplets() const = delete;
86  Eigen::VectorXd GetJointVelocityLimits() const = delete;
87  void SetJointVelocityLimits(const Eigen::VectorXd& qdot_max_in) = delete;
88 
89 private:
90  void ReinitializeVariables() override;
91 };
92 typedef std::shared_ptr<exotica::BoundedTimeIndexedProblem> BoundedTimeIndexedProblemPtr;
93 } // namespace exotica
94 
95 #endif // EXOTICA_CORE_BOUNDED_TIME_INDEXED_PROBLEM_H_
exotica::BoundedTimeIndexedProblem::SetJointVelocityLimits
void SetJointVelocityLimits(const Eigen::VectorXd &qdot_max_in)=delete
exotica::BoundedTimeIndexedProblem::GetJointVelocityConstraintBounds
Eigen::MatrixXd GetJointVelocityConstraintBounds() const =delete
exotica::BoundedTimeIndexedProblem::GetEquality
Eigen::VectorXd GetEquality() const =delete
exotica::AbstractTimeIndexedProblem::x
std::vector< Eigen::VectorXd > x
Current internal problem state.
Definition: abstract_time_indexed_problem.h:260
exotica::BoundedTimeIndexedProblem::GetInequalityJacobianTriplets
std::vector< Eigen::Triplet< double > > GetInequalityJacobianTriplets() const =delete
exotica::BoundedTimeIndexedProblem
Bound constrained time-indexed problem.
Definition: bounded_time_indexed_problem.h:39
exotica::BoundedTimeIndexedProblem::GetJointVelocityConstraint
Eigen::VectorXd GetJointVelocityConstraint() const =delete
exotica::BoundedTimeIndexedProblem::IsValid
bool IsValid() override
Evaluates whether the problem is valid.
exotica::AbstractTimeIndexedProblem::Update
void Update(Eigen::VectorXdRefConst x_trajectory_in)
Updates the entire problem from a given trajectory (e.g., used in an optimization solver)
exotica::BoundedTimeIndexedProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name, int t=0)=delete
exotica::Instantiable
Definition: property.h:110
exotica::BoundedTimeIndexedProblem::get_joint_velocity_constraint_dimension
int get_joint_velocity_constraint_dimension() const =delete
exotica
Definition: cartpole_dynamics_solver.h:38
exotica::BoundedTimeIndexedProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name, int t=0)=delete
exotica::BoundedTimeIndexedProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double rho, int t=0)=delete
exotica::BoundedTimeIndexedProblem::GetInequality
Eigen::VectorXd GetInequality() const =delete
exotica::BoundedTimeIndexedProblem::GetJointVelocityLimits
Eigen::VectorXd GetJointVelocityLimits() const =delete
exotica::BoundedTimeIndexedProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name, int t=0)=delete
exotica::BoundedTimeIndexedProblem::ReinitializeVariables
void ReinitializeVariables() override
exotica::AbstractTimeIndexedProblem
Definition: abstract_time_indexed_problem.h:40
exotica::BoundedTimeIndexedProblemPtr
std::shared_ptr< exotica::BoundedTimeIndexedProblem > BoundedTimeIndexedProblemPtr
Definition: bounded_time_indexed_problem.h:92
exotica::BoundedTimeIndexedProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double rho, int t=0)=delete
exotica::BoundedTimeIndexedProblem::BoundedTimeIndexedProblem
BoundedTimeIndexedProblem()=default
Eigen::VectorXdRefConst
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
Definition: conversions.h:52
exotica::BoundedTimeIndexedProblem::get_active_nonlinear_equality_constraints_dimension
int get_active_nonlinear_equality_constraints_dimension() const =delete
exotica::BoundedTimeIndexedProblem::Instantiate
void Instantiate(const BoundedTimeIndexedProblemInitializer &init) override
Instantiates the problem from an Initializer.
exotica::BoundedTimeIndexedProblem::PreUpdate
void PreUpdate() override
Updates internal variables before solving, e.g., after setting new values for Rho.
exotica::BoundedTimeIndexedProblem::GetInequalityJacobian
Eigen::SparseMatrix< double > GetInequalityJacobian() const =delete
exotica::BoundedTimeIndexedProblem::GetJointVelocityConstraintJacobianTriplets
std::vector< Eigen::Triplet< double > > GetJointVelocityConstraintJacobianTriplets() const =delete
exotica::BoundedTimeIndexedProblem::~BoundedTimeIndexedProblem
virtual ~BoundedTimeIndexedProblem()=default
exotica::BoundedTimeIndexedProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)=delete
exotica::BoundedTimeIndexedProblem::Update
void Update(Eigen::VectorXdRefConst x, int t) override
Updates an individual timestep from a given state vector.
abstract_time_indexed_problem.h
exotica::BoundedTimeIndexedProblem::GetEqualityJacobianTriplets
std::vector< Eigen::Triplet< double > > GetEqualityJacobianTriplets() const =delete
exotica::BoundedTimeIndexedProblem::GetEqualityJacobian
Eigen::SparseMatrix< double > GetEqualityJacobian() const =delete
exotica::BoundedTimeIndexedProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name, int t=0)=delete
exotica::BoundedTimeIndexedProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)=delete
exotica::BoundedTimeIndexedProblem::get_active_nonlinear_inequality_constraints_dimension
int get_active_nonlinear_inequality_constraints_dimension() const =delete