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.
Overview
Currently
pygambithas a simple implementation of__repr__forMixedStrategyProfileandMixedBehaviorProfile(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 notlist-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 apandas.Serieswith hierarchical indexing.Issues to consider:
pandas.Seriesis to truncate the representation of long objects by having an ellipsis in the middle. Should we also do this?