DiscreteAlgebraicRiccatiSolver<T>

Models & Types · AiDotNet.Control

Solves the discrete-time algebraic Riccati equation by the structure-preserving doubling algorithm.

For Beginners

The Riccati equation asks for a cost surface that is consistent with itself — the cost of being somewhere must equal the cost of the best move plus the cost of wherever that move lands you. This solves that self-consistency condition. The answer is what tells a controller how expensive each situation really is, counting all future consequences.

How It Works

Solves P = AᵀPA − AᵀPB(R + BᵀPB)⁻¹BᵀPA + Q for the stabilizing P, implementing the doubling algorithm of B. D. O. Anderson, “Second-order convergent algorithms for the steady-state Riccati equation”, International Journal of Control 28(2), 1978, pp. 295-306, in the structure-preserving form of E. K.-W. Chu, H.-Y. Fan, W.-W. Lin and C.-S. Wang, “Structure- preserving algorithms for periodic discrete-time algebraic Riccati equations”, International Journal of Control 77(8), 2004, pp. 767-788.

Why doubling rather than the obvious iteration. The direct approach is to iterate the Riccati difference equation, substituting the current P into the right-hand side to get the next one. It converges, but only linearly: each step buys a fixed fraction of the remaining error, so reaching machine precision can take hundreds of steps. The doubling algorithm advances the equivalent of 2ᵏ of those steps on iteration k, which makes the convergence quadratic — the number of correct digits roughly doubles each time — at the cost of one extra matrix inverse per step. Twenty iterations is a great many.

It also needs no eigenvalue or Schur decomposition, which matters here: the alternative textbook method builds a symplectic matrix and extracts its stable invariant subspace, requiring an ordered Schur factorization that is considerably more machinery to get right.

Constructors

Constructor Summary
DiscreteAlgebraicRiccatiSolver() Creates a discrete-time Riccati solver with the default options.
DiscreteAlgebraicRiccatiSolver(AlgebraicRiccatiSolverOptions options) Creates a discrete-time Riccati solver.

Methods

Method Summary
AlgebraicRiccatiSolution<T> Solve(Matrix<T> stateMatrix, Matrix<T> inputMatrix, Matrix<T> stateCost, Matrix<T> inputCost) Solves the discrete-time algebraic Riccati equation.
Matrix<T> ComputeGain(Matrix<T> solution, Matrix<T> stateMatrix, Matrix<T> inputMatrix, Matrix<T> inputCost) Computes the optimal feedback gain K = (R + BᵀPB)⁻¹BᵀPA, so the optimal input is u = −Kx.