-
Notifications
You must be signed in to change notification settings - Fork 264
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
Implement asymmetric games #1411
Comments
I'd be keen to hear @marcharper's thoughts on this in terms of how this aligns with other theoretic constructs.
There has been an ongoing discussion/plan of Axelrod |
Hi, I think this contribution raises some interesting questions about the library's abstractions, as @drvinceknight mentions (see this discussion). The abstractions emerged organically and are still tied to assumptions about the nature of the game itself. In particular, the The I'm certainly in favor of adding more game types to the library but it's worth thinking about whether we need new abstract base classes for For Game, rather than make The |
@marcharper Thank you for your thoughts. Match, Tournament etc. work perfectly well with an asymmetric game class (Match doesn't require any changes at all!); the reason I suggested refactoring Tournaments is because in an asymmetric tournament, we would not necessarily want the same population playing both row and column players. Take, for example, a game studying biological co-evolution where one player plays an animal, and the other a plant; we wouldn't necessarily want a strategy cooked up for an animal being used for the plant's choice set (and it wouldn't make sense model-wise), but round-robin tournaments mean that every strategy does at least one game in either role. The reason I suggested making AsymmetricGame the new base is that symmetric ones are a 'special case' of the generic game where the payoff matrices satisfy B = A^T. This means the two classes would be so similar (essentially identical, except for Game having an RPST method and taking four floats instead of two arrays) that an abstract base class would be unnecessary. The use case/model for the paired Moran algorithm is exactly the same as that for asymmetric tournaments; in many asymmetric models, every player playing against every other player makes no sense. As another example, take a game theoretic model of several 'tribes', who have different army tactics. A regular Moran process would account for the utility of members of one tribe fighting against their own tribe, which again doesn't make sense in the model. I think that the existing strategies not necessarily working for larger games is fine theoretically speaking (much in the same way as in real life, my strategy for Rock Paper Scissors could never be isomorphic to my strategy for poker). As you said, this is already the case if you play the already-implemented symmetric Game with different RPST. That said, to manage the added complexity, this should start by just implementing asymmetric 2x2 games - then larger games would be a separate issue (which would require wider refactoring of the regular Game class and quite possibly breaking changes) My current code just treats the action C as 'action 1' and D as 'action 2' in the matrix. For aiding generality, a better implementation would take integers x and y from the row and column players respectively, and return the scores as (A[x][y], B[x][y]). For compatibility (and ease of use), a map that converts C and D into 0 and 1 would allow the existing code to work with this implementation. I'm happy to create a PR where we can see what breaks in the tests and how the implementation actually looks, which is easier than me trying to explain it. |
Sounds good. |
Yup 👍 We can chat about this when we meet later today @alexhroom 👍 |
Closed by #1413. |
@drvinceknight suggested I open an issue sharing some code for asymmetric games (see asymmetric_game.py and trade_tournament.py here) which I have been using to run asymmetric tournaments in Axelrod. In particular, it generalises the Game object to take two matrices, rather than just one.
This could be more fully implemented into Axelrod (and I'm happy to do so after discussing it here) in one of two ways:
Similarly, an asymmetric tournament takes two groups (one of row players, one of column players), and then a regular Tournament would become one where the same list of players is passed to both groups. This would build asymmetric Axelrod 'on top' of the existing code with minimal damage to the existing code.
One potential issue I've identified is with the RPST method, which doesn't make sense for asymmetric games; if any important code requires RPST this would need some deeper refactoring (to a 'self' and 'opponent' RPST), but otherwise this could just throw an error if used on an asymmetric game.
Finally, I had written a Paired Moran algorithm which generalises the Moran process to asymmetric games (which takes two populations, and uses fitness functions based on each players' performance against the other population), but this would be a separate PR. @marcharper Vince said your thoughts on this would be valuable.
I would angle towards implementation 2 if given full choice as it reduces code complexity and builds asymmetric games directly into Axelrod. However, it would be a deeper refactoring of the library, so I understand if that is undesirable :-)
The text was updated successfully, but these errors were encountered: