udpate
This commit is contained in:
parent
69c29e47b2
commit
4269a1b45a
2 changed files with 3 additions and 3 deletions
|
@ -39,7 +39,7 @@ class Solver_TSP:
|
|||
def nn(self, instance_, starting_node=0):
|
||||
dist_matrix = np.copy(instance_.dist_matrix)
|
||||
n = int(instance_.nPoints)
|
||||
node = np.argmin([starting_node])
|
||||
node = starting_node
|
||||
tour = [node]
|
||||
for _ in range(n - 1):
|
||||
for new_node in np.argsort(dist_matrix[node]):
|
||||
|
@ -100,4 +100,4 @@ class Solver_TSP:
|
|||
|
||||
def _gap(self):
|
||||
self.evaluate_solution(return_value=False)
|
||||
self.gap = np.round((self.found_length - self.instance.best_sol) / self.instance.best_sol * 100, 2)
|
||||
self.gap = np.round(((self.found_length - self.instance.best_sol) / self.instance.best_sol) * 100, 2)
|
||||
|
|
|
@ -25,7 +25,7 @@ class Instance:
|
|||
# store data set information
|
||||
self.name = self.lines[0].split(' ')[2]
|
||||
self.nPoints = np.int(self.lines[3].split(' ')[2])
|
||||
self.best_sol = np.int(self.lines[5].split(' ')[2])
|
||||
self.best_sol = np.float(self.lines[5].split(' ')[2])
|
||||
|
||||
# read all data points and store them
|
||||
self.points = np.zeros((self.nPoints, 3))
|
||||
|
|
Reference in a new issue