Skip to content

Conversation

@franckgaga
Copy link
Member

@franckgaga franckgaga commented Dec 31, 2025

Closes #300, this one was hard ! 😮‍💨

This bug affected all controllers (LinMPC or NonLinMPC) and all transcription methods (SingleShooting and MultipleShooting). It was hitting when the model was a LinModel and using custom move blocking patterns (when Hc is a vector of integers). The resulting solution of the optimization problem was completely wrong.

The init_predmat method for SingleShooting and LinModel was not considering the fact that the decision vector $\mathbf{Z} = \mathbf{\Delta U}$ only include the free moves (thus it skips the blocked moves). The resulting E matrix is way more complex when I take this into account. I needed to revise the mathematical notation to keep track of all the various indices. The method init_defectmat for MultipleShooting and LinModel had a similar bug with the Eŝ matrix.

I added a test that compare the solution of custom move blocking patterns for LinMPC and NonLinMPC, both for SingleShooting and MultipleShooting.

The new mathematical notation is described here:

@codecov-commenter
Copy link

codecov-commenter commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (81b2f31) to head (1a41588).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #301   +/-   ##
=======================================
  Coverage   98.55%   98.55%           
=======================================
  Files          28       28           
  Lines        4980     4993   +13     
=======================================
+ Hits         4908     4921   +13     
  Misses         72       72           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move blocking patterns are not correctly handled for LinModel

3 participants