Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gui/tsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down Expand Up @@ -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:
Expand Down