1#ifndef CGMRES__CONTROL_INPUT_BOUNDS_HPP_
2#define CGMRES__CONTROL_INPUT_BOUNDS_HPP_
14template <
typename OCP,
typename VectorType1,
typename VectorType2,
typename VectorType3,
typename VectorType4>
19 constexpr int nub = OCP::nub;
20 if constexpr (nub > 0) {
21 assert(dummy.size() == nub);
22 assert(mu.size() == nub);
23 for (
int i=0; i<nub; ++i) {
24 const auto ui = OCP::ubound_indices[i];
26 += mu.coeff(i) * (2.0*u.coeff(ui) - ocp.umin[i] - ocp.umax[i]);
31template <
typename OCP,
typename VectorType1,
typename VectorType2,
typename VectorType3,
typename VectorType4>
36 constexpr int nub = OCP::nub;
37 if constexpr (nub > 0) {
38 assert(dummy.size() == nub);
39 assert(mu.size() == nub);
40 assert(hdummy.size() == nub);
46template <
typename OCP,
typename VectorType1,
typename VectorType2,
typename VectorType3,
typename VectorType4>
51 constexpr int nub = OCP::nub;
52 if constexpr (nub > 0) {
53 assert(dummy.size() == nub);
54 assert(mu.size() == nub);
55 assert(hmu.size() == nub);
56 for (
int i=0; i<nub; ++i) {
57 const auto ui = OCP::ubound_indices[i];
59 = u.coeff(ui) * (u.coeff(ui) - ocp.umin[i] - ocp.umax[i])
60 + ocp.umin[i] * ocp.umax[i] + dummy.coeff(i) * dummy.coeff(i);
65template <
typename VectorType1,
typename VectorType2,
typename VectorType3,
66 typename VectorType4,
typename VectorType5>
75template <
typename VectorType1,
typename VectorType2,
typename VectorType3,
76 typename VectorType4,
typename VectorType5,
typename VectorType6>
84 - mu.array() * hdummy_multiplied.array() / dummy.array();
87template <
typename OCP,
typename VectorType1,
typename VectorType2,
typename VectorType3,
typename VectorType4,
typename VectorType5>
94 constexpr int nub = OCP::nub;
95 if constexpr (nub > 0) {
96 assert(dummy.size() == nub);
97 assert(dummy_update.size() == nub);
98 for (
int i=0; i<nub; ++i) {
99 const auto ui = OCP::ubound_indices[i];
101 = (2.0*u.coeff(ui) - ocp.umin[i] - ocp.umax[i]) * u_update.coeff(ui) / (2.0 * dummy.coeff(i));
106template <
typename OCP,
typename VectorType1,
typename VectorType2,
typename VectorType3,
typename VectorType4,
typename VectorType5>
113 constexpr int nub = OCP::nub;
114 if constexpr (nub > 0) {
115 assert(dummy.size() == nub);
116 assert(mu_udpate.size() == nub);
117 for (
int i=0; i<nub; ++i) {
118 const auto ui = OCP::ubound_indices[i];
120 = - mu.coeff(i) * (2.0*u.coeff(ui) - ocp.umin[i] - ocp.umax[i]) * u_update.coeff(ui)
121 / (2.0 * dummy.coeff(i) * dummy.coeff(i));
126template <
typename VectorType>
129 const size_t nub = dummy.size();
130 for (
size_t i=0; i<nub; ++i) {
#define CGMRES_EIGEN_CONST_CAST(TYPE, OBJ)
Definition: macros.hpp:7
void retrive_mu_update(const OCP &ocp, const MatrixBase< VectorType1 > &u, const MatrixBase< VectorType2 > &dummy, const MatrixBase< VectorType3 > &mu, const MatrixBase< VectorType4 > &u_update, const MatrixBase< VectorType5 > &mu_udpate)
Definition: control_input_bounds.hpp:107
void retrive_dummy_update(const OCP &ocp, const MatrixBase< VectorType1 > &u, const MatrixBase< VectorType2 > &dummy, const MatrixBase< VectorType3 > &mu, const MatrixBase< VectorType4 > &u_update, const MatrixBase< VectorType5 > &dummy_update)
Definition: control_input_bounds.hpp:88
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 multiply_hmu_inv(const MatrixBase< VectorType1 > &dummy, const MatrixBase< VectorType2 > &mu, const MatrixBase< VectorType3 > &hdummy, const MatrixBase< VectorType4 > &hmu, const MatrixBase< VectorType5 > &hdummy_multiplied, const MatrixBase< VectorType6 > &hmu_multiplied)
Definition: control_input_bounds.hpp:77
void multiply_hdummy_inv(const MatrixBase< VectorType1 > &dummy, const MatrixBase< VectorType2 > &mu, const MatrixBase< VectorType3 > &hdummy, const MatrixBase< VectorType4 > &hmu, const MatrixBase< VectorType5 > &hdummy_multiplied)
Definition: control_input_bounds.hpp:67
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::Map< MatrixType > Map
Alias of Eigen::Map.
Definition: types.hpp:50
double Scalar
Alias of double.
Definition: types.hpp:11
Eigen::MatrixBase< MatrixType > MatrixBase
Alias of Eigen::MatrixBase.
Definition: types.hpp:29