You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @bktaha we are concerned about the nonexistence of stable solution when beta >= 1 and this shall not be solved by simply adding more iterations. You may check that the example @oyamad raised in this thread fails to converge after 10000 iterations (thanks to your work, we can now freely choose the number of iterations). But again, PR #550 shall have nothing to do with this issue.
Below it is the output of Claude Code Fable 5 (with minor edits):
The appropriate restriction on beta is conditional on Cs — it is not a property of beta alone. Writing the value function as $V(x, s) = x' P(s) x + d(s)$, there are two separate issues.
1. Constant terms. The $d(s)$ satisfy $d(i) = \beta \sum_j \Pi_{ij} \left[ \mathrm{tr}\big(P(j) C(i) C(i)'\big) + d(j) \right]$, i.e., $d(i)$ is the discounted sum of per-period noise costs, which cannot be driven to zero. Since $\Pi$ is a stochastic matrix, $I - \beta \Pi$ is invertible iff $\beta < 1$, and with some $C(s) \neq 0$ no finite solution exists at $\beta = 1$: total cost is $+\infty$ under every policy, so the problem is ill posed. Hence $\beta \geq 1$ with $C(s) \neq 0$ for some $s$ should be rejected at construction, mirroring what LQ has done since #509 (cf. the discussion in #506).
2. Deterministic case. With all $C(s) = 0$, $\beta = 1$ — and in principle even $\beta > 1$ — is well posed whenever the scaled jump system $(\sqrt{\beta} A(s), \sqrt{\beta} B(s), \Pi)$ is mean-square stabilizable (Costa–Fragoso–Marques), so it should not be rejected unconditionally. But stationary_values must then set $d = 0$ directly: it currently solves the singular system $(I - \Pi) d = 0$ and raises LinAlgError even when the $P(s)$ iteration converges fine.
Two consequences worth noting:
The non-convergence in the example above is nonexistence, not slow convergence: the constant state ($x_2 \equiv 1$) is an uncontrollable unit eigenvalue of every $A(s)$ that carries positive cost, so the scaled system is not mean-square stabilizable at $\beta = 1$ and no fixed point exists — no max_iter helps (confirmed with max_iter=1_000_000). By contrast, non-convergence for $\beta$ slightly below $1$ is mere slow convergence, where increasing max_iter does help.
Simply letting $\beta = 1$ through to the Riccati solver preserves no valid use case while the singular $d$-solve is in place: e.g. with $C(s) \neq 0$ and stable dynamics, the $P(s)$ iteration converges and the computation then dies at the $d$ step with an uninformative LinAlgError.
Concretely, a proposed fix is: (i) in LQMarkov.__init__, raise ValueError if beta >= 1 and (Cs != 0).any(); (ii) in stationary_values, set ds = 0 when all Cs are zero instead of solving the linear system.
Activity
duncanhobbs commentedon Sep 24, 2019
I tested this same example with different values of
betabelow. I still get a convergence error whenbetais larger than 0.972.beta error after 1000 iterations:
1 51.302186197106494
0.99 0.0022754969468223862
0.98 1.0506482794880867e-07
0.975 7.403286872431636e-10
0.974 2.764863893389702e-10
0.973 1.0368239600211382e-10
0.972 converged in 966 iterations
Fix: ValueError `LQMarkov` with beta>0.972 (QuantEcon#508)
FIX: ValueError `LQMarkov` convergence failed (#550)
bktaha commentedon Jun 12, 2020
This should be addressed by PR #550
I did not link the PR here, so this has remained open.
jstac commentedon Jun 12, 2020
Many thanks for your contributions @bktaha .
@shizejin , could you please confirm and close when ready?
oyamad commentedon Jun 13, 2020
@shizejin Is the model well defined with
beta >= 1? Shouldn't the input withbeta >= 1be rejected?Refer to the discussion at #506.
shizejin commentedon Jun 13, 2020
Hi @bktaha we are concerned about the nonexistence of stable solution when
beta >= 1and this shall not be solved by simply adding more iterations. You may check that the example @oyamad raised in this thread fails to converge after 10000 iterations (thanks to your work, we can now freely choose the number of iterations). But again, PR #550 shall have nothing to do with this issue.@jstac @oyamad
bktaha commentedon Jun 13, 2020
Oh, I assumed that non-convergence for
beta >= 1was expected behavior. In this snippet from the test file forlqcontrol;QuantEcon.py/quantecon/tests/test_lqcontrol.py
Lines 225 to 229 in ca8fb06
the
stationary_valuesmethod is expected to raise a ValueError forlq_markov_mat2which is initialized withbeta = 1.05.ENH: Improve ValueError message for LQMarkov DARE when beta=1 (Fixes Q…
oyamad commentedon Jul 15, 2026
Below it is the output of Claude Code Fable 5 (with minor edits):
The appropriate restriction on$V(x, s) = x' P(s) x + d(s)$ , there are two separate issues.
betais conditional onCs— it is not a property ofbetaalone. Writing the value function as1. Constant terms. The$d(s)$ satisfy $d(i) = \beta \sum_j \Pi_{ij} \left[ \mathrm{tr}\big(P(j) C(i) C(i)'\big) + d(j) \right]$ , i.e., $d(i)$ is the discounted sum of per-period noise costs, which cannot be driven to zero. Since $\Pi$ is a stochastic matrix, $I - \beta \Pi$ is invertible iff $\beta < 1$ , and with some $C(s) \neq 0$ no finite solution exists at $\beta = 1$ : total cost is $+\infty$ under every policy, so the problem is ill posed. Hence $\beta \geq 1$ with $C(s) \neq 0$ for some $s$ should be rejected at construction, mirroring what
LQhas done since #509 (cf. the discussion in #506).2. Deterministic case. With all$C(s) = 0$ , $\beta = 1$ — and in principle even $\beta > 1$ — is well posed whenever the scaled jump system $(\sqrt{\beta} A(s), \sqrt{\beta} B(s), \Pi)$ is mean-square stabilizable (Costa–Fragoso–Marques), so it should not be rejected unconditionally. But $d = 0$ directly: it currently solves the singular system $(I - \Pi) d = 0$ and raises $P(s)$ iteration converges fine.
stationary_valuesmust then setLinAlgErroreven when theTwo consequences worth noting:
max_iterhelps (confirmed withmax_iter=1_000_000). By contrast, non-convergence formax_iterdoes help.LinAlgError.Concretely, a proposed fix is: (i) in
LQMarkov.__init__, raiseValueErrorifbeta >= 1and(Cs != 0).any(); (ii) instationary_values, setds = 0when allCsare zero instead of solving the linear system.oyamad commentedon Aug 12, 2026
This has not been fixed yet. Reopening...
ENH: Add state_values to DiscreteDP (QuantEcon#832)
FIX: Handle LQMarkov beta limits based on shocks (#831)