-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
ENH: added routines to convert ddp between full and SA formulations #318
Conversation
e3f713e
to
9938ff0
Compare
quantecon/markov/ddp.py
Outdated
if self._sa_pair: | ||
ns = self.num_states | ||
na = self.a_indices.max() + 1 | ||
R = np.zeros((ns, na)) |
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.
Maybe this should be np.full((ns, na), -np.inf)
?
quantecon/markov/ddp.py
Outdated
if self._sa_pair: | ||
return self | ||
else: | ||
s_ind, a_ind = np.where(np.isfinite(self.R)) |
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.
Better to write self.R > -np.inf
instead of np.isfinite(self.R)
?
(self.R
may contain np.inf
.)
A comment on terminology: (My view is that an SA formulation is already a "full" description of the model when the sets |
Thanks for the review. I 100% agree on all accounts and will make the changes in a few hours when I'm back at a computer |
In the test code, maybe better to assign |
Good call @oyamad -- I've added these tests. |
Thanks @sglyon. |
Sometimes I find it helpful to have convenient, even if not optimally efficient, routines for converting between the SA and full formulations.
This PR implements such routines.