def test003(self):
        random.seed(2)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)

        self.assertAlmostEqual(mobius.sum(), 1)
Exemple #2
0
    def test003(self):
        random.seed(2)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)

        self.assertAlmostEqual(mobius.sum(), 1)
def generate_random_mobius_indices(criteria, additivity=None, seed=None, k=3):
    cvs = generate_random_capacities(criteria, seed, k)
    mobius = capacities_to_mobius(criteria, cvs)

    if additivity is not None:
        mobius_truncate(mobius, additivity)
        mobius.normalize_sum_to_unity()

    return mobius
Exemple #4
0
    def test005(self):
        random.seed(4)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c, 2)
        mobius = capacities_to_mobius(c, capacities)

        self.assertAlmostEqual(mobius.sum(), 1)
        self.assertTrue(capacities_are_monotone(c, capacities))
        self.assertAlmostEqual(capacities.max(), 1)
    def test005(self):
        random.seed(4)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c, 2)
        mobius = capacities_to_mobius(c, capacities)

        self.assertAlmostEqual(mobius.sum(), 1)
        self.assertTrue(capacities_are_monotone(c, capacities))
        self.assertAlmostEqual(capacities.max(), 1)
Exemple #6
0
    def test001(self):
        random.seed(4)
        c = generate_criteria(3)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)
        capacities2 = mobius_to_capacities(c, mobius)

        mobius_truncate(mobius, 2)

        self.assertEqual(capacities, capacities2)
    def test001(self):
        random.seed(4)
        c = generate_criteria(3)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)
        capacities2 = mobius_to_capacities(c, mobius)

        mobius_truncate(mobius, 2)

        self.assertEqual(capacities, capacities2)
Exemple #8
0
def generate_random_mobius_indices(criteria, additivity = None,
                                   seed = None, k = 3):
    cvs = generate_random_capacities(criteria, seed, k)
    mobius = capacities_to_mobius(criteria, cvs)

    if additivity is not None:
        mobius_truncate(mobius, additivity)
        mobius.normalize_sum_to_unity()

    return mobius
Exemple #9
0
    def test004(self):
        random.seed(3)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)
        mobius_truncate(mobius, 2)
        mobius.normalize_sum_to_unity()
        capacities2 = mobius_to_capacities(c, mobius)

        self.assertAlmostEqual(mobius.sum(), 1)
        self.assertTrue(capacities_are_monotone(c, capacities2))
        self.assertAlmostEqual(capacities2.max(), 1)
    def test004(self):
        random.seed(3)
        c = generate_criteria(10)
        capacities = generate_random_capacities(c)
        mobius = capacities_to_mobius(c, capacities)
        mobius_truncate(mobius, 2)
        mobius.normalize_sum_to_unity()
        capacities2 = mobius_to_capacities(c, mobius)

        self.assertAlmostEqual(mobius.sum(), 1)
        self.assertTrue(capacities_are_monotone(c, capacities2))
        self.assertAlmostEqual(capacities2.max(), 1)