Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RFC, ENH: Implement GAMReader and GAMWriter #758

Merged
merged 5 commits into from
Jan 23, 2025
Merged

RFC, ENH: Implement GAMReader and GAMWriter #758

merged 5 commits into from
Jan 23, 2025

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.

@oyamad
Copy link
Member Author

oyamad commented Jan 23, 2025

Let's merge this PR.

@oyamad oyamad merged commit 87450f3 into main Jan 23, 2025
11 checks passed
@oyamad oyamad deleted the gam_reader branch January 23, 2025 01:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants