Exotica
unconstrained_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_UNCONSTRAINED_TIME_INDEXED_PROBLEM_H_
31 #define EXOTICA_CORE_UNCONSTRAINED_TIME_INDEXED_PROBLEM_H_
32 
34 #include <exotica_core/tasks.h>
35 
37 #include <exotica_core/unconstrained_time_indexed_problem_initializer.h>
38 
39 namespace exotica
40 {
42 class UnconstrainedTimeIndexedProblem : public AbstractTimeIndexedProblem, public Instantiable<UnconstrainedTimeIndexedProblemInitializer>
43 {
44 public:
46 
48  virtual ~UnconstrainedTimeIndexedProblem() = default;
49 
51  void Instantiate(const UnconstrainedTimeIndexedProblemInitializer& init) override;
52 
54  void PreUpdate() override;
55 
59  void Update(Eigen::VectorXdRefConst x_in, int t) override;
60 
61  // As this is an unconstrained problem, it is always valid.
62  bool IsValid() override;
63 
64  // Delete bound constraints
65  Eigen::MatrixXd GetBounds() const = delete;
66 
67  // Delete general constraints
68  void SetGoalEQ(const std::string& task_name, Eigen::VectorXdRefConst goal, int t = 0) = delete;
69  Eigen::VectorXd GetGoalEQ(const std::string& task_name, int t = 0) = delete;
70  void SetRhoEQ(const std::string& task_name, const double rho, int t = 0) = delete;
71  double GetRhoEQ(const std::string& task_name, int t = 0) = delete;
72  void SetGoalNEQ(const std::string& task_name, Eigen::VectorXdRefConst goal, int t = 0) = delete;
73  Eigen::VectorXd GetGoalNEQ(const std::string& task_name, int t = 0) = delete;
74  void SetRhoNEQ(const std::string& task_name, const double rho, int t = 0) = delete;
75  double GetRhoNEQ(const std::string& task_name, int t = 0) = delete;
76  Eigen::VectorXd GetEquality() const = delete;
77  Eigen::VectorXd GetInequality() const = delete;
78  Eigen::SparseMatrix<double> GetEqualityJacobian() const = delete;
79  Eigen::SparseMatrix<double> GetInequalityJacobian() const = delete;
80  std::vector<Eigen::Triplet<double>> GetEqualityJacobianTriplets() const = delete;
82  Eigen::VectorXd GetEquality(int t) const = delete;
83  Eigen::MatrixXd GetEqualityJacobian(int t) const = delete;
84  Eigen::VectorXd GetInequality(int t) const = delete;
85  Eigen::MatrixXd GetInequalityJacobian(int t) const = delete;
86  std::vector<Eigen::Triplet<double>> GetInequalityJacobianTriplets() const = delete;
88  int get_joint_velocity_constraint_dimension() const = delete;
89  Eigen::VectorXd GetJointVelocityConstraint() const = delete;
90  Eigen::MatrixXd GetJointVelocityConstraintBounds() const = delete;
91  std::vector<Eigen::Triplet<double>> GetJointVelocityConstraintJacobianTriplets() const = delete;
92  Eigen::VectorXd GetJointVelocityLimits() const = delete;
93  void SetJointVelocityLimits(const Eigen::VectorXd& qdot_max_in) = delete;
94 
95 private:
96  void ReinitializeVariables() override;
97 };
98 typedef std::shared_ptr<exotica::UnconstrainedTimeIndexedProblem> UnconstrainedTimeIndexedProblemPtr;
99 } // namespace exotica
100 
101 #endif // EXOTICA_CORE_UNCONSTRAINED_TIME_INDEXED_PROBLEM_H_
exotica::UnconstrainedTimeIndexedProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double rho, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::GetJointVelocityConstraintBounds
Eigen::MatrixXd GetJointVelocityConstraintBounds() const =delete
exotica::UnconstrainedTimeIndexedProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name, int t=0)=delete
planning_problem.h
exotica::UnconstrainedTimeIndexedProblem::Update
void Update(Eigen::VectorXdRefConst x_in, int t) override
Updates an individual timestep from a given state vector.
exotica::UnconstrainedTimeIndexedProblem::GetJointVelocityLimits
Eigen::VectorXd GetJointVelocityLimits() const =delete
exotica::UnconstrainedTimeIndexedProblem::UnconstrainedTimeIndexedProblem
UnconstrainedTimeIndexedProblem()=default
exotica::UnconstrainedTimeIndexedProblem::ReinitializeVariables
void ReinitializeVariables() override
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::UnconstrainedTimeIndexedProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::get_active_nonlinear_equality_constraints_dimension
int get_active_nonlinear_equality_constraints_dimension() const =delete
exotica::UnconstrainedTimeIndexedProblem::PreUpdate
void PreUpdate() override
Updates internal variables before solving, e.g., after setting new values for Rho.
exotica::UnconstrainedTimeIndexedProblem::GetJointVelocityConstraint
Eigen::VectorXd GetJointVelocityConstraint() const =delete
exotica::UnconstrainedTimeIndexedProblem::GetEquality
Eigen::VectorXd GetEquality() const =delete
exotica::Instantiable
Definition: property.h:110
exotica
Definition: cartpole_dynamics_solver.h:38
exotica::UnconstrainedTimeIndexedProblem::~UnconstrainedTimeIndexedProblem
virtual ~UnconstrainedTimeIndexedProblem()=default
exotica::UnconstrainedTimeIndexedProblem::SetJointVelocityLimits
void SetJointVelocityLimits(const Eigen::VectorXd &qdot_max_in)=delete
exotica::UnconstrainedTimeIndexedProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::IsValid
bool IsValid() override
Evaluates whether the problem is valid.
exotica::UnconstrainedTimeIndexedProblem::GetEqualityJacobianTriplets
std::vector< Eigen::Triplet< double > > GetEqualityJacobianTriplets() const =delete
exotica::AbstractTimeIndexedProblem
Definition: abstract_time_indexed_problem.h:40
exotica::UnconstrainedTimeIndexedProblem::GetJointVelocityConstraintJacobianTriplets
std::vector< Eigen::Triplet< double > > GetJointVelocityConstraintJacobianTriplets() const =delete
exotica::UnconstrainedTimeIndexedProblem::get_joint_velocity_constraint_dimension
int get_joint_velocity_constraint_dimension() const =delete
Eigen::VectorXdRefConst
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
Definition: conversions.h:52
exotica::UnconstrainedTimeIndexedProblem::get_active_nonlinear_inequality_constraints_dimension
int get_active_nonlinear_inequality_constraints_dimension() const =delete
tasks.h
exotica::UnconstrainedTimeIndexedProblem::GetInequality
Eigen::VectorXd GetInequality() const =delete
exotica::UnconstrainedTimeIndexedProblemPtr
std::shared_ptr< exotica::UnconstrainedTimeIndexedProblem > UnconstrainedTimeIndexedProblemPtr
Definition: unconstrained_time_indexed_problem.h:98
abstract_time_indexed_problem.h
exotica::UnconstrainedTimeIndexedProblem::Instantiate
void Instantiate(const UnconstrainedTimeIndexedProblemInitializer &init) override
Instantiates the problem from an Initializer.
exotica::UnconstrainedTimeIndexedProblem
Unconstrained time-indexed problem.
Definition: unconstrained_time_indexed_problem.h:42
exotica::UnconstrainedTimeIndexedProblem::GetInequalityJacobian
Eigen::SparseMatrix< double > GetInequalityJacobian() const =delete
exotica::UnconstrainedTimeIndexedProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::GetInequalityJacobianTriplets
std::vector< Eigen::Triplet< double > > GetInequalityJacobianTriplets() const =delete
exotica::UnconstrainedTimeIndexedProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double rho, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name, int t=0)=delete
exotica::UnconstrainedTimeIndexedProblem::GetBounds
Eigen::MatrixXd GetBounds() const =delete
exotica::UnconstrainedTimeIndexedProblem::GetEqualityJacobian
Eigen::SparseMatrix< double > GetEqualityJacobian() const =delete
exotica::UnconstrainedTimeIndexedProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name, int t=0)=delete