def testEstimateRankingCorrelation():
    print('====> Testing estimateRankingCorrelation')
    MP = True
    nbrActions = 1000
    tp = Random3ObjectivesPerformanceTableau(numberOfActions=nbrActions,
                                             seed=100)
    bg1 = PreRankedOutrankingDigraph(
        tp,
        CopyPerfTab=True,
        quantiles=4,
        quantilesOrderingStrategy='optimal',
        componentRankingRule='NetFlows',
        LowerClosed=True,
        minimalComponentSize=1,
        Threading=MP,
        nbrOfCPUs=8,
        #tempDir='.',
        nbrOfThreads=8,
        Comments=True,
        Debug=False,
        save2File='testbgMP')
    seed = 1
    sampleSize = 100
    import random
    random.seed(seed)
    actionKeys = [x for x in bg1.actions]
    sample = random.sample(actionKeys, sampleSize)
    print(sample)
    print(bg1.boostedRanking)
    preRankedSample = []
    for x in bg1.boostedRanking:
        if x in sample:
            preRankedSample.append(x)
    print(preRankedSample)
    ptp = PartialPerformanceTableau(tp, sample)
    from outrankingDigraphs import BipolarOutrankingDigraph
    pg = BipolarOutrankingDigraph(ptp, Normalized=True)
    print(pg.computeRankingCorrelation(preRankedSample))
    print(bg1.estimateRankingCorrelation(sampleSize, seed))