@@ -217,66 +217,6 @@ def test_enumpoly_ordered_behavior(
217217 assert abs (eq [p ][i ][a ] - expected [p ][i ][a ]) <= TOL
218218
219219
220- @pytest .mark .nash
221- @pytest .mark .nash_enumpoly_behavior
222- @pytest .mark .parametrize (
223- "game,mixed_behav_prof_data,stop_after" ,
224- [
225- ##############################################################################
226- ##############################################################################
227- (
228- games .create_3_player_with_internal_outcomes_efg (),
229- [
230- [[[1 , 0 ], [1 , 0 ]], [[1 , 0 ], ["1/2" , "1/2" ]], [[1 , 0 ], [0 , 1 ]]],
231- [[[1 , 0 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]], [[1 , 0 ], ["1/3" , "2/3" ]]],
232- ],
233- 2 ,
234- ),
235- (
236- games .create_3_player_with_internal_outcomes_efg (nonterm_outcomes = True ),
237- [
238- [[[1 , 0 ], [1 , 0 ]], [[1 , 0 ], ["1/2" , "1/2" ]], [[1 , 0 ], [0 , 1 ]]],
239- [[[1 , 0 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]], [[1 , 0 ], ["1/3" , "2/3" ]]]],
240- 2 ,
241- ),
242- ##############################################################################
243- ##############################################################################
244- ],
245- )
246- def test_enumpoly_ordered_behavior_PROBLEM_CASE (
247- game : gbt .Game , mixed_behav_prof_data : list , stop_after : None | int
248- ):
249- """Test calls of enumpoly for mixed behavior equilibria,
250- using max_regret and agent_max_regret (internal consistency); and
251- comparison to a set of previously computed equilibria with this function (regression test).
252- This set will be the full set of all computed equilibria if stop_after is None,
253- else the first stop_after-many equilibria.
254-
255- This is the "ordered" version where we test for the outputs coming in a specific
256- order; there is also an "unordered" version. The game 2x2x2.nfg, for example,
257- has a point at which the Jacobian is singular. As a result, the order in which it
258- returns the two totally-mixed equilbria is system-dependent due, essentially,
259- to inherent numerical instability near that point.
260- """
261- if stop_after :
262- result = gbt .nash .enumpoly_solve (
263- game , use_strategic = False , stop_after = stop_after , maxregret = 0.00001
264- )
265- assert len (result .equilibria ) == stop_after
266- else :
267- # compute all
268- result = gbt .nash .enumpoly_solve (game , use_strategic = False )
269- assert len (result .equilibria ) == len (mixed_behav_prof_data )
270- for eq , exp in zip (result .equilibria , mixed_behav_prof_data , strict = True ):
271- assert abs (eq .max_regret ()) <= TOL
272- assert abs (eq .agent_max_regret ()) <= TOL
273- expected = game .mixed_behavior_profile (rational = True , data = exp )
274- for p in game .players :
275- for i in p .infosets :
276- for a in i .actions :
277- assert abs (eq [p ][i ][a ] - expected [p ][i ][a ]) <= TOL
278-
279-
280220@pytest .mark .nash
281221@pytest .mark .nash_enumpoly_behavior
282222@pytest .mark .parametrize (
0 commit comments