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
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 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 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
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)