Example #1
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))
Example #2
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))
def testSparseOutrankingDigraph():
    print('==>> Testing SparseOutrankingDigraph instantiation')
    MP = True
    t0 = time()
    tp = Random3ObjectivesPerformanceTableau(numberOfActions=100, BigData=True)
    print(time() - t0)
    print(total_size(tp.evaluation))
    bg1 = PreRankedOutrankingDigraph(tp,
                                     quantiles=10,
                                     quantilesOrderingStrategy='average',
                                     LowerClosed=True,
                                     minimalComponentSize=1,
                                     Threading=MP,
                                     Debug=False)
    print(bg1.computeDecompositionSummaryStatistics())
    bg1.showDecomposition()
    print(bg1)
    t0 = time()
    g = BipolarOutrankingDigraph(tp, Normalized=True, Threading=MP)
    print(time() - t0)
    print(total_size(g))
    t0 = time()
    print(
        "Big outranking digraph's correlation with standard outranking digraph"
    )
    print(bg1.computeOrdinalCorrelation(g, Debug=False))
    print(time() - t0)
    nf = bg1.computeBoostedOrdering(orderingRule="NetFlows")
    preordering1 = bg1.ordering2Preorder(nf)
    print(nf, preordering1)
    print(
        'Boosted Netflows ranking correlation with complete outranking relation'
    )
    print(g.computeOrdinalCorrelation(g.computePreorderRelation(preordering1)))
    ko = bg1.computeBoostedOrdering(orderingRule="Kohler")
    preordering2 = bg1.ordering2Preorder(ko)
    print(ko, preordering2)
    print(
        'Boosted Kohler ranking correlation with complete outranking relation')
    print(g.computeOrdinalCorrelation(g.computePreorderRelation(preordering2)))
Example #4
0
printline()
print('Transitivity degree {}'.format(
    full_digraph.computeTransitivityDegree()))
printline()
print('Chorless circuits')
full_digraph.computeChordlessCircuits()
full_digraph.showChordlessCircuits()
printline()
print('')

from linearOrders import CopelandOrder
cop = CopelandOrder(full_digraph)
print('The Copeland ranking')
cop.showRanking()
printline()
cop_corr = full_digraph.computeOrdinalCorrelation(cop)
print("Fitness of Copeland's ranking: %.3f" % cop_corr['correlation'])
printline()
print('')

from linearOrders import NetFlowsOrder
nf = NetFlowsOrder(full_digraph)
print('The Net-Flows ranking')
printline()
print('Net flow values for each alternative')
for n, va in enumerate(nf.netFlows):
    print("{0} {2} -> {1:.2f}".format(n + 1, *va))
printline()
nf.showRanking()
nf_corr = full_digraph.computeOrdinalCorrelation(nf)
print("Fitness of Net-flows ranking: %.3f" % nf_corr['correlation'])
Example #5
0
print('-' * 10, 'Question2', '-' * 10)
from outrankingDigraphs import BipolarOutrankingDigraph as BipolarOD
# bipolar outranking digraph
bipolar = BipolarOD(tab)
# compute chordless circuits
bipolar.computeChordlessCircuits()
# show computed chordless circuits
bipolar.showChordlessCircuits()

input("Press Enter to continue...")

###Q3###
print('-' * 10, 'Question3', '-' * 10)
#Copeland Ranking
cop = CopelandOrder(bipolar)
cop_corr = bipolar.computeOrdinalCorrelation(cop).get('correlation')
print(f'Correlation of Copeland order {cop_corr}')
#Kohler Ranking
koh = KohlerOrder(bipolar)
koh_corr = bipolar.computeOrdinalCorrelation(koh).get('correlation')
print(f'Correlation of Kohler order {koh_corr}')
#Netflows Ranking
netflow = NetFlowsOrder(bipolar)
netflow_corr = bipolar.computeOrdinalCorrelation(netflow).get('correlation')
print(f'Correlation of NetFlows order {netflow_corr}')

if cop_corr >= netflow_corr and cop_corr >= koh_corr:
    print('According to the Copeland order,the ranking is:')
    cop.showRanking()
elif netflow_corr >= cop_corr and netflow_corr >= koh_corr:
    print('According to the NetFlows order,the ranking is:')