Skip to content

Add sample game generators from bimatrix-generators #392

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

Merged
merged 8 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/qe_apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
:show-inheritance:
"""

game_generators_module_template = """{mod_name}
{equals}

.. automodule:: quantecon.game_theory.game_generators.{mod_name}
:members:
:undoc-members:
:show-inheritance:
"""

markov_module_template = """{mod_name}
{equals}

Expand Down Expand Up @@ -189,6 +198,13 @@ def model_tool():
# Alphabetize
game_theory.sort()

# list file names with game_theory/game_generators
game_generators_files = glob("../quantecon/game_theory/game_generators/[a-z0-9]*.py")
game_generators = list(
map(lambda x: x.split('/')[-1][:-3], game_generators_files))
# Alphabetize
game_generators.sort()

# list file names with markov
markov_files = glob("../quantecon/markov/[a-z0-9]*.py")
markov = list(map(lambda x: x.split('/')[-1][:-3], markov_files))
Expand Down Expand Up @@ -225,6 +241,15 @@ def model_tool():
equals = "=" * len(mod)
f.write(game_theory_module_template.format(mod_name=mod, equals=equals))

for mod in game_generators:
new_path = os.path.join("source", "game_theory", "game_generators", mod + ".rst")
with open(new_path, "w") as f:
equals = "=" * len(mod)
f.write(game_generators_module_template.format(
mod_name=mod, equals=equals))
#Add sudirectory to flat game_theory list for index file
game_theory.append("game_generators/{}".format(mod))

# Write file for each markov file
for mod in markov:
new_path = os.path.join("source", "markov", mod + ".rst")
Expand Down
1 change: 1 addition & 0 deletions docs/source/game_theory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Game theory
game_theory/support_enumeration
game_theory/utilities
game_theory/vertex_enumeration
game_theory/game_generators/bimatrix_generators
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bimatrix_generators
===================

.. automodule:: quantecon.game_theory.game_generators.bimatrix_generators
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Utilities
:maxdepth: 2

util/array
util/combinatorics
util/common_messages
util/notebooks
util/numba
Expand Down
7 changes: 7 additions & 0 deletions docs/source/util/combinatorics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
combinatorics
=============

.. automodule:: quantecon.util.combinatorics
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions quantecon/game_theory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
from .lemke_howson import lemke_howson
from .mclennan_tourky import mclennan_tourky
from .vertex_enumeration import vertex_enumeration, vertex_enumeration_gen
from .game_generators import *
7 changes: 7 additions & 0 deletions quantecon/game_theory/game_generators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
game_theory.game_generators

"""
from .bimatrix_generators import (
blotto_game, ranking_game, sgc_game, tournament_game, unit_vector_game
)
Loading