1#ifndef CGMRES__ZERO_HORIZON_NLP_HPP_
2#define CGMRES__ZERO_HORIZON_NLP_HPP_
17 static constexpr int nx = OCP::nx;
18 static constexpr int nu = OCP::nu;
19 static constexpr int nc = OCP::nc;
21 static constexpr int nub = OCP::nub;
27 static_assert(OCP::nx > 0);
28 static_assert(OCP::nu > 0);
29 static_assert(OCP::nc >= 0);
30 static_assert(OCP::nub >= 0);
37 template <
typename VectorType>
41 ocp_.eval_phix(t, x.derived().data(), lmd_.data());
43 ocp_.eval_hu(t, x.derived().data(), solution.data(), lmd_.data(), fonc_hu.data());
44 if constexpr (
nub > 0) {
45 const auto uc = solution.template head<nuc>();
46 const auto dummy = solution.template segment<nub>(
nuc);
47 const auto mu = solution.template segment<nub>(
nuc+
nub);
48 auto fonc_huc = fonc_hu.template head<nuc>();
49 auto fonc_hdummy = fonc_hu.template segment<nub>(
nuc);
50 auto fonc_hmu = fonc_hu.template segment<nub>(
nuc+
nub);
58 if constexpr (
nub > 0) {
59 const auto uc = solution.template head<nuc>();
60 auto dummy = solution.template segment<nub>(
nuc);
61 const auto mu = solution.template segment<nub>(
nuc+
nub);
62 auto fonc_hmu = fonc_hu.template segment<nub>(
nuc+
nub);
66 dummy.array() = fonc_hmu.array().abs().sqrt();
71 if constexpr (
nub > 0) {
72 const auto uc = solution.template head<nuc>();
73 const auto dummy = solution.template segment<nub>(
nuc);
74 auto mu = solution.template segment<nub>(
nuc+
nub);
75 auto fonc_hdummy = fonc_hu.template segment<nub>(
nuc);
78 mu.array() = fonc_hdummy.array() / (2.0 * dummy.array());
84 const OCP&
ocp()
const {
return ocp_; }
88 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition: zero_horizon_nlp.hpp:15
void retrive_dummy(Vector< dim > &solution, Vector< dim > &fonc_hu, const Scalar min_dummy)
Definition: zero_horizon_nlp.hpp:57
const Vector< nx > & lmd() const
Definition: zero_horizon_nlp.hpp:86
static constexpr int dim
Definition: zero_horizon_nlp.hpp:22
void retrive_mu(Vector< dim > &solution, Vector< dim > &fonc_hu)
Definition: zero_horizon_nlp.hpp:70
static constexpr int nx
Definition: zero_horizon_nlp.hpp:17
void synchronize_ocp()
Definition: zero_horizon_nlp.hpp:82
void eval_fonc_hu(const Scalar t, const MatrixBase< VectorType > &x, const Vector< dim > &solution, Vector< dim > &fonc_hu)
Definition: zero_horizon_nlp.hpp:38
static constexpr int nuc
Definition: zero_horizon_nlp.hpp:20
static constexpr int nu
Definition: zero_horizon_nlp.hpp:18
static constexpr int nc
Definition: zero_horizon_nlp.hpp:19
~ZeroHorizonNLP()=default
const OCP & ocp() const
Definition: zero_horizon_nlp.hpp:84
ZeroHorizonNLP(const OCP &ocp)
Definition: zero_horizon_nlp.hpp:24
static constexpr int nub
Definition: zero_horizon_nlp.hpp:21
void clip_dummy(const MatrixBase< VectorType > &dummy, const Scalar min)
Definition: control_input_bounds.hpp:127
void eval_hmu(const OCP &ocp, const MatrixBase< VectorType1 > &u, const MatrixBase< VectorType2 > &dummy, const MatrixBase< VectorType3 > &mu, const MatrixBase< VectorType4 > &hmu)
Definition: control_input_bounds.hpp:47
void eval_hdummy(const OCP &ocp, const MatrixBase< VectorType1 > &u, const MatrixBase< VectorType2 > &dummy, const MatrixBase< VectorType3 > &mu, const MatrixBase< VectorType4 > &hdummy)
Definition: control_input_bounds.hpp:32
void eval_hu(const OCP &ocp, const MatrixBase< VectorType1 > &u, const MatrixBase< VectorType2 > &dummy, const MatrixBase< VectorType3 > &mu, const MatrixBase< VectorType4 > &hu)
Definition: control_input_bounds.hpp:15
Definition: continuation_gmres.hpp:11
Eigen::Matrix< Scalar, size, 1 > Vector
Alias of Eigen::Vector.
Definition: types.hpp:23
double Scalar
Alias of double.
Definition: types.hpp:11
Eigen::MatrixBase< MatrixType > MatrixBase
Alias of Eigen::MatrixBase.
Definition: types.hpp:29