This commit is contained in:
UmbertoJr 2019-10-31 16:19:43 +01:00
parent 0af91eac3c
commit b0590b4d62

View file

@ -17,13 +17,13 @@ class Solver_TSP:
def __call__(self, instance_, verbose=True, return_value=True): def __call__(self, instance_, verbose=True, return_value=True):
self.instance = instance_ self.instance = instance_
if verbose: if verbose:
print(f"### solving with {self.method}####") print(f"### solving with {self.method} ####")
self.solution = self.available_methods[self.method](instance_) self.solution = self.available_methods[self.method](instance_)
assert self.check_if_solution_is_valid(self.solution), "Error the solution is not valid" assert self.check_if_solution_is_valid(self.solution), "Error the solution is not valid"
self.evaluate_solution() self.evaluate_solution()
self._gap() self._gap()
if verbose: if verbose:
print(f"### solution found with {self.gap} ####") print(f"### solution found with {self.gap} % gap ####")
self._gap() self._gap()
if return_value: if return_value:
return self.solution return self.solution