Skip to content

Commit fc4ccf0

Browse files
committed
removed create_2x2x2_nfg from games.py
1 parent 6dbc0d0 commit fc4ccf0

6 files changed

Lines changed: 1488 additions & 763 deletions

File tree

tests/games.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,6 @@ def create_2x2_zero_nfg() -> gbt.Game:
6666
return game
6767

6868

69-
def create_2x2x2_nfg() -> gbt.Game:
70-
"""
71-
- This comes from a local max cut instance:
72-
players {1,2,3} are nodes; edge weight{1,2} = 2; weight{1,3} = -1; weight{2,3} = 2
73-
- Pure strategies {a,b} encode if respective player is on left or right of the cut
74-
- The payoff to a player is the sum of their incident edges across the implied cut
75-
- Pure equilibrium iff local max cuts; in addition, uniform mixture is an equilibrium
76-
- Equilibrium analysis for pure profiles:
77-
a a a: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
78-
b a a: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
79-
a b a: 2 4 2 -- Nash (global max cut)
80-
b b a: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
81-
a a b: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
82-
b a b: 2 4 2 -- Nash (global max cut)
83-
a b b: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
84-
b b b: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
85-
"""
86-
return read_from_file("2x2x2_nfg_with_two_pure_one_mixed_eq.nfg")
87-
88-
8969
def create_coord_4x4_nfg(outcome_version: bool = False) -> gbt.Game:
9070
"""
9171
Returns
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
NFG 1 R "2x2x2 game with 2 pure and 1 mixed equilibrium"
2+
{ "Player 1" "Player 2" "Player 3" } { 2 2 2 }
3+
"
4+
- This comes from a local max cut instance:
5+
players {1,2,3} are nodes; edge weight{1,2} = 2; weight{1,3} = -1; weight{2,3} = 2
6+
- Pure strategies {a,b} encode if respective player is on left or right of the cut
7+
- The payoff to a player is the sum of their incident edges across the implied cut
8+
- Pure equilibrium iff local max cuts; in addition, uniform mixture is an equilibrium
9+
- Equilibrium analysis for pure profiles:
10+
a a a: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
11+
b a a: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
12+
a b a: 2 4 2 -- Nash (global max cut)
13+
b b a: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
14+
a a b: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
15+
b a b: 2 4 2 -- Nash (global max cut)
16+
a b b: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
17+
b b b: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
18+
"
19+
20+
0 0 0 1 2 -1 2 4 2 -1 2 1 -1 2 1 2 4 2 1 2 -1 0 0 0

tests/test_games/2x2x2_nfg_with_two_pure_one_mixed_eq.nfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/test_io.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def test_read_efg(game_path):
1616

1717

1818
def test_read_efg_invalid():
19-
game_path = os.path.join("tests", "test_games", "2x2x2_nfg_with_two_pure_one_mixed_eq.nfg")
19+
game_path = os.path.join(
20+
"tests", "test_games", "2x2x2_nfg_from_local_max_cut_2_pure_1_mixed_eq.nfg"
21+
)
2022
with pytest.raises(ValueError):
2123
gbt.read_efg(game_path)
2224

@@ -40,13 +42,17 @@ def test_read_agg(game_path):
4042

4143

4244
def test_read_agg_invalid():
43-
game_path = os.path.join("tests", "test_games", "2x2x2_nfg_with_two_pure_one_mixed_eq.nfg")
45+
game_path = os.path.join(
46+
"tests", "test_games", "2x2x2_nfg_from_local_max_cut_2_pure_1_mixed_eq.nfg"
47+
)
4448
with pytest.raises(ValueError):
4549
gbt.read_agg(game_path)
4650

4751

4852
def test_read_gbt_invalid():
49-
game_path = os.path.join("tests", "test_games", "2x2x2_nfg_with_two_pure_one_mixed_eq.nfg")
53+
game_path = os.path.join(
54+
"tests", "test_games", "2x2x2_nfg_from_local_max_cut_2_pure_1_mixed_eq.nfg"
55+
)
5056
with pytest.raises(ValueError):
5157
gbt.read_gbt(game_path)
5258

@@ -116,16 +122,18 @@ def test_read_write_efg():
116122
def test_read_write_nfg():
117123
nfg_game = create_2x2_zero_nfg()
118124
serialized_nfg_game = nfg_game.to_nfg()
119-
deserialized_nfg_game = gbt.read_nfg(io.BytesIO(serialized_nfg_game.encode()),
120-
normalize_labels=False)
125+
deserialized_nfg_game = gbt.read_nfg(
126+
io.BytesIO(serialized_nfg_game.encode()), normalize_labels=False
127+
)
121128
double_serialized_nfg_game = deserialized_nfg_game.to_nfg()
122129
assert serialized_nfg_game == double_serialized_nfg_game
123130

124131

125132
def test_read_write_nfg_normalize():
126133
nfg_game = create_2x2_zero_nfg()
127134
serialized_nfg_game = nfg_game.to_nfg()
128-
deserialized_nfg_game = gbt.read_nfg(io.BytesIO(serialized_nfg_game.encode()),
129-
normalize_labels=True)
135+
deserialized_nfg_game = gbt.read_nfg(
136+
io.BytesIO(serialized_nfg_game.encode()), normalize_labels=True
137+
)
130138
double_serialized_nfg_game = deserialized_nfg_game.to_nfg()
131139
assert serialized_nfg_game != double_serialized_nfg_game

0 commit comments

Comments
 (0)