Пример #1
0
def test_find_mip_parallel_standard_example(s, flushcache, restore_fs_cache):
    flushcache()
    initial = (config.PARALLEL_CUT_EVALUATION, config.NUMBER_OF_CORES)
    config.PARALLEL_CUT_EVALUATION, config.NUMBER_OF_CORES = True, -2

    unpartitioned_constellation = constellation(s)
    bipartitions = utils.directed_bipartition(s.node_indices)[1:-1]
    cuts = [Cut(bipartition[0], bipartition[1])
            for bipartition in bipartitions]
    min_mip = _null_bigmip(s)
    min_mip.phi = float('inf')
    mip = _find_mip_parallel(s, cuts, unpartitioned_constellation, min_mip)
    check_mip(mip, standard_answer)

    config.PARALLEL_CUT_EVALUATION, config.NUMBER_OF_CORES = initial
Пример #2
0
def test_find_mip_sequential_micro(micro_s, flushcache, restore_fs_cache):
    flushcache()

    initial = config.PARALLEL_CUT_EVALUATION
    config.PARALLEL_CUT_EVALUATION = False

    unpartitioned_constellation = constellation(micro_s)
    bipartitions = utils.directed_bipartition(micro_s.node_indices)[1:-1]
    cuts = [Cut(bipartition[0], bipartition[1])
            for bipartition in bipartitions]
    min_mip = _null_bigmip(micro_s)
    min_mip.phi = float('inf')
    mip = _find_mip_sequential(micro_s, cuts, unpartitioned_constellation,
                               min_mip)
    check_mip(mip, micro_answer)

    config.PARALLEL_CUT_EVALUATION = initial