-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: solve_discrete_riccati returns non-stabilizing solution #356
Comments
The same result obtains with QuantEcon.jl, by the way. |
It turned out that A solution def compute_F_S_A_F(P, A, B, R, N):
S1 = R + B.T @ P @ B
S2 = B.T @ P @ A + N
F = np.linalg.solve(S1, S2)
A_F = A - B @ F
return F, S1, A_F For P_qe = qe.solve_discrete_riccati(A0, B0, R, Q, N)
F_qe, S_qe, A_F_qe = compute_F_S_A_F(P_qe, A0, B0, Q, N)
F_qe, S_qe, A_F_qe (array([[ 0.49499965, -1. ]]),
array([[ 8.16243]]),
array([[ 0.9486833 , 0. ],
[-0.30832118, 1.0540915 ]])) w, v = np.linalg.eig(A_F_qe)
w array([ 1.0540915, 0.9486833]) For the solution by P_sp = scipy.linalg.solve_discrete_are(A0, B0, R, Q, s=N.reshape(2, 1))
F_sp, S_sp, A_F_sp = compute_F_S_A_F(P_sp, A0, B0, Q, N)
F_sp, S_sp, A_F_sp (array([[ 0.20250284, -0.9000018 ]]),
array([[ 9.06934853]]),
array([[ 9.48683298e-01, 0.00000000e+00],
[ -2.77492114e-06, 9.48684247e-01]])) w, v = np.linalg.eig(A_F_sp)
w array([ 0.94868425, 0.9486833 ]) |
@jstac How did you choose the values of |
Removing The paper Chiang, Fan, and Lin says |
Well done @oyamad , thanks for spotting this. I can't remember how I chose |
* FIX: Remove 0.0 from `candidates` in `solve_discrete_riccati` Fix #356 * TEST: Set atol in `test_robust_rule_vs_simple`
I have got an LQ problem for which
LQ.stationary_values
returns some suspicious solution, wheresolve_discrete_riccati
is a suspect.Different solutions:
qe.solve_discrete_riccati
versusscipy.linalg.solve_discrete_are
Consider the following inputs:
qe.solve_discrete_riccati
returns a solution different from one fromscipy.linalg.solve_discrete_are
.Solution by
qe.solve_discrete_riccati
:Solution by
scipy.linalg.solve_discrete_are
:Both are indeed solutions:
Stability of
A - B @ F
Consider the LQ control problem defined by the inputs above, and suppose that
F
is the matrix that gives the optimal control. ThenG = A - B @ F
is the matrix that generates state transition:Eigenvalues of
G_qe
:"Discounted eigenvalues":
Eigenvalues of
G_sp
:Original approximating LQ control problem
The inputs came from an LQ approximation of a model growth model. See this notebook for details.
The text was updated successfully, but these errors were encountered: