Clarify dare3/lqr3 truncation semantics and add tests#143
Merged
Conversation
Document that the default (non-full) return of `dare3` is `J*(x, u_prev=0)` rather than the optimal cost-to-go, and that the non-full `lqr3` gain is suboptimal because it drops the dependence on `u(k-1)`. Add tests covering the `Q3 -> 0` collapse to standard LQR, the matrix-form entry point, and the augmented Riccati equation residual. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #143 +/- ##
==========================================
- Coverage 91.81% 91.77% -0.04%
==========================================
Files 20 20
Lines 3065 3065
==========================================
- Hits 2814 2813 -1
- Misses 251 252 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dare3/lqr3docstrings to spell out the difference betweenfull=trueand the default. The defaultdare3returnsJ*(x, u_prev=0)— the optimal cost-to-go assumingu(k-1)=0— not the optimal cost-to-go for arbitraryu_prev. The defaultlqr3gain is similarly the augmented optimal gain with theu_prevcolumns dropped, and is therefore suboptimal as a feedback law. Both forms remain useful (e.g. as an MPC terminal cost / feedback when the controller does not tracku_prev); the docs now say so explicitly.test/test_lqg.jl:Q3 → 0collapses to standard discretelqr; the matrix-form entry pointdare3(A, B, Q1, Q2, Q3)matches the state-space form; the augmented Riccati residual is satisfied by thefull=truesolution.No behavior change — docs and tests only.
Test plan
julia --project -e 'using Pkg; Pkg.test()'passesdare3/lqr3