def stepcounter(count, choice): # validate user choice of type if choice == 'steps': num = 1 elif choice == 'children': num = 2 else: sys.exit('stepcounter: Provide a valid choice, steps or children') # validate user choice of runs if count < 1: sys.exit('stepcounter: Can\'t run less than 1 run, try again') steps = [] # run the algorithm as often as asked for i in range(0,count): step = algo.algorithm(countries_object, num_colours, colour_list)[num] steps.append(step) # construct filename from chosen algorithm and map filename = my_algo + my_map # export data to csv benchmark.exportcsv(steps, filename)
def stepcounter(count, choice): # validate user choice of type if choice == 'steps': num = 1 elif choice == 'children': num = 2 else: sys.exit('stepcounter: Provide a valid choice, steps or children') # validate user choice of runs if count < 1: sys.exit('stepcounter: Can\'t run less than 1 run, try again') steps = [] # run the algorithm as often as asked for i in range(0, count): step = algo.algorithm(countries_object, num_colours, colour_list)[num] steps.append(step) # construct filename from chosen algorithm and map filename = my_algo + my_map # export data to csv benchmark.exportcsv(steps, filename)
sys.exit('stepcounter: Provide a valid choice, steps or children') # validate user choice of runs if count < 1: sys.exit('stepcounter: Can\'t run less than 1 run, try again') steps = [] # run the algorithm as often as asked for i in range(0,count): step = algo.algorithm(countries_object, num_colours, colour_list)[num] steps.append(step) # construct filename from chosen algorithm and map filename = my_algo + my_map # export data to csv benchmark.exportcsv(steps, filename) # solution = algo.algorithm(countries_object, num_colours, colour_list)[0] # print solution # ----------- Select whether you want to test the algorithm by running it multiple times or visualize it --------------------# # Deselect these to visualize the graph solution = algo.algorithm(countries_object, num_colours, colour_list)[0] importvis.Visualize(solution,my_map) # Deselect this to export stepcounter to csv, either counting 'steps' or 'children' #stepcounter(50, 'steps')
sys.exit('stepcounter: Provide a valid choice, steps or children') # validate user choice of runs if count < 1: sys.exit('stepcounter: Can\'t run less than 1 run, try again') steps = [] # run the algorithm as often as asked for i in range(0, count): step = algo.algorithm(countries_object, num_colours, colour_list)[num] steps.append(step) # construct filename from chosen algorithm and map filename = my_algo + my_map # export data to csv benchmark.exportcsv(steps, filename) # solution = algo.algorithm(countries_object, num_colours, colour_list)[0] # print solution # ----------- Select whether you want to test the algorithm by running it multiple times or visualize it --------------------# # Deselect these to visualize the graph solution = algo.algorithm(countries_object, num_colours, colour_list)[0] importvis.Visualize(solution, my_map) # Deselect this to export stepcounter to csv, either counting 'steps' or 'children' #stepcounter(50, 'steps')