# Unit tests


import unittest


def run_test_instance(unittestinstance, profile, committeesize, tests):
    import rules_approval

    # all rules used?
    for rule in rules_approval.MWRULES:
        unittestinstance.assertTrue(rule in tests.keys())

    for rule in tests.keys():

        output = rules_approval.compute_rule(rule, profile,
                                             committeesize,
                                             resolute=False)
        unittestinstance.assertEqual(
            output, tests[rule], msg=rules_approval.MWRULES[rule] + " failed")
        output = rules_approval.compute_rule(
            rule, profile, committeesize, resolute=True)
        unittestinstance.assertEqual(
            len(output), 1,
            msg=rules_approval.MWRULES[rule] + " failed with resolute=True")
        unittestinstance.assertTrue(
            output[0] in tests[rule],
            msg=rules_approval.MWRULES[rule] + " failed with resolute=True")


class TestApprovalMultiwinner(unittest.TestCase):
    def test_createprofiles(self):
        from preferences import Profile
        from preferences import DichotomousPreferences
        num_cand = 7
        prof = Profile(num_cand)
        self.assertEqual(prof.add_preferences(
            DichotomousPreferences([0, 4, 5])),
            None)
        with self.assertRaises(Exception):
            prof.add_preferences(DichotomousPreferences([num_cand]))
        with self.assertRaises(Exception):
            prof.add_preferences(DichotomousPreferences([-1]))
        self.assertEqual(prof.add_preferences([0, 4, 5]), None)
        with self.assertRaises(Exception):
            prof.add_preferences([0, 4, 5, "1"])
        with self.assertRaises(Exception):
            prof.add_preferences(["1", 0, 4, 5])
        p1 = DichotomousPreferences([0, 4, 5])
        p2 = DichotomousPreferences([1, 2])
        self.assertEqual(prof.add_preferences([p1, p2]), None)
        self.assertTrue(prof.has_unit_weights())
        prof.add_preferences(DichotomousPreferences([0, 4, 5], 2.4))
        self.assertFalse(prof.has_unit_weights())
        self.assertEqual(prof.totalweight(), 6.4)

    def test_mwrules__toofewcandidates(self):
        from preferences import Profile
        import rules_approval
        profile = Profile(5)
        committeesize = 4
        preflist = [[0, 1, 2], [1], [1, 2], [0]]
        profile.add_preferences(preflist)

        for rule in rules_approval.MWRULES.keys():
            with self.assertRaises(Exception):
                rules_approval.compute_rule(rule, profile, committeesize)
            with self.assertRaises(Exception):
                rules_approval.compute_rule(rule, profile,
                                            committeesize, resolute=True)

    def test_mwrules_weightsconsidered(self):
        from preferences import Profile
        from preferences import DichotomousPreferences
        import rules_approval

        self.longMessage = True

        profile = Profile(3)
        profile.add_preferences(DichotomousPreferences([0]))
        profile.add_preferences(DichotomousPreferences([0]))
        profile.add_preferences(DichotomousPreferences([1], 5))
        profile.add_preferences(DichotomousPreferences([0]))
        committeesize = 1

        for rule in rules_approval.MWRULES.keys():
            if "monroe" in rule or "rule-x" in rule:
                # Monroe and rule x only work with unit weights:
                continue
            result = rules_approval.compute_rule(rule, profile, committeesize)
            self.assertTrue([1] in result,
                            msg=rule + " failed"+str(result))

    def test_mwrules_correct_simple(self):
        from preferences import Profile
        import rules_approval

        self.longMessage = True

        profile = Profile(4)
        profile.add_preferences([[0], [1], [2], [3]])
        committeesize = 2

        for rule in rules_approval.MWRULES.keys():
            if rule == "greedy-monroe":   # always returns one committee
                continue
            self.assertEqual(len(rules_approval.compute_rule(rule, profile,
                                                             committeesize)),
                             6, msg=rule + " failed")

        for rule in rules_approval.MWRULES.keys():
            self.assertEqual(len(rules_approval.compute_rule(rule, profile,
                                                             committeesize,
                                                             resolute=True)),
                             1, msg=rule + " failed with resolute=True")

    def test_monroe_indivisible(self):
        from preferences import Profile
        import rules_approval

        self.longMessage = True

        profile = Profile(4)
        profile.add_preferences([[0], [0], [0], [1, 2], [1, 2], [1], [3]])
        committeesize = 3

        for ilp in [True, False]:
            # max Monroe score is 6 (even for committee [0, 1, 3])
            self.assertEqual(
                rules_approval.compute_monroe(profile, committeesize,
                                              ilp=ilp, resolute=False),
                [[0, 1, 2], [0, 1, 3], [0, 2, 3]])

    # this test shows that tiebreaking is not (yet)
    # implemented for opt-Phragmen
    def test_optphrag_notiebreaking(self):
        from preferences import Profile
        from rules_approval import compute_rule

        self.longMessage = True

        profile = Profile(6)
        profile.add_preferences([[0], [0], [1, 3], [1, 3], [1, 4],
                                 [2, 4], [2, 5], [2, 5]])
        committeesize = 3

        self.assertEqual(
                len(compute_rule("optphrag", profile, committeesize,
                                 resolute=False)),
                12)

    def test_mwrules_correct_advanced_1(self):

        from preferences import Profile
        self.longMessage = True
        committeesize = 4

        profile = Profile(6)
        preflist = [[0, 4, 5], [0], [1, 4, 5], [1],
                    [2, 4, 5], [2], [3, 4, 5], [3]]
        profile.add_preferences(preflist)

        tests1 = {
            "seqpav": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                       [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "av": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                   [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "sav": [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 2, 5], [0, 1, 3, 4],
                    [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 4], [0, 2, 3, 5],
                    [0, 2, 4, 5], [0, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 5],
                    [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "pav-ilp": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                        [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "pav-noilp": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                          [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "revseqpav": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                          [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "minimaxav-noilp": [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 2, 5],
                                [0, 1, 3, 4], [0, 1, 3, 5], [0, 1, 4, 5],
                                [0, 2, 3, 4], [0, 2, 3, 5], [0, 2, 4, 5],
                                [0, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 5],
                                [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "minimaxav-ilp": [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 2, 5],
                              [0, 1, 3, 4], [0, 1, 3, 5], [0, 1, 4, 5],
                              [0, 2, 3, 4], [0, 2, 3, 5], [0, 2, 4, 5],
                              [0, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 5],
                              [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "phrag": [[0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5],
                      [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]],
            "optphrag": [[0, 1, 2, 3]],
            "cc-ilp": [[0, 1, 2, 3]],
            "cc-noilp": [[0, 1, 2, 3]],
            "seqcc": [[0, 1, 2, 4], [0, 1, 2, 5], [0, 1, 3, 4], [0, 1, 3, 5],
                      [0, 2, 3, 4], [0, 2, 3, 5], [1, 2, 3, 4], [1, 2, 3, 5]],
            "revseqcc": [[0, 1, 2, 3]],
            "monroe-ilp": [[0, 1, 2, 3]],
            "monroe-noilp": [[0, 1, 2, 3]],
            "greedy-monroe": [[0, 2, 3, 4]],
            "slav-ilp": [[0, 1, 2, 3],
                         [0, 1, 2, 4], [0, 1, 2, 5],
                         [0, 1, 3, 4], [0, 1, 3, 5],
                         [0, 2, 3, 4], [0, 2, 3, 5],
                         [1, 2, 3, 4], [1, 2, 3, 5]],
            "slav-noilp": [[0, 1, 2, 3],
                           [0, 1, 2, 4], [0, 1, 2, 5],
                           [0, 1, 3, 4], [0, 1, 3, 5],
                           [0, 2, 3, 4], [0, 2, 3, 5],
                           [1, 2, 3, 4], [1, 2, 3, 5]],
            "seqslav": [[0, 1, 2, 4], [0, 1, 2, 5],
                        [0, 1, 3, 4], [0, 1, 3, 5],
                        [0, 2, 3, 4], [0, 2, 3, 5],
                        [1, 2, 3, 4], [1, 2, 3, 5]],
            "rule-x": [[0, 1, 4, 5], [0, 2, 4, 5],
                       [0, 3, 4, 5], [1, 2, 4, 5],
                       [1, 3, 4, 5], [2, 3, 4, 5]],
            "phragmen-enestroem": [[0, 1, 4, 5], [0, 2, 4, 5],
                                   [0, 3, 4, 5], [1, 2, 4, 5],
                                   [1, 3, 4, 5], [2, 3, 4, 5]],
        }

        run_test_instance(self, profile, committeesize, tests1)

        # and now with reversed preflist
        preflist.reverse()
        for p in preflist:
            p.reverse()
        profile = Profile(6)
        profile.add_preferences(preflist)

        run_test_instance(self, profile, committeesize, tests1)

    def test_mwrules_correct_advanced_2(self):

        from preferences import Profile
        self.longMessage = True

        # and another profile
        profile = Profile(5)
        committeesize = 3
        preflist = [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2],
                    [0, 1, 2], [0, 1], [3, 4], [3, 4], [3]]
        profile.add_preferences(preflist)

        tests2 = {
            "seqpav": [[0, 1, 3]],
            "av": [[0, 1, 2]],
            "sav": [[0, 1, 3]],
            "pav-ilp": [[0, 1, 3]],
            "pav-noilp": [[0, 1, 3]],
            "revseqpav": [[0, 1, 3]],
            "minimaxav-noilp": [[0, 1, 3], [0, 2, 3], [1, 2, 3]],
            "minimaxav-ilp": [[0, 1, 3], [0, 2, 3], [1, 2, 3]],
            "phrag": [[0, 1, 3]],
            "optphrag": [[0, 1, 3], [0, 2, 3], [1, 2, 3]],
            "cc-ilp": [[0, 1, 3], [0, 2, 3], [0, 3, 4],
                       [1, 2, 3], [1, 3, 4]],
            "cc-noilp": [[0, 1, 3], [0, 2, 3], [0, 3, 4],
                         [1, 2, 3], [1, 3, 4]],
            "seqcc": [[0, 1, 3], [0, 2, 3], [0, 3, 4],
                      [1, 2, 3], [1, 3, 4]],
            "revseqcc": [[0, 1, 3], [0, 2, 3], [0, 3, 4],
                         [1, 2, 3], [1, 3, 4]],
            "monroe-ilp": [[0, 1, 3], [0, 2, 3], [1, 2, 3]],
            "monroe-noilp": [[0, 1, 3], [0, 2, 3], [1, 2, 3]],
            "greedy-monroe": [[0, 1, 3]],
            "seqslav": [[0, 1, 3]],
            "slav-ilp": [[0, 1, 3]],
            "slav-noilp": [[0, 1, 3]],
            "rule-x": [[0, 1, 3]],
            "phragmen-enestroem": [[0, 1, 3]],
        }

        run_test_instance(self, profile, committeesize, tests2)

    def test_mwrules_correct_advanced_3(self):

        from preferences import Profile
        self.longMessage = True

        # and a third profile
        profile = Profile(6)
        committeesize = 4
        preflist = [[0, 3, 4, 5], [1, 2], [0, 2, 5], [2],
                    [0, 1, 2, 3, 4], [0, 3, 4], [0, 2, 4], [0, 1]]
        profile.add_preferences(preflist)

        tests3 = {
            "seqpav": [[0, 1, 2, 4]],
            "av": [[0, 1, 2, 4], [0, 2, 3, 4]],
            "sav": [[0, 1, 2, 4]],
            "pav-ilp": [[0, 1, 2, 4]],
            "pav-noilp": [[0, 1, 2, 4]],
            "revseqpav": [[0, 1, 2, 4]],
            "minimaxav-noilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                                [0, 2, 3, 4], [0, 2, 3, 5],
                                [0, 2, 4, 5]],
            "minimaxav-ilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                              [0, 2, 3, 4], [0, 2, 3, 5],
                              [0, 2, 4, 5]],
            "phrag": [[0, 1, 2, 4]],
            "optphrag": [[0, 1, 2, 3], [0, 1, 2, 4],
                         [0, 1, 2, 5], [0, 2, 3, 4],
                         [0, 2, 3, 5], [0, 2, 4, 5],
                         [1, 2, 3, 4], [1, 2, 3, 5],
                         [1, 2, 4, 5]],
            "cc-ilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                       [0, 1, 2, 5], [0, 2, 3, 4],
                       [0, 2, 3, 5], [0, 2, 4, 5],
                       [1, 2, 3, 4], [1, 2, 3, 5],
                       [1, 2, 4, 5]],
            "cc-noilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                         [0, 1, 2, 5], [0, 2, 3, 4],
                         [0, 2, 3, 5], [0, 2, 4, 5],
                         [1, 2, 3, 4], [1, 2, 3, 5],
                         [1, 2, 4, 5]],
            "seqcc": [[0, 1, 2, 3], [0, 1, 2, 4],
                      [0, 1, 2, 5], [0, 2, 3, 4],
                      [0, 2, 3, 5], [0, 2, 4, 5]],
            "revseqcc": [[0, 1, 2, 3], [0, 1, 2, 4],
                         [0, 1, 2, 5], [0, 2, 3, 4],
                         [0, 2, 3, 5], [0, 2, 4, 5],
                         [1, 2, 3, 4], [1, 2, 3, 5],
                         [1, 2, 4, 5]],
            "monroe-ilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                           [0, 1, 2, 5], [0, 2, 3, 4],
                           [0, 2, 3, 5], [0, 2, 4, 5],
                           [1, 2, 3, 4], [1, 2, 3, 5],
                           [1, 2, 4, 5]],
            "monroe-noilp": [[0, 1, 2, 3], [0, 1, 2, 4],
                             [0, 1, 2, 5], [0, 2, 3, 4],
                             [0, 2, 3, 5], [0, 2, 4, 5],
                             [1, 2, 3, 4], [1, 2, 3, 5],
                             [1, 2, 4, 5]],
            "greedy-monroe": [[0, 1, 2, 3]],
            "seqslav": [[0, 1, 2, 4]],
            "slav-ilp": [[0, 1, 2, 4]],
            "slav-noilp": [[0, 1, 2, 4]],
            "rule-x": [[0, 1, 2, 4]],
            "phragmen-enestroem": [[0, 1, 2, 4]],
        }

        run_test_instance(self, profile, committeesize, tests3)

    def test_monroescore(self):
        from preferences import Profile
        from score_functions import monroescore_flowbased, monroescore_matching
        self.longMessage = True

        # and a third profile
        profile = Profile(6)
        preflist = [[0, 1], [1], [1, 3], [4], [2], [1, 5, 3]]
        profile.add_preferences(preflist)

        self.assertEqual(monroescore_flowbased(profile, [1, 3, 2]), 5)
        self.assertEqual(monroescore_matching(profile, [1, 3, 2]), 5)
        self.assertEqual(monroescore_flowbased(profile, [2, 1, 5]), 4)
        self.assertEqual(monroescore_matching(profile, [2, 1, 5]), 4)
        self.assertEqual(monroescore_flowbased(profile, [2, 4, 5]), 3)
        self.assertEqual(monroescore_matching(profile, [2, 5, 4]), 3)


if __name__ == '__main__':
    unittest.main()

[((15333, 15348), 'unittest.main', 'unittest.main', ([], {}), '()\n', (15346, 15348), False, 'import unittest\n'), ((301, 374), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {'resolute': '(False)'}), '(rule, profile, committeesize, resolute=False)\n', (328, 374), False, 'import rules_approval\n'), ((599, 671), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {'resolute': '(True)'}), '(rule, profile, committeesize, resolute=True)\n', (626, 671), False, 'import rules_approval\n'), ((1198, 1215), 'preferences.Profile', 'Profile', (['num_cand'], {}), '(num_cand)\n', (1205, 1215), False, 'from preferences import Profile\n'), ((1808, 1841), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0, 4, 5]'], {}), '([0, 4, 5])\n', (1830, 1841), False, 'from preferences import DichotomousPreferences\n'), ((1855, 1885), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[1, 2]'], {}), '([1, 2])\n', (1877, 1885), False, 'from preferences import DichotomousPreferences\n'), ((2302, 2312), 'preferences.Profile', 'Profile', (['(5)'], {}), '(5)\n', (2309, 2312), False, 'from preferences import Profile\n'), ((2451, 2480), 'rules_approval.MWRULES.keys', 'rules_approval.MWRULES.keys', ([], {}), '()\n', (2478, 2480), False, 'import rules_approval\n'), ((3007, 3017), 'preferences.Profile', 'Profile', (['(3)'], {}), '(3)\n', (3014, 3017), False, 'from preferences import Profile\n'), ((3312, 3341), 'rules_approval.MWRULES.keys', 'rules_approval.MWRULES.keys', ([], {}), '()\n', (3339, 3341), False, 'import rules_approval\n'), ((3836, 3846), 'preferences.Profile', 'Profile', (['(4)'], {}), '(4)\n', (3843, 3846), False, 'from preferences import Profile\n'), ((3948, 3977), 'rules_approval.MWRULES.keys', 'rules_approval.MWRULES.keys', ([], {}), '()\n', (3975, 3977), False, 'import rules_approval\n'), ((4306, 4335), 'rules_approval.MWRULES.keys', 'rules_approval.MWRULES.keys', ([], {}), '()\n', (4333, 4335), False, 'import rules_approval\n'), ((4802, 4812), 'preferences.Profile', 'Profile', (['(4)'], {}), '(4)\n', (4809, 4812), False, 'from preferences import Profile\n'), ((5510, 5520), 'preferences.Profile', 'Profile', (['(6)'], {}), '(6)\n', (5517, 5520), False, 'from preferences import Profile\n'), ((6005, 6015), 'preferences.Profile', 'Profile', (['(6)'], {}), '(6)\n', (6012, 6015), False, 'from preferences import Profile\n'), ((9721, 9731), 'preferences.Profile', 'Profile', (['(6)'], {}), '(6)\n', (9728, 9731), False, 'from preferences import Profile\n'), ((10009, 10019), 'preferences.Profile', 'Profile', (['(5)'], {}), '(5)\n', (10016, 10019), False, 'from preferences import Profile\n'), ((11684, 11694), 'preferences.Profile', 'Profile', (['(6)'], {}), '(6)\n', (11691, 11694), False, 'from preferences import Profile\n'), ((14761, 14771), 'preferences.Profile', 'Profile', (['(6)'], {}), '(6)\n', (14768, 14771), False, 'from preferences import Profile\n'), ((2027, 2065), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0, 4, 5]', '(2.4)'], {}), '([0, 4, 5], 2.4)\n', (2049, 2065), False, 'from preferences import DichotomousPreferences\n'), ((3050, 3077), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0]'], {}), '([0])\n', (3072, 3077), False, 'from preferences import DichotomousPreferences\n'), ((3111, 3138), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0]'], {}), '([0])\n', (3133, 3138), False, 'from preferences import DichotomousPreferences\n'), ((3172, 3202), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[1]', '(5)'], {}), '([1], 5)\n', (3194, 3202), False, 'from preferences import DichotomousPreferences\n'), ((3236, 3263), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0]'], {}), '([0])\n', (3258, 3263), False, 'from preferences import DichotomousPreferences\n'), ((3507, 3564), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {}), '(rule, profile, committeesize)\n', (3534, 3564), False, 'import rules_approval\n'), ((14902, 14943), 'score_functions.monroescore_flowbased', 'monroescore_flowbased', (['profile', '[1, 3, 2]'], {}), '(profile, [1, 3, 2])\n', (14923, 14943), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((14973, 15013), 'score_functions.monroescore_matching', 'monroescore_matching', (['profile', '[1, 3, 2]'], {}), '(profile, [1, 3, 2])\n', (14993, 15013), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((15043, 15084), 'score_functions.monroescore_flowbased', 'monroescore_flowbased', (['profile', '[2, 1, 5]'], {}), '(profile, [2, 1, 5])\n', (15064, 15084), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((15114, 15154), 'score_functions.monroescore_matching', 'monroescore_matching', (['profile', '[2, 1, 5]'], {}), '(profile, [2, 1, 5])\n', (15134, 15154), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((15184, 15225), 'score_functions.monroescore_flowbased', 'monroescore_flowbased', (['profile', '[2, 4, 5]'], {}), '(profile, [2, 4, 5])\n', (15205, 15225), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((15255, 15295), 'score_functions.monroescore_matching', 'monroescore_matching', (['profile', '[2, 5, 4]'], {}), '(profile, [2, 5, 4])\n', (15275, 15295), False, 'from score_functions import monroescore_flowbased, monroescore_matching\n'), ((1275, 1308), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[0, 4, 5]'], {}), '([0, 4, 5])\n', (1297, 1308), False, 'from preferences import DichotomousPreferences\n'), ((1405, 1439), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[num_cand]'], {}), '([num_cand])\n', (1427, 1439), False, 'from preferences import DichotomousPreferences\n'), ((1517, 1545), 'preferences.DichotomousPreferences', 'DichotomousPreferences', (['[-1]'], {}), '([-1])\n', (1539, 1545), False, 'from preferences import DichotomousPreferences\n'), ((2545, 2602), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {}), '(rule, profile, committeesize)\n', (2572, 2602), False, 'import rules_approval\n'), ((2666, 2738), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {'resolute': '(True)'}), '(rule, profile, committeesize, resolute=True)\n', (2693, 2738), False, 'import rules_approval\n'), ((5062, 5140), 'rules_approval.compute_monroe', 'rules_approval.compute_monroe', (['profile', 'committeesize'], {'ilp': 'ilp', 'resolute': '(False)'}), '(profile, committeesize, ilp=ilp, resolute=False)\n', (5091, 5140), False, 'import rules_approval\n'), ((5719, 5783), 'rules_approval.compute_rule', 'compute_rule', (['"""optphrag"""', 'profile', 'committeesize'], {'resolute': '(False)'}), "('optphrag', profile, committeesize, resolute=False)\n", (5731, 5783), False, 'from rules_approval import compute_rule\n'), ((4110, 4167), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {}), '(rule, profile, committeesize)\n', (4137, 4167), False, 'import rules_approval\n'), ((4370, 4442), 'rules_approval.compute_rule', 'rules_approval.compute_rule', (['rule', 'profile', 'committeesize'], {'resolute': '(True)'}), '(rule, profile, committeesize, resolute=True)\n', (4397, 4442), False, 'import rules_approval\n')]