-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LQMarkov
.
#489
Add LQMarkov
.
#489
Conversation
Hello @shizejin! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-07-05 03:58:57 UTC |
quantecon/lqcontrol.py
Outdated
deterministic (and :math:`C` is set to a zero matrix of appropriate | ||
dimension). | ||
|
||
The optiaml value function :math:`V(x_t, s_t)` takes the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"optimal"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
quantecon/lqcontrol.py
Outdated
|
||
def __init__(self, Π, Qs, Rs, As, Bs, Cs=None, Ns=None, beta=1): | ||
|
||
# == Make sure all matrices can be treated as 3D arrays == # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2D?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I was trying to see that all the arrays (Qs
, Rs
, etc.) consist of 2d arrays, but I guess it is confusing. Would "Make sure all matrices for each state are 2D arrays" be a little better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I just mean this: In your comment on line 423, you say 3D
but do you actually intend to say 2D
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually intended to say 3D since I was referring to the shape of Qs
array (and Rs
etc.) and Qs
has shape m (number of Markov states) x n (number of state variables) x n, but after you pointed this out, I realized Qs
is not a matrix and saying "matrices are 3D arrays" does not make any sense.. so I think maybe the comment I proposed above would be a little more clear
Beautifully written code. Great work @shizejin Regarding suggestions 1--2, let's wait and see if there's demand before we make those changes (but thanks for the suggestions). Rather than those additions, please have a think about the tests and see if you can keep coverage high. |
3e75ac6
to
dcad72a
Compare
Hi @jstac, I added more tests and the newly added lines in 4 changed files are fully covered. I think this is ready to be merged :) |
Thanks @shizejin . As far as I can tell, you don't have a test for |
Thanks @jstac for your suggestion! I had a look at the coverage report and the lines in I think the following is what causes our confusion: For each PR, we run two build jobs on Travis, one for
But since
This is why we observe a decrease in the coverage. I am trying to fix this by #490, which modifies Travis file to make sure that we only update coverage badge by reports from the |
Just a comment on naming: I guess in Python usually underscores are not used in a class name; if that is the case, would According to PEP8:
Does "CapWords convention" exclude use of an underscore? |
bb9b784
to
976ec7b
Compare
976ec7b
to
9bf2c24
Compare
c1f4922
to
6924613
Compare
Very nice work. I approve this PR. |
@mmcky It would be good to have this merged soon, as we'll follow it up with some new lectures. Please have a look when you can. Thanks. |
Integrating the code for solving Markov jump LQ dynamic programming problems from the notebook in the sandpit repository.
The modifications I have made comparing to the original code:
LQ
class,dict
and adoptndarray
to store transition, payoff matrices, policies, and value function arrays,Here is a demonstration for this
qe.LQ_Markov
class.Two points that I would like to have your opinions before I move on:
I will add more tests in the next few days.