diff --git a/CHANGELOG.md b/CHANGELOG.md index d50a397..ed34076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,16 @@ # Changelog +## [0.3.1] - 2023-03-06 + +### Fixed +- The computation of the scalar multipler was not correct + ## [0.3.0] - 2023-03-04 -## Added +### Added - Added new api in linear mpc to add a scalar constraints -## Changed +### Changed - In linear mpc the last input command is now used to initialize the optimal control problem ### Fixed diff --git a/include/mpc/LMPC/ProblemBuilder.hpp b/include/mpc/LMPC/ProblemBuilder.hpp index 69d6685..60fc8bc 100644 --- a/include/mpc/LMPC/ProblemBuilder.hpp +++ b/include/mpc/LMPC/ProblemBuilder.hpp @@ -328,11 +328,7 @@ namespace mpc for (size_t i = 0; i < ph() + 1; i++) { - for (size_t j = 0; j < ph() + 1; j++) - { - sMultiplier.block(i, j * ph(), 1, nx()) = X.transpose(); - sMultiplier.block(i, (j * ph()) + nx(), 1, nu()) = U.transpose(); - } + sMultiplier.block(i, i * (nx() + nu()), 1, nx() + nu()) << X.transpose(), U.transpose(); } return buildTimeInvariantTems(); @@ -362,11 +358,7 @@ namespace mpc for (size_t i = 0; i < ph() + 1; i++) { - for (size_t j = 0; j < ph() + 1; j++) - { - sMultiplier.block(i, j * ph(), 1, nx()) = X.transpose(); - sMultiplier.block(i, (j * ph()) + nx(), 1, nu()) = U.transpose(); - } + sMultiplier.block(i, i * (nx() + nu()), 1, nx() + nu()) << X.transpose(), U.transpose(); } return buildTimeInvariantTems(); @@ -746,7 +738,7 @@ namespace mpc } // insert a scalar constraint - // TODO add support for multple scalar constraints + // TODO add support for multiple scalar constraints Aineq.block( ((ph() + 1) * (nu() + nx())) + ((ph() + 1) * ny()) + (ph() * nu()), 0,