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

ENH: Implementation of __repr__ for mixed profiles #433

Open
tturocy opened this issue Jan 14, 2024 · 0 comments
Open

ENH: Implementation of __repr__ for mixed profiles #433

tturocy opened this issue Jan 14, 2024 · 0 comments
Labels
cython Items which involve coding in Cython enhancement python Items which involve coding in Python
Milestone

Comments

@tturocy
Copy link
Member

tturocy commented Jan 14, 2024

Overview

Currently pygambit has a simple implementation of __repr__ for MixedStrategyProfile and MixedBehaviorProfile (and the related classes that represent player or information set slices), which displays probabilities as a nested list.

This is not ideal, because these classes are dict-like and not list-like; those __repr__ implementations are therefore misleading. Further, they are of perhaps not that much utility for games with more than a few strategies or actions.

Proposal

We propose a new implementation of __repr__ which is more like that of a pandas.Series with hierarchical indexing.

Issues to consider:

  • When players, strategies, information sets, and/or actions are labeled, it is nature to use their labels in this representation. However, how should we handle the case of un-labeled elements?
  • The default for a pandas.Series is to truncate the representation of long objects by having an ellipsis in the middle. Should we also do this?
  • Note that the command-line tools already implement something like this in C++. Although it would be quite quick to implement this in pure Python, it might be worth considering refactoring the existing C++ so we have a commonality of implementation, even if doing the C++ string formatting will be slightly more tedious.
@tturocy tturocy added python Items which involve coding in Python enhancement cython Items which involve coding in Cython labels Feb 1, 2024
@tturocy tturocy added this to the gambit-16.3.0 milestone Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cython Items which involve coding in Cython enhancement python Items which involve coding in Python
Projects
None yet
Development

No branches or pull requests

1 participant