Beispiel #1
0
def testLowerOpenClosedCategories():
    print('*-------- Testing lowerClosedOpen Categories -------')
    t = RandomCBPerformanceTableau()
    t.save(fileName='test')
    s = SortingDigraph(t,LowerClosed=True)
    s.showSorting(Reverse=True)
    s1 = SortingDigraph('test',LowerClosed=False)
    s1.showSorting(Reverse=True)
Beispiel #2
0
def testEquivDigraph():
    print('*----- test EquivDigraph class ----*')
    t = RandomCBPerformanceTableau(numberOfActions=10)
    g = BipolarOutrankingDigraph(t)
    t1 = RandomCBPerformanceTableau(numberOfActions=10)
    g1 = BipolarOutrankingDigraph(t1)
    equivg = EquivalenceDigraph(g, g1)
    print(equivg.computeDeterminateness())
    print(equivg.computeDeterminateness())
    print(g.computeBipolarCorrelation(equivg))
    print(g.computeOrdinalCorrelation(equivg))
Beispiel #3
0
def testCBPerformanceTableau():
    print('*==>> random CB Performance Tableaux ------------*')
    t = RandomCBPerformanceTableau(numberOfActions=10,\
                                   commonPercentiles={'ind':5,'pref':10,'veto':95},\
                                   weightDistribution="random",\
                                   weightScale=[1,2],\
                                   IntegerWeights=True,\
                                   commonMode=["normal",50.0,25.0])
    t.showCriteria(Debug=False)
    g = BipolarOutrankingDigraph(t)
    g.exportGraphViz()
    #t.showPerformanceTableau()
    g.showRelationTable()
Beispiel #4
0
def testXMCDA2SaveReadPerformanceTableau():
    print('*==>> save and read XMCDA-2.0 PerformanceTableau instances ----*')
    #t = RandomS3PerformanceTableau(numberOfActions=5,numberOfCriteria=15,weightDistribution="random",weightScale=(1,13),IntegerWeights=True,commonThresholds=[(5.0,0.0),(10.0,0.0),(50.0,0.0),(60.0,0.0)],RandomCoalitions=True,commonMode=['beta',0.5,None])
    #t.showAll()
    t = RandomCBPerformanceTableau(numberOfActions=5,
                                   numberOfCriteria=7,
                                   weightDistribution="random",
                                   weightScale=(1, 7),
                                   IntegerWeights=True)
    t.saveXMCDA2('test')
    g = BipolarOutrankingDigraph(t)
    g.showRelationTable()
    t1 = XMCDA2PerformanceTableau('test')
    g1 = BipolarOutrankingDigraph(t1)
    g1.showRelationTable()
Beispiel #5
0
def testQuantilesSortingDigraph():
    print('*-------- Testing QuantilesSortingDigraph class 1 -------')
    t = RandomCBPerformanceTableau(numberOfActions=20)
    t.saveXMCDA2('test')
    s0 = QuantilesSortingDigraph(t,limitingQuantiles="deciles",
                                LowerClosed=True,
                                outrankingType='bipolar',
                                Debug=False)
    print(s0.categories)
    s0.showSorting(Reverse=True)
    s0.showSorting(Reverse=False)
    sortingRelation = s0.computeSortingRelation()
    s0.showRelationTable(actionsSubset=s0.actionsOrig,relation=sortingRelation)
    s0.showOrderedRelationTable()
    s0.showWeakOrder(Descending=True)
    s0.exportGraphViz(graphType="png")
Beispiel #6
0
def testhasOddWeightsAlgebra():
    print('*--------- Testing hasOddWeightsAlgebra test ------*')
    t = RandomCBPerformanceTableau(
        numberOfActions=10,
        numberOfCriteria=13,
        #commonThresholds=None,
        commonPercentiles={
            'ind': 5,
            'pref': 10,
            'veto': 90
        },
        weightDistribution="random",
        weightScale=None,
        IntegerWeights=True,
        #commonScale=[0.0,100.0],
        commonMode=["normal", 50.0, 25.0],
        Debug=False)
    print(t.hasOddWeightAlgebra(Debug=True))
