# analytic solution to structured algebraic Riccati equation

In solving a model I have written down for a research paper, I am left with two Algebraic Riccati Equations, that is I need to solve for $X$ in the equation

\begin{align*} X = A^\top (X + XB(R + B^\top X B)^{-1}B^\top X))A + Q. \end{align*}

These arise from solving a LQG problem. From what I have picked up over the last few days, there is no general solution to this equation, i.e. an $f$ such that $X = f(A,B,R,Q)$ for all $(A,B,R,Q)$. However, there seems to be many special instances in which substantial analytical progress can be made.

My problem has quite a bit of structure, and I wonder if I could be pointed to some results that would help me. My problem is characterized by:

(1) $B = (1,1,0,0)$ for one problem and $B = (0,0,1,0)$ for the other, (2) $R$ a positive scalar, (3) $Q$ symmetric, and (4) (for one problem) $A$ also symmetric and $Q$ diagonal.

If anyone is aware of general results or methods for approach that might be useful in my particular case, I would be very grateful. It would be nice if these could be stated with a minimum of engineering jargon, my background is more in math and some of the terminology is not helpful.

• Few questions, is Q positive semidefinite? Does your cost function have cross terms? Is your system dissipative/positive real, etc.? Laub has a significant body of work on the Riccati equation. I would start by looking at The Riccati Equation edited by Bittanti, Laub, and Willems, then go explore papers that cite it. – riboch Feb 18 '14 at 14:46

There is no analytic method and for real-world problems in control theory, you do not need an analytic solution.

Here is the solution suggested from Vasile Sima which I wrote the C++ codes based upon here.

/*
This file contains a continuous-time algebraic Riccati equation solver based on the explanations from Dr. Vasile Sima.
Further reference: Sima, Vasile. Algorithms for linear-quadratic optimization. Vol. 200. CRC Press, 1996.
*/

// A C++ implementation of a Continuous-time Algebraic Riccati Equation (CARE) solver based on Schur vectors.

// Solves a CARE, A'X + XA - XBR^(-1)B'X + Q = 0, using Schur vectors method, with A and Q n-by-n, B n-by-m, and R m-by-m real matrices, and Q and R symmetric, R positive definite. It is assumed, e.g., that the matrix pair (A,B) is stabilizable, and the matrix pair (C,A) is detectable, where Q = C'C, and rank(C) = rank(Q).

// Main steps:

// 1. Construct the Hamiltonian matrix H, H = [ A -B*(R\B'); Q -A' ]; (in MATLAB notation).

// 2. Reduce H to a real Schur form S and accumulate the transformations in U, S = U'HU, U orthogonal.

// 3. Reorder the real Schur form S so that all n stable eigenvalues are moved to the leading part of S, accumulating the transformations in U.

// 4. Compute the unique positive-semidefinite stabilizing solution X, X = U(n+1:2n,1:n)*U(1:n,1:n)^(-1).

// 5. Symmetrize X, X = ( X + X' )/2.


If you are using MATLAB, you can simply use care, dare and even lqg commands.

An ad-hoc solution is using Genetic Algorithm to solve these problems via C++ (solver, NLP demo) or MATLAB.

• Hi @Arash, I'm lucky to have found this. Can you please write a C++ implementation of the Discrete-time Algebraic Riccati Equation (DARE) solver? I really need it for an embedded controller (with limited processing power) in a research project and I can't find any implementation of it in C++. I use C++ since it is faster than higher level languages. I would like to cite you in the bibliography so you can please include a "How to Cite" section. – John Smith Dec 22 '18 at 10:10
• @JohnSmith, Dear John, I have been away from this topic for a while and my mind is not fresh in this field. Maybe you can convert discrete to continuous. And solve it via continuous methods. – Arash Dec 23 '18 at 12:37