def analyze_track(filename, manhattan_heuristic): (states, start_state, t) = extract_track(filename, manhattan_heuristic) space = structured_space(states, start_state) results = [] for k in range(1, 4): # len(states)): space.restart_heuristic() lrta_costs = [] while not space.have_residuals_converged(0.001): lrta_costs.append(space.simulate_space_lrta(start_state)) space.restart_heuristic() lrtak_costs = [] while not space.have_residuals_converged(0.001): lrtak_costs.append(space.simulate_space_lrtak(k, start_state)) partial_results = (lrta_costs, lrtak_costs, k) results.append(partial_results) return results
def analyze_track(filename, manhattan_heuristic): (states, start_state, t) = extract_track(filename, manhattan_heuristic) space = structured_space(states, start_state) results = [] for k in range(1, 4): #len(states)): space.restart_heuristic() lrta_costs = [] while not space.have_residuals_converged(0.001): lrta_costs.append(space.simulate_space_lrta(start_state)) space.restart_heuristic() lrtak_costs = [] while not space.have_residuals_converged(0.001): lrtak_costs.append(space.simulate_space_lrtak(k, start_state)) partial_results = (lrta_costs, lrtak_costs, k) results.append(partial_results) return results
t = trackDisplay(width, length) #print t.print_board t.update(start_state) #print t.print_board #t.printdisplay() states = [] for states_pack in index_to_states.values(): states.append(states_pack[0]) states.append(states_pack[1]) states.append(states_pack[2]) space = structured_space(states, start_state) space.restart_heuristic() print "number of states" print len(states) for s in states: if len(s.actions) == 0: print 'NOOOOOOOOOO' print states_to_indexes[s] while not space.have_residuals_converged(0.001): print space.simulate_space_lrta(start_state, t) space.restart_heuristic()