Exemple #1
0
def start_manager(var_count,order):
    #vtree = sdd.sdd_vtree_new_with_var_order(var_count,order,"right")
    vtree = sdd.sdd_vtree_new(var_count,"right")
    #vtree = vtrees.right_linear_vtree(1,var_count+1)
    manager = sdd.sdd_manager_new(vtree)
    sdd.sdd_manager_auto_gc_and_minimize_off(manager)
    sdd.sdd_vtree_free(vtree)
    return manager
Exemple #2
0
def start_manager(graph):
    var_count = len(graph.edges)
    vtree = sdd.sdd_vtree_new(var_count,"right")
    manager = sdd.sdd_manager_new(vtree)
    sdd.sdd_vtree_free(vtree)
    return manager
Exemple #3
0
    it = iter(my_list)
    for x in it:
        y = it.next()
        yield (x, y)


def str_model(model, var_count=None):
    """Convert model to string."""
    if var_count is None:
        var_count = len(model)
    return " ".join(str(model[var]) for var in xrange(1, var_count + 1))


if __name__ == "__main__":
    var_count = 10
    vtree = sdd.sdd_vtree_new(var_count, "balanced")
    manager = sdd.sdd_manager_new(vtree)

    alpha = sdd.sdd_manager_false(manager)
    for var in xrange(1, var_count + 1):
        lit = sdd.sdd_manager_literal(-var, manager)
        alpha = sdd.sdd_disjoin(alpha, lit, manager)

    vt = sdd.sdd_manager_vtree(manager)
    model_count = 0
    for model in models(alpha, vt):
        model_count += 1
        print str_model(model, var_count=var_count)

    # lib_mc = sdd.sdd_model_count(alpha,manager)
    print "model count: %d" % model_count