Skip to content

Commit

Permalink
FIX: ValueError LQMarkov convergence failed (#550)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bktaha authored Jun 12, 2020
1 parent 9d0fb5b commit ca8fb06
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions quantecon/lqcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def __str__(self):
return dedent(m.format(b=self.beta, m=self.m, n=self.n, k=self.k,
j=self.j, t=t))

def stationary_values(self):
def stationary_values(self, max_iter=1000):
"""
Computes the matrix :math:`P(s)` and scalar :math:`d(s)` that
represent the value function
Expand All @@ -491,6 +491,11 @@ def stationary_values(self):
in the infinite horizon case. Also computes the control matrix
:math:`F` from :math:`u = - F(s) x`.
Parameters
----------
max_iter : scalar(int), optional(default=1000)
The maximum number of iterations allowed
Returns
-------
Ps : array_like(float)
Expand All @@ -512,7 +517,8 @@ def stationary_values(self):
Qs, Rs, Ns = self.Qs, self.Rs, self.Ns

# == Solve for P(s) by iterating discrete riccati system== #
Ps = solve_discrete_riccati_system(Π, As, Bs, Cs, Qs, Rs, Ns, beta)
Ps = solve_discrete_riccati_system(Π, As, Bs, Cs, Qs, Rs, Ns, beta,
max_iter=max_iter)

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

0 comments on commit ca8fb06

Please sign in to comment.