def test_potential_supports(self):
        """Test for the enumeration of potential supports"""
        A = np.array([[1, 0], [-2, 3]])
        B = np.array([[3, 2], [-1, 0]])
        self.assertEqual(list(potential_support_pairs(A, B)),
                         [((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)), [((0, ), (0, )),
                                                            ((0, ), (1, )),
                                                            ((0, ), (2, )),
                                                            ((1, ), (0, )),
                                                            ((1, ), (1, )),
                                                            ((1, ), (2, )),
                                                            ((0, 1), (0, 1)),
                                                            ((0, 1), (0, 2)),
                                                            ((0, 1), (1, 2))])

        A = np.array([[1, 0], [-2, 3], [2, 1]])
        B = np.array([[3, 2], [-1, 0], [5, 2]])
        self.assertEqual(list(potential_support_pairs(A,
                                                      B)), [((0, ), (0, )),
                                                            ((0, ), (1, )),
                                                            ((1, ), (0, )),
                                                            ((1, ), (1, )),
                                                            ((2, ), (0, )),
                                                            ((2, ), (1, )),
                                                            ((0, 1), (0, 1)),
                                                            ((0, 2), (0, 1)),
                                                            ((1, 2), (0, 1))])
Example #2
0
    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, )), ((0, ), (2, )), ((1, ), (0, )),
             ((1, ), (1, )), ((1, ), (2, )), ((0, 1), (0, 1)),
             ((0, 1), (0, 2)), ((0, 1), (1, 2))])

        A = np.array([[1, 0], [-2, 3], [2, 1]])
        B = np.array([[3, 2], [-1, 0], [5, 2]])
        self.assertEqual(
            list(potential_support_pairs(A, B, non_degenerate=True)),
            [((0, ), (0, )), ((0, ), (1, )), ((1, ), (0, )), ((1, ), (1, )),
             ((2, ), (0, )), ((2, ), (1, )), ((0, 1), (0, 1)),
             ((0, 2), (0, 1)), ((1, 2), (0, 1))])
Example #3
0
    def test_potential_supports(self):
        """Test for the enumeration of potential supports"""
        A = np.array([[1, 0], [-2, 3]])
        B = np.array([[3, 2], [-1, 0]])
        self.assertEqual(
            list(potential_support_pairs(A, B)),
            [
                ((0, ), (0, )),
                ((0, ), (1, )),
                ((0, ), (0, 1)),
                ((1, ), (0, )),
                ((1, ), (1, )),
                ((1, ), (0, 1)),
                ((0, 1), (0, )),
                ((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)),
            [
                ((0, ), (0, )),
                ((0, ), (1, )),
                ((0, ), (2, )),
                ((0, ), (0, 1)),
                ((0, ), (0, 2)),
                ((0, ), (1, 2)),
                ((0, ), (0, 1, 2)),
                ((1, ), (0, )),
                ((1, ), (1, )),
                ((1, ), (2, )),
                ((1, ), (0, 1)),
                ((1, ), (0, 2)),
                ((1, ), (1, 2)),
                ((1, ), (0, 1, 2)),
                ((0, 1), (0, )),
                ((0, 1), (1, )),
                ((0, 1), (2, )),
                ((0, 1), (0, 1)),
                ((0, 1), (0, 2)),
                ((0, 1), (1, 2)),
                ((0, 1), (0, 1, 2)),
            ],
        )

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

        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