def setUp(self):
        # From von Stengel 2007 in Algorithmic Game Theory
        bimatrix = [[(3, 3), (3, 2)],
                    [(2, 2), (5, 6)],
                    [(0, 3), (6, 1)]]
        g = NormalFormGame(bimatrix)

        # Original best reponse polytope for player 0
        vertices_P = np.array([
            [0, 0, 0],       # 0
            [1/3, 0, 0],     # a
            [2/7, 1/14, 0],  # b
            [0, 1/6, 0],     # c
            [0, 1/8, 1/4],   # d
            [0, 0, 1/3]      # e
        ])
        labelings_P = np.array([
            [0, 1, 2],  # 0
            [1, 2, 3],  # a
            [2, 3, 4],  # b
            [0, 2, 4],  # c
            [0, 3, 4],  # d
            [0, 1, 3]   # e
        ])

        # Sort rows lexicographically
        K = labelings_P.shape[1]
        ind = np.lexsort([labelings_P[:, K-k-1] for k in range(K)])
        self.labelings_P = labelings_P[ind]
        self.vertices_P = vertices_P[ind]

        # Translated best reponse polytope for player 0
        self.brp0 = _BestResponsePolytope(g.players[1], idx=0)
    def setup(self):
        # From von Stengel 2007 in Algorithmic Game Theory
        bimatrix = [[(3, 3), (3, 2)], [(2, 2), (5, 6)], [(0, 3), (6, 1)]]
        g = NormalFormGame(bimatrix)

        # Original best response polytope for player 0
        vertices_P = np.array([
            [0, 0, 0],  # 0
            [1 / 3, 0, 0],  # a
            [2 / 7, 1 / 14, 0],  # b
            [0, 1 / 6, 0],  # c
            [0, 1 / 8, 1 / 4],  # d
            [0, 0, 1 / 3]  # e
        ])
        labelings_P = np.array([
            [0, 1, 2],  # 0
            [1, 2, 3],  # a
            [2, 3, 4],  # b
            [0, 2, 4],  # c
            [0, 3, 4],  # d
            [0, 1, 3]  # e
        ])

        # Sort rows lexicographically
        K = labelings_P.shape[1]
        ind = np.lexsort([labelings_P[:, K - k - 1] for k in range(K)])
        self.labelings_P = labelings_P[ind]
        self.vertices_P = vertices_P[ind]

        # Translated best response polytope for player 0
        self.brp0 = _BestResponsePolytope(g.players[1], idx=0)
def test_best_response_polytope_invalid_player_instance():
    bimatrix = [[(3, 3), (3, 2)],
                [(2, 2), (5, 6)],
                [(0, 3), (6, 1)]]
    g = NormalFormGame(bimatrix)
    _BestResponsePolytope(g)
Пример #4
0
def test_best_response_polytope_invalid_player_instance():
    bimatrix = [[(3, 3), (3, 2)], [(2, 2), (5, 6)], [(0, 3), (6, 1)]]
    g = NormalFormGame(bimatrix)
    _BestResponsePolytope(g)