Exemple #1
0
def main(folder, file_name):
    gms = [mgm.GraphicalModel.loadFromUAI(pathJoin(folder, f)) for f in os.listdir(folder)]
    random.seed(31337)
    random.shuffle(gms)

    gms = filter(lambda x: x.n_vars <= 180, gms)

    lp.prepareGMs(gms, n_cpus)

    cPickle.dump(gms, open(file_name, "w"), protocol=2)
Exemple #2
0
def main(n, m, k, sigma, dmax, maxiter, file_name):
    gms = [mgm.GraphicalModel.generateRandomGrid(m, k, sigma, dmax, make_tree_decomposition=True) for i in range(n)]

    lp.prepareGMs(gms, n_cpus=n_cpus)

    cPickle.dump(gms, open(file_name, "w"), protocol=2)