How to use the nashpy.algorithms.support_enumeration.solve_indifference 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_support_enumeration.py View on Github external
A = np.array([[0, 1, -1], [1, 0, 1], [-1, 1, 0]])

        rows = [0, 1]
        columns = [0, 1]
        self.assertTrue(
            np.array_equal(
                solve_indifference(A, rows, columns), np.array([0.5, 0.5, 0.0])
            )
        )

        rows = [1, 2]
        columns = [0, 1]
        self.assertTrue(
            all(
                np.isclose(
                    solve_indifference(A, rows, columns),
                    np.array([1 / 3, 2 / 3, 0.0]),
                )
            )
        )

        rows = [0, 2]
        columns = [0, 1]
        self.assertTrue(
            np.array_equal(
                solve_indifference(A, rows, columns), np.array([0.0, 1.0, 0.0])
            )
        )

        rows = [0, 1, 2]
        columns = [0, 1, 2]
        self.assertTrue(
github drvinceknight / Nashpy / tests / unit / test_support_enumeration.py View on Github external
def test_solve_indifference(self):
        """Test solve indifference"""
        A = np.array([[0, 1, -1], [1, 0, 1], [-1, 1, 0]])

        rows = [0, 1]
        columns = [0, 1]
        self.assertTrue(
            np.array_equal(
                solve_indifference(A, rows, columns), np.array([0.5, 0.5, 0.0])
            )
        )

        rows = [1, 2]
        columns = [0, 1]
        self.assertTrue(
            all(
                np.isclose(
                    solve_indifference(A, rows, columns),
                    np.array([1 / 3, 2 / 3, 0.0]),
                )
            )
        )

        rows = [0, 2]
        columns = [0, 1]