chc.lqr¶
Stability tier: stable.
LQR / AKOR: the r_θ→0 closed-form optimum and Riccati cross-checks.
For the linear(-ised) known system this is the analytic control optimum the learned controller
must approach (a correctness limit). Maxima (exact symbolic) is the authority; scipy is the
float64 numeric, cross-checked against PARI high-precision and Octave (see validation/).
linearize_continuous(dyn, x, u)
¶
Jacobians (A, B) = (∂f/∂x, ∂f/∂u) of the continuous vector field at (x, u).
linearize_discrete(dyn, x, u, dt)
¶
Jacobians (A_d, B_d) of one step of chc.integrate.rk4_step at (x, u): RK4's,
or the Euler map of a field fitted to it.
continuous_lqr(a, b, q, r)
¶
Solve the continuous ARE; return (P, K) with the optimal feedback u = -K x.
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
finite_horizon_dlqr(a, b, q, r, qf, horizon)
¶
Backward Riccati recursion for the finite-horizon discrete LQ problem.
Returns time-varying gains gains of shape (H, m, n) (u_k = -gains[k] x_k) and the
initial cost-to-go P_0 (optimal cost 0.5 x0ᵀ P_0 x0).
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
dlqr_feedback_controls(dyn, x0, gains, dt)
¶
Simulate u_k = -gains[k] x_k and return the realised control sequence (H, m).
Step k runs from t = k * dt, the clock of chc.integrate.rollout, so a plant that
reads the time sees each step at its own.
linearized_regret_certificate(dyn, dyn_hat, x_star, u_star, q, r, x0, dt)
¶
Local certainty-equivalence suboptimality certificate for a (non)linear plant.
Linearises the true dyn and estimated dyn_hat at (x_star, u_star) and returns the LQ
certainty-equivalence regret bound (chc.regret.certainty_equivalence_gap) for that
linearisation -- a local certificate valid where model error dominates the plant's curvature.
Exact on a linear plant; empirically tracks the nonlinear closed-loop suboptimality to ~1.1x in
the small-model-error regime. Extends the LQ guarantee of chc.regret to nonlinear
plants, locally.
It is the regulator's gap about (x_star, u_star), read from the deviation x0 - x_star:
up to 0.18.0 it read from x0 itself, as if the regulator's origin were 0, which moved it
wherever x_star is not 0. The linearisation drops the RK4 step's constant term, so
(x_star, u_star) should be an equilibrium of both models' steps. The cost is
sum_k x_k' q x_k + u_k' r u_k, without the halves of chc.cost.QuadraticCost, so
in that cost's units the gap is half what this returns.