Ejemplo n.º 1
0
def unsat_test(debug_prints=True):
    adj = {'n1': {'n2', 'n3', 'n4', 'n5', 'n6'}}

    fab = Fabric((3, 3), wire_lengths={1})
    des = Design(adj, fab, position.Packed2H)
    des.add_constraint_generator('nearest_neighbor',
                                 constraints.nearest_neighbor_var)
    des.add_constraint_generator('distinct', constraints.distinct)
    sol = run_test(des, debug_prints)
    return des, fab, sol
Ejemplo n.º 2
0
def small_test(dims=(8, 8), debug_prints=True):
    '''
        place a depth 5 binary tree on a 8 by 8 with wire lengths of 1 or 2
    '''
    adj = {
        'n{}'.format(i): frozenset(
            (('n{}'.format(2 * i), 1), ('n{}'.format(2 * i + 1), 1)))
        for i in range(1, 2**4)
    }
    fab = Fabric(dims, wire_lengths={1, 2})
    des = Design(adj, fab, position.Packed2H)
    des.add_constraint_generator('neighborhood',
                                 constraints.in_neighborhood(2))
    des.add_constraint_generator('distinct', constraints.distinct)
    sol = run_test(des, debug_prints)
    return des, fab, sol
Ejemplo n.º 3
0
def tiny_opt_test(dims=(4, 4), debug_prints=True):
    '''
        place 4 nodes on a 3x3 fabric [with length 1 wires]
    '''
    adj = {
        'n1': [('n2', 1), ('n3', 1)],
        'n2': [('n4', 1)],
        'n3': [('n4', 1)],
        'n4': {}
    }
    fab = Fabric(dims, wire_lengths={1})

    des = Design(adj, fab, position.BVXY)
    des.add_optimizer('min_L1', constraints.min_L1, True)
    des.add_constraint_generator('distinct', constraints.opt_distinct)

    sol = run_opt_test(des, debug_prints)
    return des, fab, sol
Ejemplo n.º 4
0
def tiny_test(dims=(3, 3), debug_prints=True):
    '''
        place 4 nodes on a 3x3 fabric [with length 1 wires]
    '''
    adj = {
        'n1': [('n2', 1), ('n3', 1)],
        'n2': [('n4', 1)],
        'n3': [('n4', 1)],
        'n4': {}
    }
    fab = Fabric(dims, wire_lengths={1})

    des = Design(adj, fab, position.Unpacked2H)
    des.add_constraint_generator('nearest_neighbor',
                                 constraints.nearest_neighbor_fast)
    des.add_constraint_generator('distinct', constraints.distinct)

    sol = run_test(des, debug_prints)
    return des, fab, sol