Beispiel #7
0
def testCoDualDigraph():
    print('*---- test codual digraph -----*')
    t = RandomCBPerformanceTableau(numberOfActions=13, numberOfCriteria=7)
    g = BipolarOutrankingDigraph(t)
    g.save('testcodual')
    gasym = AsymmetricPartialDigraph(g)
    gasym.exportGraphViz('gtest')
    gcd = CoDualDigraph(g)
    gcd.exportGraphViz('gcdtest')
Beispiel #8
0
def testBipartitePartialDigraph():
    print('*------- bipartite partial digraph extraction ----*')
    t = RandomCBPerformanceTableau(numberOfActions=10,
                                   weightDistribution="equiobjectives")
    from ratingDigraphs import RatingByRelativeQuantilesDigraph
    rrq = RatingByRelativeQuantilesDigraph(t, quantiles=5, LowerClosed=True)
    from digraphs import BipartitePartialDigraph
    bpg = BipartitePartialDigraph(rrq, rrq.actionsOrig, rrq.profiles)
    rrq.computeOrdinalCorrelation(bpg)
Beispiel #9
0
def testPairwiseClusterComparison():
    print('*----- test paiwise cluster comparisons ----*')
    t = RandomCBPerformanceTableau(numberOfActions=10)
    g = BipolarOutrankingDigraph(t)
    actionsList = [x for x in list(g.actions.keys())]
    K1 = actionsList[5:]
    K2 = actionsList[:5]
    print(g.valuationdomain)
    g.computePairwiseClusterComparison(K1, K2, Debug=True)
Beispiel #10
0
def testGraphBorderInner():
    print('*------- test graph border and inners ------*')
    t = RandomCBPerformanceTableau(numberOfActions=10,
                                   weightDistribution="equiobjectives")
    g = BipolarOutrankingDigraph(t)
    bg = GraphBorder(g, Debug=True)
    ig = GraphInner(g, Debug=True)
    rg = FusionDigraph(bg, ig)
    Digraph.exportGraphViz(rg, (g.name + 'fused'))
Beispiel #11
0
def testStrongComponentsCollapsedDigraph():
    print('*---- test strong components collapsed digraph -----*')
    t = RandomCBPerformanceTableau(numberOfActions=13, numberOfCriteria=7)
    g = BipolarOutrankingDigraph(t)
    gscc = StrongComponentsCollapsedDigraph()
    gscc = StrongComponentsCollapsedDigraph(g)
    gscc.showActions()
    gscc.showRelationTable()
    gscc.exportGraphViz()
Beispiel #12
0
def testNormedQuantilesRatingDigraph():
    print('*-------- Testing NormedQuantilesRatingDigraph class -------')
    from randomPerfTabs import RandomCBPerformanceTableau
    from randomPerfTabs import RandomPerformanceGenerator
    import random
    seed = random.randint(1,100)
    #seed = 15
    print('=== >> seed = ',seed)
    nbrActions=1000
    nbrCrit = 13
    tp = RandomCBPerformanceTableau(numberOfActions=nbrActions,NegativeWeights=True,
                                    numberOfCriteria=nbrCrit,seed=seed)
    tp.convertWeights2Positive()
    pq = PerformanceQuantiles(tp,'deciles',LowerClosed=False,Debug=False)
    tpg = RandomPerformanceGenerator(tp,instanceCounter=0,seed=seed*2)
    newActions = tpg.randomActions(10)
    pq.updateQuantiles(newActions,historySize=100)
    nrq = NormedQuantilesRatingDigraph(pq,newActions,
                                       WithSorting=True,
                                       Debug=False)
    nrq.showQuantilesRating()
    nrq.exportRatingGraphViz(graphType='pdf')
    nrq.showSorting()
    nrq.showActionsSortingResult()
    nrq.showQuantilesSorting()
    newActions = tpg.randomPerformanceTableau(1000)
    pq.updateQuantiles(newActions,historySize=0)
    newActions = tpg.randomActions(10)
    pq.updateQuantiles(newActions,historySize=None,Debug=False)
    nrq = NormedQuantilesRatingDigraph(pq,newActions,quantiles='heptiles',
                                       WithSorting=True,
                                       Debug=False)
    nrq.showQuantilesRating()
    nrq.exportRatingGraphViz(graphType='pdf')
    nrq.showSorting()
    nrq.showActionsSortingResult()
    nrq.showQuantilesSorting()
    print(pq.computeQuantileProfile(0.5))
    pq.save(fileName='testPerfQuant')
    pq1 = PerformanceQuantiles('testPerfQuant')
    nrq1 = NormedQuantilesRatingDigraph(pq1,newActions,
                                       WithSorting=False,
                                       Debug=False)
    nrq1.showQuantilesRating()
