def P16(): p = Program(num_prog_inputs=2) p.create_xor_component() p.create_xor_component() p.create_negate_component() p.create_and_component() p.create_ule_component() return ProgramSynthesis(p, BVT.P16, 'P16')
def test_P16(): print('Find max program (also P16):') p = Program(num_prog_inputs=2) p.create_xor_component() p.create_xor_component() p.create_negate_component() p.create_and_component() p.create_ule_component() ProgramSynthesis(p, lambda x, y: max(x, y), 'Find Max').timed_synthesis()
def test_P16(): print('P16 program, find max:') p = Program(num_prog_inputs=2) p.create_xor_component() p.create_xor_component() p.create_negate_component() p.create_and_component() p.create_ule_component() timed_synthesis(p, lambda x, y: max(x, y), 20000, False)
def shortestComparison_P21(): ps = [] p = Program(num_prog_inputs=1) p.create_negate_component() p.create_and_component() p.create_add_component() p.create_xor_component() p.create_add_component() p.create_bitshiftright_component(2) p.create_or_component() oracle = BVT.P21 ps_short = ProgramSynthesis(p, oracle, 'Shortest') ps_short.find_shortest_program = True ps.append(ps_short) ps_no_short = ProgramSynthesis(p, oracle, 'No Shortest') ps_no_short.find_shortest_program = False ps.append(ps_no_short) return ps
def shortestComparison_P16(): ps = [] p = Program(num_prog_inputs=2) p.create_xor_component() p.create_xor_component() p.create_and_component() p.create_negate_component() p.create_ule_component() p.create_and_component() p.create_add_component() oracle = BVT.P16 ps_short = ProgramSynthesis(p, oracle, 'Find Shortest') ps_short.find_shortest_program = True ps.append(ps_short) ps_no_short = ProgramSynthesis(p, oracle, 'No Find Shortest') ps_no_short.find_shortest_program = False ps.append(ps_no_short) return ps