Ejemplo n.º 1
0
def test_solve_4():
    '''
    Test function  'my_solver.solve_4'
    '''

    print('\n First test example \n')
    initial_state = load_state('workbenches/wb_06_i.txt')
    goal_state = load_state('workbenches/wb_06_g.txt')

    display_state(initial_state, 'Initial state')
    display_state(goal_state, '\nGoal state')

    La = solve_4(initial_state, goal_state)

    print('\n\n This problem is solvable \n')
def test_solve_4():
    '''
    Test function  'my_solver.solve_4'
    '''

    print('\n First test example \n')
    initial_state = load_state('workbenches/wb_06_i.txt')
    goal_state = load_state('workbenches/wb_06_g.txt')

    display_state(initial_state, 'Initial state')
    display_state(goal_state, '\nGoal state')
    t0 = time.time()
    La = solve_4(initial_state, goal_state)
    t1 = time.time()
    print('Search solve_1 took {0} seconds'.format(t1 - t0))
    print('\n\n This problem is solvable \n')
    print(La)
def test_solve_rand_4a(): #USER ADDED
    '''
    Generate a random goal using ap3
    
    '''
    initial_state = load_state('workbenches/wb_06_i.txt')        
    ap_3 = AssemblyProblem_3(initial_state)
    goal_state = gen_prob(ap_3, num_op=3)
    
    ap_4 = AssemblyProblem_4(initial_state, goal=goal_state)
    print("\n\nNumber of Actions: ", len(ap_4.actions(initial_state)))
    display_state(initial_state, message="Initial:")
    print(ap_4.actions(initial_state))
    
    
    t0 = time.time()

    La = solve_4(initial_state, goal_state)

    t1 = time.time()
    
    print ('Search solve_1 took {0} seconds'.format(t1-t0))