def test_tol(self): # Prisoners' Dilemma game with one NE and one epsilon NE epsilon = 1e-08 PD_bimatrix = [[(1, 1), (-2, 1 + epsilon)], [(1 + epsilon, -2), (0, 0)]] NEs = [(1, 1)] epsilon_NEs = [(1, 1), (0, 0)] g = NormalFormGame(PD_bimatrix) for tol, answer in zip([0, epsilon], [NEs, epsilon_NEs]): assert_(sorted(pure_nash_brute(g, tol=tol)) == sorted(answer))
def test_tol(self): # Prisoners' Dilemma game with one NE and one epsilon NE epsilon = 1e-08 PD_bimatrix = [[(1, 1), (-2, 1 + epsilon)], [(1 + epsilon, -2), (0, 0)]] NEs = [(1, 1)] epsilon_NEs = [(1, 1), (0, 0)] g = NormalFormGame(PD_bimatrix) for tol, answer in zip([0, epsilon], [NEs, epsilon_NEs]): eq_(sorted(pure_nash_brute(g, tol=tol)), sorted(answer))
def test_redraw(self): seed = 1 n = 2 g = unit_vector_game(n, avoid_pure_nash=True, random_state=seed) NEs = pure_nash_brute(g, tol=0) assert_(len(NEs) == 0)
def test_avoid_pure_nash(self): NEs = pure_nash_brute(unit_vector_game(self.n, avoid_pure_nash=True), tol=0) assert_(len(NEs) == 0)
def test_brute_force(self): for d in self.game_dicts: assert_(sorted(pure_nash_brute(d['g'])) == sorted(d['NEs']))
def test_redraw(self): seed = 1 n = 2 g = unit_vector_game(n, avoid_pure_nash=True, random_state=seed) NEs = pure_nash_brute(g, tol=0) eq_(len(NEs), 0)
def test_avoid_pure_nash(self): NEs = pure_nash_brute(unit_vector_game(self.n, avoid_pure_nash=True), tol=0) eq_(len(NEs), 0)
def test_brute_force(self): for d in self.game_dicts: eq_(sorted(pure_nash_brute(d['g'])), sorted(d['NEs']))