def testCoca_BreakAdd_BrokenCocsDigraph(): print('==>> Testing Coca_ BreakAdd_ and BrokenCocsDiGraph instantiation') g = RandomValuationDigraph(order=10) #g = RandomWeakTournament(order=5) #g.save('testCoca') #g = Digraph('testCoca') print(g.valuationdomain) gp = PolarisedDigraph(g, 0.2) #gp = IndeterminateDigraph(order=5) h1 = CocaDigraph(digraph=gp, Comments=True) h1.save('rescoca2') h1.showAll() g = RandomValuationDigraph(order=10) h2 = BreakAddCocsDigraph(digraph=g, Comments=True) h2.save('resbradco2') h2.showAll() ## t = RandomPerformanceTableau(25) ## g = BipolarOutrankingDigraph(t) g = RandomValuationDigraph(order=10, seed=3) h3 = BrokenCocsDigraph(digraph=g, Comments=True) h3.save('resbreakco2') h3.showAll()
def testQualChoices(): print('==>> Testing qualified maximal choices extraction') g = RandomBipolarOutrankingDigraph(numberOfActions=5, numberOfCriteria=7) g.showMIS() g.showMaxDomIrred() g.showMaxAbsIrred() print('==>> Testing qualified minimal choices extraction') g = RandomValuationDigraph(order=5) g.showAll() g.showPreKernels() g.showMinDom() g.showMinAbs()
def testRandomValuationDigraph(): print('*==>> testing RandomValuationDigraph ----*') g = RandomValuationDigraph(ndigits=3) h = PolarisedDigraph(g, 0.70) h.showRelationTable() h.save('testPol') hp = Digraph('testPol') g.showRelationTable() g.save('testVal') gs = Digraph('testVal')
def testUnaryOperatorsNegationInverse(): print('*----- test negation and inverse operators (- ~) ----*') g1 = RandomValuationDigraph(Normalized=True, IntegerValuation=True) g1.showRelationTable() g1.computeValuationStatistics(Comments=True) dg1 = -g1 dg1.showRelationTable() cg1 = ~g1 cg1.showRelationTable() g1 = RandomOutrankingDigraph() cdg1 = -(~g1) cdg1.showRelationTable() cd = CoDualDigraph(g1) cd.showRelationTable()
def testFusionOperators(): print('*------- test fusion operators ------*') from randomDigraphs import RandomValuationDigraph g1 = RandomValuationDigraph(order=5, seed=1) g2 = RandomValuationDigraph(order=5, seed=2) g3 = RandomValuationDigraph(order=5, seed=3) from digraphs import FusionLDigraph g1.showRelationTable() g2.showRelationTable() g3.showRelationTable() print('===> o-max') fga = FusionLDigraph([g1, g2, g3], weights=None, operator='o-max') fga.showRelationTable() print('===> o-min') fga = FusionLDigraph([g1, g2, g3], weights=None, operator='o-min') fga.showRelationTable() print('===> o-average') fga = FusionLDigraph([g1, g2, g3], weights=None, operator='o-average') fga.showRelationTable() print('===> o-average, weights = [1,2,3]') fga = FusionLDigraph([g1, g2, g3], weights=[1, 2, 3], operator='o-average') fga.showRelationTable()
def testmaxHoleSize(): print('*------- test maximal hole size ------*') g = RandomValuationDigraph(order=20) g.computeMaxHoleSize(Comments=True) print('Nbr of holes', g.nbrOfHoles) print('Maximal hole size', g.maxHoleSize)
def testCompleteness(): print('*------- test (Weakly) Completeness ------*') g = RandomValuationDigraph() g.showRelationTable() print('Relation %s is complete ? %s' % (g.name, str(g.isComplete(Debug=True)))) print('Relation %s is weakly complete ? %s' % (g.name, str(g.isWeaklyComplete(Debug=True)))) t = RandomCBPerformanceTableau(numberOfActions=9, numberOfCriteria=5, weightDistribution='equiobjectives') g = BipolarOutrankingDigraph(t, Normalized=True) g.showRelationTable() print('Relation %s is complete ? %s' % (g.name, str(g.isComplete(Debug=True)))) print('Relation %s is weakly complete ? %s' % (g.name, str(g.isWeaklyComplete(Debug=True)))) gcd = CoDualDigraph(g) gcd.showRelationTable() print('Relation %s is complete ? %s' % (gcd.name, str(gcd.isComplete(Debug=True)))) print('Relation %s is weakly complete ? %s' % (gcd.name, str(gcd.isWeaklyComplete(Debug=True))))
def testIndeterminateDigraph(): print('*----- test IndeterminateDigraph -----*') g = RandomValuationDigraph() m = IndeterminateDigraph(g) g.showShort() g.showRelationTable()
def testODistance(): print('*==>> verifying ODistance between digraphs ---*') g1 = RandomValuationDigraph(order=3) print(g1.valuationdomain) g1.save() g2 = RandomValuationDigraph(order=3) g1.computeODistance(g2) #g1.recodeValuation(-1.0,1.0) g2.recodeValuation(-1.0, 1.0) g1.computeODistance(g2)
def testZoomingValuations(): print('*==>> zooming the valuation of digraphs ------*') g = RandomValuationDigraph() print(g.valuationdomain) print(g.relation) g.showRelationTable() g.zoomValuation(2.0) print(g.valuationdomain) print(g.relation) g.showRelationTable() g.zoomValuation(0.25) print(g.valuationdomain) print(g.relation) g.showRelationTable()
def testFixpointAlgorithmes(): print("==>> Testing Pirlot's and Bisdorff's fixpoint algorithm ---") g = RandomValuationDigraph() g.showStatistics() print("Good Choices with Pirlot's algorithm") g.computeGoodPirlotChoices(Comments=True) print("Good Choices with Bisdorff's algorithm") g.computeGoodChoices(Comments=True) print(g.goodChoices) print('-------') print("Bad choices with Pirlot's algorithm") g.computeBadPirlotChoices(Comments=True) print("Bad Choices with Bisdorff's algorithm") g.computeBadChoices(Comments=True) print(g.badChoices)