How to use the nashpy.algorithms.support_enumeration.potential_support_pairs 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([
            [52.46337363, 69.47195938, 0.0, 54.14372075],
            [77.0, 88.0, 84.85714286, 92.4],
            [77.78571429, 87.35294118, 93.5, 91.38461538],
            [66.37100751, 43.4530444, 0.0, 60.36191831],
        ])
        B = np.array([
            [23.52690518, 17.35459006, 88.209, 20.8021711],
            [16.17165, 0.0, 14.00142857, 6.46866],
            [0.0, 5.76529412, 0.0, 0.0],
            [15.68327304, 40.68156322, 84.00857143, 11.06596804],
        ])
        number_of_potential_supports = len(list(potential_support_pairs(A, B)))
        assert number_of_potential_supports == 225
github drvinceknight / Nashpy / tests / unit / test_support_enumeration.py View on Github external
def test_potential_supports_with_non_degenerate_flag(self):
        """Test for the enumeration of potential supports when constrained to
        non degenerate games"""
        A = np.array([[1, 0], [-2, 3]])
        B = np.array([[3, 2], [-1, 0]])
        self.assertEqual(
            list(potential_support_pairs(A, B, non_degenerate=True)),
            [
                ((0,), (0,)),
                ((0,), (1,)),
                ((1,), (0,)),
                ((1,), (1,)),
                ((0, 1), (0, 1)),
            ],
        )

        A = np.array([[1, 0, 2], [-2, 3, 9]])
        B = np.array([[3, 2, 1], [-1, 0, 2]])
        self.assertEqual(
            list(potential_support_pairs(A, B, non_degenerate=True)),
            [
                ((0,), (0,)),
                ((0,), (1,)),