Skip to content

Commit ca8fb06

Browse files
authored
FIX: ValueError LQMarkov convergence failed (#550)
* Fix: ValueError `LQMarkov` with beta>0.972 (#508) * add line breaks to comply with pep8 * add docstring for max_iter parameter in LQMarkov * move max_iter to kwarg of stationary_values, fix docstring, and indents for pep8 * edit line break for style consistency
1 parent 9d0fb5b commit ca8fb06

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

quantecon/lqcontrol.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def __str__(self):
479479
return dedent(m.format(b=self.beta, m=self.m, n=self.n, k=self.k,
480480
j=self.j, t=t))
481481

482-
def stationary_values(self):
482+
def stationary_values(self, max_iter=1000):
483483
"""
484484
Computes the matrix :math:`P(s)` and scalar :math:`d(s)` that
485485
represent the value function
@@ -491,6 +491,11 @@ def stationary_values(self):
491491
in the infinite horizon case. Also computes the control matrix
492492
:math:`F` from :math:`u = - F(s) x`.
493493
494+
Parameters
495+
----------
496+
max_iter : scalar(int), optional(default=1000)
497+
The maximum number of iterations allowed
498+
494499
Returns
495500
-------
496501
Ps : array_like(float)
@@ -512,7 +517,8 @@ def stationary_values(self):
512517
Qs, Rs, Ns = self.Qs, self.Rs, self.Ns
513518

514519
# == Solve for P(s) by iterating discrete riccati system== #
515-
Ps = solve_discrete_riccati_system(Π, As, Bs, Cs, Qs, Rs, Ns, beta)
520+
Ps = solve_discrete_riccati_system(Π, As, Bs, Cs, Qs, Rs, Ns, beta,
521+
max_iter=max_iter)
516522

517523
# == calculate F and d == #
518524
Fs = np.array([np.empty((k, n)) for i in range(m)])

0 commit comments

Comments
 (0)