Skip to content

Commit

Permalink
Rename qe_nfg_from_gam_file to from_gam
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed Jan 5, 2025
1 parent 0bdc14e commit 8acfa15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion quantecon/game_theory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
from .logitdyn import LogitDynamics
from .polymatrix_game import PolymatrixGame
from .howson_lcp import polym_lcp_solver
from .game_converters import GAMReader, GAMWriter, qe_nfg_from_gam_file
from .game_converters import GAMReader, GAMWriter, from_gam
4 changes: 2 additions & 2 deletions quantecon/game_theory/game_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>>> import quantecon.game_theory as gt
>>> filepath = os.path.dirname(gt.__file__)
>>> filepath += "/tests/game_files/minimum_effort_game.gam"
>>> nfg = gt.qe_nfg_from_gam_file(filepath)
>>> nfg = gt.from_gam(filepath)
>>> print(nfg)
3-player NormalFormGame with payoff profile array:
[[[[ 1., 1., 1.], [ 1., 1., -9.], [ 1., 1., -19.]],
Expand Down Expand Up @@ -203,7 +203,7 @@ def _dump(g):
return s.rstrip()


def qe_nfg_from_gam_file(filename: str) -> NormalFormGame:
def from_gam(filename: str) -> NormalFormGame:
"""
Makes a QuantEcon Normal Form Game from a gam file.
Expand Down
8 changes: 4 additions & 4 deletions quantecon/game_theory/tests/test_howson_lcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
from numpy.testing import assert_, assert_allclose
from quantecon.game_theory.game_converters import qe_nfg_from_gam_file
from quantecon.game_theory.game_converters import from_gam
from quantecon.game_theory import (
Player,
NormalFormGame,
Expand All @@ -22,7 +22,7 @@

def test_polym_lcp_solver_where_solution_is_pure_NE():
filename = "big_polym.gam"
nfg = qe_nfg_from_gam_file(os.path.join(data_dir, filename))
nfg = from_gam(os.path.join(data_dir, filename))
polymg = PolymatrixGame.from_nf(nfg)
ne = polym_lcp_solver(polymg)
worked = nfg.is_nash(ne)
Expand All @@ -31,7 +31,7 @@ def test_polym_lcp_solver_where_solution_is_pure_NE():

def test_polym_lcp_solver_where_lcp_solver_must_backtrack():
filename = "triggers_back_case.gam"
nfg = qe_nfg_from_gam_file(os.path.join(data_dir, filename))
nfg = from_gam(os.path.join(data_dir, filename))
polymg = PolymatrixGame.from_nf(nfg)
ne = polym_lcp_solver(polymg)
worked = nfg.is_nash(ne)
Expand Down Expand Up @@ -305,7 +305,7 @@ def test_solves_multiplayer_rps_like():

def test_different_starting():
filename = "triggers_back_case.gam"
nfg = qe_nfg_from_gam_file(os.path.join(data_dir, filename))
nfg = from_gam(os.path.join(data_dir, filename))
polymg = PolymatrixGame.from_nf(nfg)
starting = [3, 2, 2, 0, 3]
# We also notice that changing the start
Expand Down
8 changes: 4 additions & 4 deletions quantecon/game_theory/tests/test_polymatrix_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from numpy.testing import assert_, assert_raises
from quantecon.game_theory.game_converters import qe_nfg_from_gam_file
from quantecon.game_theory.game_converters import from_gam
from quantecon.game_theory import NormalFormGame, PolymatrixGame
from numpy import allclose, zeros

Expand Down Expand Up @@ -39,13 +39,13 @@ class TestPolymatrixGame():
@classmethod
def setup_class(cls):
filename = "minimum_effort_game.gam"
cls.non_pmg = qe_nfg_from_gam_file(
cls.non_pmg = from_gam(
os.path.join(data_dir, filename))
filename = "big_polym.gam"
cls.pmg1 = qe_nfg_from_gam_file(
cls.pmg1 = from_gam(
os.path.join(data_dir, filename))
filename = "triggers_back_case.gam"
cls.pmg2 = qe_nfg_from_gam_file(
cls.pmg2 = from_gam(
os.path.join(data_dir, filename))
bimatrix = [[(54, 23), (72, 34)],
[(92, 32), (34, 36)],
Expand Down

0 comments on commit 8acfa15

Please sign in to comment.