Skip to content

Clarify dare3/lqr3 truncation semantics and add tests#143

Merged
baggepinnen merged 1 commit into
masterfrom
dare3-docs-tests
May 15, 2026
Merged

Clarify dare3/lqr3 truncation semantics and add tests#143
baggepinnen merged 1 commit into
masterfrom
dare3-docs-tests

Conversation

@baggepinnen
Copy link
Copy Markdown
Member

Summary

  • Expand dare3 / lqr3 docstrings to spell out the difference between full=true and the default. The default dare3 returns J*(x, u_prev=0) — the optimal cost-to-go assuming u(k-1)=0 — not the optimal cost-to-go for arbitrary u_prev. The default lqr3 gain is similarly the augmented optimal gain with the u_prev columns 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 track u_prev); the docs now say so explicitly.
  • Add three tests in test/test_lqg.jl: Q3 → 0 collapses to standard discrete lqr; the matrix-form entry point dare3(A, B, Q1, Q2, Q3) matches the state-space form; the augmented Riccati residual is satisfied by the full=true solution.

No behavior change — docs and tests only.

Test plan

  • julia --project -e 'using Pkg; Pkg.test()' passes
  • Inspect the rendered docstrings for dare3 / lqr3

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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (c7bdec7) to head (30ab968).
⚠️ Report is 1 commits behind head on master.

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     
Flag Coverage Δ
unittests 91.77% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@baggepinnen baggepinnen merged commit 14a7deb into master May 15, 2026
2 checks passed
@baggepinnen baggepinnen deleted the dare3-docs-tests branch May 15, 2026 14:36
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.

2 participants