This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
AICup/src/utils.py
2019-11-18 07:01:13 +01:00

12 lines
279 B
Python

import numpy as np
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