I am reproducing the TSP example in a Jupyter Notebook and in the following line:
initial_solution = greedy_repair(state, random_state)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-181-62f3c5d57681> in <module>
----> 1 initial_solution = greedy_repair(state, random_state)
<ipython-input-178-f634089afd1a> in greedy_repair(current, random_state)
12
13 while len(current.edges) != len(current.nodes):
---> 14 node = next(node for node in nodes
15 if node not in current.edges)
16
<ipython-input-178-f634089afd1a> in <genexpr>(.0)
13 while len(current.edges) != len(current.nodes):
14 node = next(node for node in nodes
---> 15 if node not in current.edges)
16
17 # Computes all nodes that have not currently been visited,
TypeError: unhashable type: 'list'
TypeError Traceback (most recent call last)
<ipython-input-190-62f3c5d57681> in <module>
----> 1 initial_solution = greedy_repair(state, random_state)
<ipython-input-188-fd3fe98c19d8> in greedy_repair(current, random_state)
21 # not result in a subcycle, as that would violate the TSP
22 # constraints.
---> 23 unvisited = {other for other in current.nodes
24
25 if other != node
<ipython-input-188-fd3fe98c19d8> in <setcomp>(.0)
24
25 if other != node
---> 26 if other not in visited
27 if not would_form_subcycle(node, other, current)}
28
TypeError: unhashable type: 'list'
because visited is a set. If I transform the set into a list so the previous works I will have the same type of error in the next line. It would help me to have an input on the intended behavior.