def testStochasticOutrankingDigraphs():
    print('*------ test stochastic bipolar outranking digraphs ----*')
    from outrankingDigraphs import StochasticBipolarOutrankingDigraph
    from weakOrders import RankingByChoosingDigraph
    t = RandomCBPerformanceTableau(numberOfActions=13,\
                                    numberOfCriteria=13,\
                                    weightDistribution='equiobjectives')
    t.save('test')
    t = PerformanceTableau('test')
    g = BipolarOutrankingDigraph(t)
    g.recodeValuation(-1,1)
    g.showRelationTable()
    gmc = StochasticBipolarOutrankingDigraph(t,Normalized=False,\
                                             sampleSize=50,\
                                             likelihood=0.05,\
                                             Debug=False,\
                                             samplingSeed=1)
    gmc.showRelationTable()
    gmc.showRelationStatistics('medians')
    gmc.showRelationStatistics('likelihoods')
    for x in gmc.actions:
        for y in gmc.actions:
            print('==>>',x,y)
            print('Q4',gmc.relationStatistics[x][y]['Q4'])
            print('Q3',gmc.relationStatistics[x][y]['Q3'])
            print('probQ3',gmc.computeCDF(x,y,gmc.relationStatistics[x][y]['Q3']))
            print('Q2',gmc.relationStatistics[x][y]['median'])
            print('mean',gmc.relationStatistics[x][y]['mean'])
            print('Q1',gmc.relationStatistics[x][y]['Q1'])
            print('probQ1',gmc.computeCDF(x,y,gmc.relationStatistics[x][y]['Q1']))
            print('Q0',gmc.relationStatistics[x][y]['Q0'])
            print('pv',gmc.relationStatistics[x][y]['likelihood'])
            print('prob0',gmc.computeCDF(x,y,0.0))            
            print('sd',gmc.relationStatistics[x][y]['sd'])
    
    grbc = RankingByChoosingDigraph(g)
    grbc.showWeakOrder()
    gmcrbc = RankingByChoosingDigraph(gmc)
    gmcrbc.showWeakOrder()
def testRandomWeightsLaws():
    print('*------- test random laws for stochastic outranking ------*')
    t = RandomCBPerformanceTableau(numberOfActions=5,\
                                   numberOfCriteria=7,\
                                   weightDistribution='equiobjectives',
                                   )
    t.saveXMCDA2('test')
    t = XMCDA2PerformanceTableau('test')
    g = BipolarOutrankingDigraph(t)
    g.recodeValuation(-1,1)
    g.showRelationTable()

    print('Triangular')
    gmc = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                             distribution='triangular',\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc.showRelationTable()
    gmc.recodeValuation(-100,100)
    gmc.showRelationStatistics('medians')
    gmc.showRelationStatistics('likelihoods')

    print('Uniform')
    gmc1 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='uniform',\
                                              spread = 0.5,\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc1.showRelationTable()
    gmc1.recodeValuation(-100,100)
    gmc1.showRelationStatistics('medians')
    gmc1.showRelationStatistics('likelihoods')

    print('Beta(2,2)')
    gmc2 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='beta(2,2)',\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc2.showRelationTable()
    gmc2.recodeValuation(-100,100)
    gmc2.showRelationStatistics('medians')
    gmc2.showRelationStatistics('likelihoods')

    print('Beta(12,12)')
    gmc3 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='beta(4,4)',\
                                              spread = 0.5,\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc3.showRelationTable()
    gmc3.recodeValuation(-100,100)
    gmc3.showRelationStatistics('medians')
    gmc3.showRelationStatistics('likelihoods')
Esempio n. 3
0
def testRandomWeightsLaws():
    print('*------- test random laws for stochastic outranking ------*')
    t = RandomCBPerformanceTableau(numberOfActions=5,\
                                   numberOfCriteria=7,\
                                   weightDistribution='equiobjectives',
                                   )
    t.saveXMCDA2('test')
    t = XMCDA2PerformanceTableau('test')
    g = BipolarOutrankingDigraph(t)
    g.recodeValuation(-1, 1)
    g.showRelationTable()

    print('Triangular')
    gmc = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                             distribution='triangular',\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc.showRelationTable()
    gmc.recodeValuation(-100, 100)
    gmc.showRelationStatistics('medians')
    gmc.showRelationStatistics('likelihoods')

    print('Uniform')
    gmc1 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='uniform',\
                                              spread = 0.5,\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc1.showRelationTable()
    gmc1.recodeValuation(-100, 100)
    gmc1.showRelationStatistics('medians')
    gmc1.showRelationStatistics('likelihoods')

    print('Beta(2,2)')
    gmc2 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='beta(2,2)',\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc2.showRelationTable()
    gmc2.recodeValuation(-100, 100)
    gmc2.showRelationStatistics('medians')
    gmc2.showRelationStatistics('likelihoods')

    print('Beta(12,12)')
    gmc3 = StochasticBipolarOutrankingDigraph(t,Normalized=True,\
                                              distribution='beta(4,4)',\
                                              spread = 0.5,\
                                             sampleSize=100,likelihood=0.1,\
                                             Debug=False,samplingSeed=1)
    gmc3.showRelationTable()
    gmc3.recodeValuation(-100, 100)
    gmc3.showRelationStatistics('medians')
    gmc3.showRelationStatistics('likelihoods')
Esempio n. 4
0
def testStochasticOutrankingDigraphs():
    print('*------ test stochastic bipolar outranking digraphs ----*')
    from outrankingDigraphs import StochasticBipolarOutrankingDigraph
    from transitiveDigraphs import RankingByChoosingDigraph
    t = RandomCBPerformanceTableau(numberOfActions=13,\
                                    numberOfCriteria=13,\
                                    weightDistribution='equiobjectives')
    t.save('test')
    t = PerformanceTableau('test')
    g = BipolarOutrankingDigraph(t)
    g.recodeValuation(-1, 1)
    g.showRelationTable()
    gmc = StochasticBipolarOutrankingDigraph(t,Normalized=False,\
                                             sampleSize=50,\
                                             likelihood=0.05,\
                                             Debug=False,\
                                             samplingSeed=1)
    gmc.showRelationTable()
    gmc.showRelationStatistics('medians')
    gmc.showRelationStatistics('likelihoods')
    for x in gmc.actions:
        for y in gmc.actions:
            print('==>>', x, y)
            print('Q4', gmc.relationStatistics[x][y]['Q4'])
            print('Q3', gmc.relationStatistics[x][y]['Q3'])
            print('probQ3',
                  gmc.computeCDF(x, y, gmc.relationStatistics[x][y]['Q3']))
            print('Q2', gmc.relationStatistics[x][y]['median'])
            print('mean', gmc.relationStatistics[x][y]['mean'])
            print('Q1', gmc.relationStatistics[x][y]['Q1'])
            print('probQ1',
                  gmc.computeCDF(x, y, gmc.relationStatistics[x][y]['Q1']))
            print('Q0', gmc.relationStatistics[x][y]['Q0'])
            print('pv', gmc.relationStatistics[x][y]['likelihood'])
            print('prob0', gmc.computeCDF(x, y, 0.0))
            print('sd', gmc.relationStatistics[x][y]['sd'])

    grbc = RankingByChoosingDigraph(g)
    grbc.showWeakOrder()
    gmcrbc = RankingByChoosingDigraph(gmc)
    gmcrbc.showWeakOrder()