utils
This commit is contained in:
parent
0c880aacd8
commit
0e0dca1b9b
1 changed files with 10 additions and 0 deletions
10
src/utils.py
10
src/utils.py
|
@ -62,3 +62,13 @@ class multi_fragment:
|
|||
end = True
|
||||
sol_list.append(n1)
|
||||
return sol_list
|
||||
|
||||
|
||||
def compute_lenght(solution, dist_matrix):
|
||||
total_length = 0
|
||||
starting_node = solution[0]
|
||||
from_node = starting_node
|
||||
for node in solution[1:]:
|
||||
total_length += dist_matrix[from_node, node]
|
||||
from_node = node
|
||||
return total_length
|
Reference in a new issue