Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [(343, 3), (344, 6), (345, 1), (346, 8), (347, 2)]
- # each solution is a list (or tuple rather) like above
- hashes_solutions_found = set([hash(sol1), hash(sol2), hash(sol3), ...])
- # O(1) check if solution found in this iteration has already been explorend
- solution_hash = hash(current_solution)
- if solution_hash in hashes_solutions_found:
- return
- hashes_solutions_found.add(solution_hash)
- value = objective(current_solution)
- if value > best_value:
- best_solution, best_value = value, current_solution
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement