Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. [(343, 3), (344, 6), (345, 1), (346, 8), (347, 2)]
  2.  
  3. # each solution is a list (or tuple rather) like above
  4. hashes_solutions_found = set([hash(sol1), hash(sol2), hash(sol3), ...])
  5.  
  6. # O(1) check if solution found in this iteration has already been explorend
  7. solution_hash = hash(current_solution)
  8. if solution_hash in hashes_solutions_found:
  9. return
  10.  
  11. hashes_solutions_found.add(solution_hash)
  12. value = objective(current_solution)
  13. if value > best_value:
  14. best_solution, best_value = value, current_solution
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement