Skip to content

Commit

Permalink
Merge branch 'fix-scalar' into 'master'
Browse files Browse the repository at this point in the history
Fix scalar multiplier

See merge request altairLab/optcontrol/libmpc!35
  • Loading branch information
nicolapiccinelli committed Mar 6, 2023
2 parents 978b447 + bd8bd0b commit 0702f24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 3 additions & 11 deletions include/mpc/LMPC/ProblemBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0702f24

Please sign in to comment.