How to use the nashpy.integer_pivoting.integer_pivoting.make_tableau function in nashpy

To help you get started, we’ve selected a few nashpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drvinceknight / Nashpy / tests / unit / test_integer_pivoting.py View on Github external
def test_creation_of_tableaux(self, M):
        tableau = make_tableau(M)
        number_of_strategies, dimension = M.shape
        self.assertEqual(tableau.shape,
                         (number_of_strategies,
                          number_of_strategies + dimension + 1))
        self.assertTrue(np.array_equal(tableau[:, dimension:-1],
                                       np.eye(number_of_strategies)))
        self.assertTrue(np.array_equal(tableau[:, -1],
                                       np.ones(number_of_strategies)))
github drvinceknight / Nashpy / tests / unit / test_integer_pivoting.py View on Github external
def test_creationg_of_particular_tableaux(self):
        M = np.array([[3, 3],
                      [2, 5],
                      [0, 6]])
        expected_tableau = np.array([[ 3.,  3.,  1.,  0.,  0.,  1.],
                                     [ 2.,  5.,  0.,  1.,  0.,  1.],
                                     [ 0.,  6.,  0.,  0.,  1.,  1.]])
        tableau = make_tableau(M)
        self.assertTrue(np.array_equal(tableau, expected_tableau))

        M = np.array([[3, 2, 3],
                      [2, 6, 1]])
        expected_tableau = np.array([[ 3.,  2.,  3.,  1.,  0.,  1.],
                                     [ 2.,  6.,  1.,  0.,  1.,  1.]])
        tableau = make_tableau(M)
        self.assertTrue(np.array_equal(tableau, expected_tableau))