Beispiel #13
0
def testCoceDigraph():
    print('*----- test rxperimental CoceDigraph class ----*')
    from digraphs import _CoceDigraph
    t = RandomCBPerformanceTableau(numberOfActions=10)
    g = BipolarOutrankingDigraph(t)
    coceg = _CoceDigraph(g, Comments=True)
    coceg.computeChordlessCircuits()
    print(coceg.computeDeterminateness())
    print(coceg.computeDeterminateness())
    print(g.computeBipolarCorrelation(coceg))
    print(g.computeOrdinalCorrelation(coceg))
Beispiel #14
0
def testNormalizedPerformanceTableau():
    print('*-------- Testing Normalization of Performance Tableaux  -------')
    t = RandomCBPerformanceTableau()
    t.showCriteria()
    t.showPerformanceTableau()
    tn = NormalizedPerformanceTableau(t, Debug=True)
    tn.showCriteria()
    tn.showPerformanceTableau()
Beispiel #15
0
def testExportPrincipalImage():
    print('*------- test exportRelationPCAImage --------*')
    t = RandomCBPerformanceTableau(numberOfActions=10,
                                   weightDistribution="equiobjectives")
    g = BipolarOutrankingDigraph(t)
    g.save('test')
    g = Digraph('test')
    g.showRelationTable()
    g.exportPrincipalImage('bipolar', bgcolor='lightblue')
    g.recodeValuation(0, 2)
    g.exportPrincipalImage('monopolar',
                           pictureFormat='xfig',
                           fontcolor='black',
                           fontsize='1.2')
Beispiel #16
0
def testPerformanceTableauStatistics():
    print('*==>> performanceTableau statistics ---------*')
    t = FullRandomPerformanceTableau(commonScale=(0.0, 100.0),
                                     numberOfCriteria=10,
                                     numberOfActions=10,
                                     commonMode=('triangular', 30.0, 0.7))
    t.showStatistics()
    print(
        t.computeNormalizedDiffEvaluations(lowValue=0.0,
                                           highValue=100.0,
                                           withOutput=True,
                                           Debug=True))
    t = RandomCBPerformanceTableau()
    t.showStatistics()
    t.showEvaluationStatistics()
Beispiel #17
0
def testActionsSortingResult():
    print('*-------- Testing QuantilesSortingDigraph class 2 -------')
    t = RandomCBPerformanceTableau(numberOfActions=15,
                                   numberOfCriteria=13,
                                   weightDistribution='equiobjectives')
    s0 = QuantilesSortingDigraph(t,limitingQuantiles=[0,0.333,0.667,1],
                                LowerClosed=False,
                                Debug=False)
    s0.showSorting(Reverse=True)
    for x in s0.actions:
        s0.showActionCategories(x,Debug=False)
    s0.showActionsSortingResult()
    s0.exportGraphViz('tests0',graphType="pdf")
    s1 = QuantilesSortingDigraph(t,limitingQuantiles=20,
                                LowerClosed=True,
                                Debug=False)
    s1.showSorting(Reverse=False)
    s1.showActionsSortingResult()
    s1.exportGraphViz('tests1',graphType="pdf")
Beispiel #18
0
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))))