-
-
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
Add game_theory.normal_form_game #220
Conversation
One issue on importing: >>> import quantecon as qe
>>> qe.random.probvec(2, 3)
array([[ 0.77491011, 0.09414303, 0.13094686],
[ 0.69912477, 0.09336095, 0.20751428]]) But the newly added >>> qe.game_theory.NormalFormGame((2, 2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'quantecon' has no attribute 'game_theory' If I do >>> import quantecon.game_theory
>>> qe.game_theory.NormalFormGame((2, 2))
2-player NormalFormGame I wonder there is something wrong with |
It doesn't look like the module has been included in the from . import game_theory into the |
@davidrpugh Thanks, I will try that. But I wonder why the other submodules such as |
Hi @oyamad - the main role of the from quantecon import <object> But we also need to add it to the packages field in I might put some examples together for the new |
@oyamad Ah right. I see now. Sorry I just noticed I hadn't checked out the branch properly - so my |
why not just utilize gambit for this? |
@mmcky Thanks. Now this works: >>> import quantecon as qe
>>> qe.game_theory.NormalFormGame((2, 2))
2-player NormalFormGame But I still don't see why |
@rawls238 I don't know. Maybe Gambit is too sophisticated for the simple code for learning models (to come out with other PRs). |
I was wondering the same...
|
from .markov import MarkovChain, random_markov_chain, random_stochastic_matrix, gth_solve, tauchen #Promote to keep current examples working
from .markov import mc_compute_stationary, mc_sample_path
from .util import searchsorted, fetch_nb_dependencies
from ..random import probvec, sample_without_replacement If one removes the quantecon.random subpackage then the import of quantecon fails due to this relative import statement. So I will fix this to make the import of the |
@oyamad Due to the dual edit of |
@mmcky Thank you, now I understand it. |
I am enthusiastic to have these algorithms and representations included. As usual the code is of the highest quality. The notebook is very helpful to understand the main ideas. Everything I tested runs nicely and seems fast and efficient. I think it's essential that QuantEcon supports game theory in general and computation of Nash equilibria in particular. Solving for NE ranks alongside dynamic programming as one of the core set of algorithms to implement or support in a general purpose computational econ library. The only question is what to do about Gambit. I wrote to the lead developer and he showed no enthusiasm for supporting Python 3, making a conda package or cooperating with us on any front. This makes me think that we should go ahead and accept this PR (plus the corresponding PR for the notebook) and then see how things develop. Does anyone object? |
Thanks @oyamad. Once I obtain the green light from Travis CI I will merge this PR. |
Add game_theory.normal_form_game
This PR adds code on base classes for game theory tools,
Player
andNormalFormGame
(written with help from my previous RA @kusanot): see this notebook for demonstration.(Applications to learning/evolutionary dynamics models will be submitted with other PRs.)
game_theory
, anddocs/qe_apidoc.py
accordingly.