Add 3 player max cut test for enumpoly solver - #969
Conversation
|
@rahulsavani I added the test we discussed on Wednesday, would appreciate your review :) |
There was a problem hiding this comment.
Pull request overview
Adds a targeted regression test to ensure enumpoly_solve correctly finds all equilibria (two pure + one symmetric mixed) for a 3-player 2x2x2 max-cut-derived normal-form game.
Changes:
- Adds a new
ENUMPOLY_STRATEGY_CASEStest case validating three equilibria for a 2x2x2 NFG. - Updates the
.nfgtest game’s header comments to document the mixed equilibrium structure. - Registers a new pytest marker (
nash_enumpoly_strategy) and wires the new case into the main strategy-solver parametrization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_nash.py | Adds and registers an enumpoly strategy-form equilibrium test case for a 3-player 2x2x2 NFG. |
| tests/test_games/2x2x2_nfg_from_local_max_cut_2_pure_1_mixed_eq.nfg | Clarifies documentation for the symmetric mixed equilibrium in the test fixture. |
| pyproject.toml | Adds the nash_enumpoly_strategy marker so --strict-markers remains satisfied. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rahulsavani
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me, though co-pilot is right, we should probably include a regret_tol too. This max cut game is super simple so it may never error, but it's still good practice. For the suggestion below with nau2004, we'll definitely need that anyway.
Further suggestion:
Sorry to be demanding but I didn't realise we had no tests at all for "ENUMPOLY_STRATEGY", could you perhaps add a couple more, e.g. a 2-player coordination games would be natural (say in dimension 4 where we expect 7 eq, assuming it runs quickly enough, or dim 3 if not), for one or two further 3-player games you could try:
gbt.catalog.load("journals/ijgt/nau2004/sec4")
gbt.catalog.load("journals/ijgt/nau2004/sec5")
If sec5 takes too long for stop_after=None, feel free to set it otherwise.
Thanks.
|
@rahulsavani Further to our in-person conversation, indeed it looks like we never got around to doing strategy versions of tests for |
…yer unique Nash (nau2004 sec4), 2x2x2 3 pure Nash (nau2004 sec5)
|
I've added the 3 test you requested, the two from the catalog and the coordination game for n=3 (I think this is what you meant as this one has 7 eq and n=4 has 15?). The coordination game test was already in the behavior tests for enumpoly, so I added the use_strategic parameter for this test |
You are right I have an "off by one error" with my reference to the dimensions of the coordination game: n=3 is good. |
|
https://github.com/all-contributors please add @ameliekleber for code |
This is more like a regression test because I am not sure that we should only get the pure here -- or is this clear to you? |
rahulsavani
left a comment
There was a problem hiding this comment.
Looks good.
One minor thing is flake8 -- please install pre-commit, which will help with this.
For a quick look at the required changes in this case, please see what co-pilot did in PR #972
This PR adds a test for the enumpoly solver that covers the 2x2x2 max cut normal form game, ensuring it returns the two pure and one mixed equilibirum.