Пример #1
0
def consistent(*statements, exhaustive=False):
    options = arg_parser.parse_known_args()[0]  # apparently returns a tuple
    stats["statements"] += logic.count(statements)
    statements = [logic.compile(s) for s in statements]

    clauses = statements
    cons = []
    t = Timer()
    t.tic()
    if options.exhaustive or exhaustive:
        cons += exhaustive_consistency(statements)
        result = solve(clauses + cons, options, depth="exhaustive")
    else:
        depth = int(options.depth)
        for d in range(depth):
            cons = consistency(clauses + cons)
        result = solve(clauses + cons, options, depth)
        while result and cycle(result):
            depth += 1
            cons = consistency(clauses + cons)
            result = solve(clauses + cons, options, depth)
    t.toc()
    stats["time"] += t.elapsed

    return result
Пример #2
0
def consistent(*statements, exhaustive=False):
    options = arg_parser.parse_known_args()[0]  # apparently returns a tuple
    stats["statements"] += logic.count(statements)
    statements = [logic.compile(s) for s in statements]

    clauses = statements
    start = time.clock()
    if options.exhaustive or exhaustive:
        clauses += exhaustive_consistency(statements)
        result = solve(clauses, options, depth="exhaustive")
    else:
        depth = int(options.depth)
        for d in range(depth):
            clauses += consistency(clauses)
        result = solve(clauses, options, depth)
        while result and cycle(result):
            depth += 1
            clauses += consistency(clauses)
            result = solve(clauses, options, depth)
    stop = time.clock()
    stats["time"] += stop - start

    return result
Пример #3
0
def test_transmission(Bid, A, B):
    assert logic.compile(Bid.transmission).equiv(
        or_(not_(observe(A, Bid)), sequential(observe(B, Bid), observe(A,
                                                                       Bid))))