FIX: two minor modifications in lqcontrol
#498
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I made two fixes for
LQ
andLQMarkov
classes.There was a typo in calculating the values of the last period states for
LQMarkov
models. I forgot to left multiply theC
matrix to the vector of shocks. I have fixed this and modified tests correspondingly.The code was computing stationary values each time we call
compute_series
, which is unnecessary since the optimal policyF
are stored as class attribute and do not change. This increases running time especially for lectures that simulate multiple paths for the same model, e.g. "How to Pay for a War: Part 1". I modified it to only compute stationary values once whencompute_series
method is called for the first time. By doing so, the running time of "How to Pay for a War: Part 1" decreases from42s
to12s
.The first point is closely related to the work about the series of Markov Jump LQ DP lectures. I feel sorry that I fail to spot this typo. It would be great if we can make another release before we publish those lectures. However, since this bug only matters for values in the last period and almost has no influence on the patterns of the graphs that we draw, I guess it will also be fine that we publish lectures first and include these fixes in a release with other commits later.