Skip to content
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

RFC, ENH: Implement GAMReader and GAMWriter #758

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

oyamad
Copy link
Member

@oyamad oyamad commented Jan 5, 2025

Cc: @GautamsGitHub

A couple of proposals:

  1. Alternative implementation of conversion from GAM format:
    def _parse(string):
    tokens = string.split()
    N = int(tokens.pop(0))
    nums_actions = tuple(int(tokens.pop(0)) for _ in range(N))
    payoffs = np.array([str2num(s) for s in tokens])
    na = np.prod(nums_actions)
    payoffs2d = payoffs.reshape(N, na)
    players = [
    Player(
    payoffs2d[i, :].reshape(nums_actions, order='F').transpose(
    list(range(i, N)) + list(range(i))
    )
    ) for i in range(N)
    ]
    return NormalFormGame(players)
  2. Rename qe_nfg_from_gam_file to from_gam
  3. Add GAMWriter and to_gam

@coveralls
Copy link

Coverage Status

coverage: 93.111% (-0.004%) from 93.115%
when pulling af6038b on gam_reader
into 66a4451 on main.

@mmcky mmcky self-requested a review January 6, 2025 03:31
Copy link
Contributor

@mmcky mmcky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @oyamad

Are these internal functions? Should we add any deprecation notifications for the old function names?

@oyamad
Copy link
Member Author

oyamad commented Jan 6, 2025

@mmcky Yes and no: On the current main, qe_nfg_from_gam_file is an internal function (i.e., not exported); and no version has been released since this function was implemented (so no need for deprecation notification).

@mmcky
Copy link
Contributor

mmcky commented Jan 10, 2025

thanks @oyamad. It looks like you're waiting for comments from @GautamsGitHub -- so feel free to merge when you're ready @oyamad.

I will keep an eye out and organise a new release once merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants