solver
This commit is contained in:
parent
22a0fdd4f3
commit
5342e4423b
2 changed files with 2 additions and 2 deletions
2
run.py
2
run.py
|
@ -6,7 +6,7 @@ from time import time as t
|
||||||
def run(show_plots=False):
|
def run(show_plots=False):
|
||||||
# names = [name_ for name_ in os.listdir("./problems") if "tsp" in name_]
|
# names = [name_ for name_ in os.listdir("./problems") if "tsp" in name_]
|
||||||
names = ["eil76.tsp"]
|
names = ["eil76.tsp"]
|
||||||
methods = ["random", "nearest_neighbors", "best_nn"]
|
methods = ["random", "nearest_neighbors", "best_nn", ]
|
||||||
results = []
|
results = []
|
||||||
index = []
|
index = []
|
||||||
for name in names:
|
for name in names:
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Solver_TSP:
|
||||||
|
|
||||||
def __init__(self, method):
|
def __init__(self, method):
|
||||||
self.available_methods = {"random": self.random_method, "nearest_neighbors": self.nn,
|
self.available_methods = {"random": self.random_method, "nearest_neighbors": self.nn,
|
||||||
"best_nn": self.best_nn, "multi_fragment": lambda a: a }
|
"best_nn": self.best_nn, "multi_fragment": self.mf}
|
||||||
self.method = method
|
self.method = method
|
||||||
self.solved = False
|
self.solved = False
|
||||||
assert method in self.available_methods, f"the {method} method is not available currently."
|
assert method in self.available_methods, f"the {method} method is not available currently."
|
||||||
|
|
Reference in a new issue