Skip to content

Commit cfd14dc

Browse files
committed
FIX: avoid solving stationary values for multiple times
1 parent 86e4338 commit cfd14dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

quantecon/lqcontrol.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ def compute_sequence(self, x0, ts_length=None, method='doubling',
298298
# == Preliminaries, infinite horizon case == #
299299
else:
300300
T = ts_length if ts_length else 100
301-
self.stationary_values(method=method)
301+
if self.P is None:
302+
self.stationary_values(method=method)
302303

303304
# == Set up initial condition and arrays to store paths == #
304305
random_state = check_random_state(random_state)
@@ -570,7 +571,8 @@ def compute_sequence(self, x0, ts_length=None, random_state=None):
570571
"""
571572

572573
# === solve for optimal policies === #
573-
self.stationary_values()
574+
if self.Ps is None:
575+
self.stationary_values()
574576

575577
# === Simplify notation === #
576578
As, Bs, Cs = self.As, self.Bs, self.Cs

0 commit comments

Comments
 (0)