12 #include <blasfeo_target.h> 13 #include <blasfeo_common.h> 14 #include <blasfeo_d_aux.h> 15 #include <blasfeo_d_aux_ext_dep.h> 18 #include <hpipm_d_ocp_qp.h> 19 #include <hpipm_d_ocp_qp_sol.h> 20 #include <hpipm_d_ocp_qp_ipm.h> 21 #include <hpipm_d_ocp_qp_dim.h> 22 #include <hpipm_timing.h> 25 #include <unsupported/Eigen/MatrixFunctions> 40 template <
int STATE_DIM,
int CONTROL_DIM>
41 class HPIPMInterface :
public LQOCSolver<STATE_DIM, CONTROL_DIM>
44 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
48 static const int max_box_constr_dim = STATE_DIM + CONTROL_DIM;
61 using constr_vec_t = Eigen::Matrix<double, -1, 1>;
65 using box_constr_sparsity_t = Eigen::Matrix<int, max_box_constr_dim, 1>;
71 virtual ~HPIPMInterface();
73 virtual void configure(
const NLOptConSettings& settings)
override;
75 void solve()
override;
77 virtual void computeStatesAndControls()
override;
78 virtual void computeFeedbackMatrices()
override;
79 virtual void compute_lv()
override;
84 virtual bool configureInputBoxConstraints(
85 std::shared_ptr<LQOCProblem<STATE_DIM, CONTROL_DIM>> lqocProblem)
override;
86 virtual bool configureStateBoxConstraints(
87 std::shared_ptr<LQOCProblem<STATE_DIM, CONTROL_DIM>> lqocProblem)
override;
90 virtual bool configureGeneralConstraints(std::shared_ptr<LQOCProblem<STATE_DIM, CONTROL_DIM>> lqocProblem)
override;
104 virtual void initializeAndAllocate()
override;
110 void setSolverDimensions(
const int N,
const int nbu = 0,
const int nbx = 0,
const int ng = 0);
119 void setProblemImpl(std::shared_ptr<LQOCProblem<STATE_DIM, CONTROL_DIM>> lqocProblem)
override;
153 bool changeProblemSize(std::shared_ptr<LQOCProblem<STATE_DIM, CONTROL_DIM>> lqocProblem);
159 void computeLrInvArray();
160 bool isLrInvComputed_;
163 void d_print_mat(
int m,
int n,
double* A,
int lda);
166 void d_print_e_tran_mat(
int row,
int col,
double* A,
int lda);
171 std::vector<int> nx_;
172 std::vector<int> nu_;
174 std::vector<int> nbu_;
175 std::vector<int> nbx_;
177 std::vector<int> ng_;
179 std::vector<int> nsbx_;
180 std::vector<int> nsbu_;
181 std::vector<int> nsg_;
183 std::vector<double*> hA_;
184 std::vector<double*> hB_;
185 std::vector<double*> hb_;
186 Eigen::Matrix<double, state_dim, 1> hb0_;
188 std::vector<double*> hQ_;
189 std::vector<double*> hS_;
190 std::vector<double*> hR_;
191 std::vector<double*> hq_;
192 std::vector<double*> hr_;
193 Eigen::Matrix<double, control_dim, 1> hr0_;
195 std::vector<double*> hlbx_;
196 std::vector<double*> hubx_;
197 std::vector<double*> hlbu_;
198 std::vector<double*> hubu_;
200 std::vector<int*> hidxbx_;
201 std::vector<int*> hidxbu_;
203 std::vector<double*> hlg_;
204 std::vector<double*> hug_;
205 std::vector<double*> hC_;
206 std::vector<double*> hD_;
209 Eigen::VectorXd hd_lg_0_Eigen_;
210 Eigen::VectorXd hd_ug_0_Eigen_;
212 std::vector<double*> hZl_;
213 std::vector<double*> hZu_;
214 std::vector<double*> hzl_;
215 std::vector<double*> hzu_;
216 std::vector<int*> hidxs_;
217 std::vector<double*> hlls_;
218 std::vector<double*> hlus_;
225 NLOptConSettings settings_;
230 struct d_ocp_qp_dim dim_;
236 struct d_ocp_qp_sol qp_sol_;
239 struct d_ocp_qp_ipm_arg arg_;
243 struct d_ocp_qp_ipm_ws workspace_;
247 ::hpipm_mode mode_ = ::hpipm_mode::SPEED;
void printSolution(const ct::core::StateVectorArray< state_dim > &x, const ct::core::ControlVectorArray< control_dim > &u, const ct::core::FeedbackArray< state_dim, control_dim > &K)
Definition: ConstrainedLQOCSolverTest.h:16
DiscreteArray< StateMatrix< STATE_DIM, SCALAR > > StateMatrixArray
const size_t state_dim
Definition: ConstraintExampleOutput.cpp:17
DiscreteArray< ControlMatrix< CONTROL_DIM, SCALAR > > ControlMatrixArray
DiscreteArray< StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALAR > > StateControlMatrixArray
const size_t control_dim
Definition: ConstraintExampleOutput.cpp:18