All problems
Infinite-Horizon Value Check
Problem
Compute the closed-form infinite-horizon LQR value for a scalar system.
With s = b ** 2 and beta = R * (1 - a ** 2) - s * Q, return (-beta + sqrt(beta ** 2 + 4 * s * R * Q)) / (2 * s), the positive root of the algebraic Riccati equation. If s is 0, return Q.
Hint
This is the fixed point of the Riccati recursion, obtained from a quadratic equation.
Test cases
case 1
in: [1,1,1,1]
expected: 1.618033988749895
case 2
in: [0.9,0.5,1,0.5]
expected: 1.7577914214416384
case 3
in: [1,0,2,1]
expected: 2
Starter codePython
def infinite_horizon_value(a, b, Q, R):
# Your code here
pass3 test cases · run your code against them in the editor