diff --git a/gui/tsp.py b/gui/tsp.py index 590fff354..05b94a343 100644 --- a/gui/tsp.py +++ b/gui/tsp.py @@ -260,7 +260,7 @@ def fitness_fn(state): while True: population = [mutate(recombine(*select(2, population, fitness_fn)), self.mutation_rate.get()) for _ in range(len(population))] - current_best = np.argmax(population, key=fitness_fn) + current_best = utils.argmax_random_tie(population, key=fitness_fn) if fitness_fn(current_best) > fitness_fn(all_time_best): all_time_best = current_best self.cost.set("Cost = " + str('%0.3f' % (-1 * problem.value(all_time_best)))) @@ -294,7 +294,7 @@ def find_neighbors(state, number_of_neighbors=100): current = Node(problem.initial) while True: neighbors = find_neighbors(current.state, self.no_of_neighbors.get()) - neighbor = np.argmax_random_tie(neighbors, key=lambda node: problem.value(node.state)) + neighbor = utils.argmax_random_tie(neighbors, key=lambda node: problem.value(node.state)) map_canvas.delete('poly') points = [] for city in current.state: