[simple] --> [easy]
This commit is contained in:
@@ -9,18 +9,18 @@ if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('-s', '--simple', action='store_true', help='Benchmark all simple level TSP')
|
||||
parser.add_argument('-e', '--easy', action='store_true', help='Benchmark all easy level TSP')
|
||||
parser.add_argument('-m', '--medium', action='store_true', help='Benchmark all medium level TSP')
|
||||
parser.add_argument('-d', '--difficult', action='store_true', help='Benchmark all difficult level TSP')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if (args.simple):
|
||||
TSP_Bench_PATH("./data/simple/", MyModel, timeout=60)
|
||||
if (args.easy):
|
||||
TSP_Bench_PATH("./data/easy/", MyModel, timeout=60)
|
||||
if (args.medium):
|
||||
TSP_Bench_PATH("./data/medium/", MyModel, timeout=180)
|
||||
if (args.difficult):
|
||||
TSP_Bench_PATH("data/difficult/", MyModel, timeout=300)
|
||||
TSP_Bench_PATH("./data/difficult/", MyModel, timeout=300)
|
||||
|
||||
if( (not args.simple) and (not args.medium) and (not args.difficult) ):
|
||||
if( (not args.easy) and (not args.medium) and (not args.difficult) ):
|
||||
TSP_Bench_ALL('./', MyModel)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import math
|
||||
import random
|
||||
import numpy as np
|
||||
|
||||
from model.base_model import Model
|
||||
|
||||
class MyModel(Model):
|
||||
|
||||
@@ -51,7 +51,7 @@ def TSP(tsp_file, model, timeout=60):
|
||||
with open('output/' + os.path.splitext(os.path.basename(tsp_file))[0] + '.txt', "w") as outfile:
|
||||
outfile.write("-3")
|
||||
elif (len(best_solution) == 0):
|
||||
print(exec)
|
||||
print(exc)
|
||||
log("No Answer -1")
|
||||
with open('output/' + os.path.splitext(os.path.basename(tsp_file))[0] + '.txt', "w") as outfile:
|
||||
outfile.write("-1")
|
||||
@@ -145,19 +145,19 @@ def TSP_Bench_ALL(root, model):
|
||||
fitness_lists_all = []
|
||||
times_all = []
|
||||
|
||||
best_solutions_simple, fitness_lists_simple, times_simple = TSP_Bench_PATH(os.path.join(root, "data/simple/"), model, timeout=60)
|
||||
best_solutions_easy, fitness_lists_easy, times_easy = TSP_Bench_PATH(os.path.join(root, "data/easy/"), model, timeout=60)
|
||||
best_solutions_medium, fitness_lists_medium, times_medium = TSP_Bench_PATH(os.path.join(root, "data/medium/"), model, timeout=180)
|
||||
best_solutions_difficult, fitness_lists_difficult, times_difficult = TSP_Bench_PATH(os.path.join(root, "data/difficult/"), model, timeout=300)
|
||||
|
||||
best_solutions_all.append(best_solutions_simple)
|
||||
best_solutions_all.append(best_solutions_easy)
|
||||
best_solutions_all.append(best_solutions_medium)
|
||||
best_solutions_all.append(best_solutions_difficult)
|
||||
|
||||
fitness_lists_all.append(fitness_lists_simple)
|
||||
fitness_lists_all.append(fitness_lists_easy)
|
||||
fitness_lists_all.append(fitness_lists_medium)
|
||||
fitness_lists_all.append(fitness_lists_difficult)
|
||||
|
||||
times_all.append(times_simple)
|
||||
times_all.append(times_easy)
|
||||
times_all.append(times_medium)
|
||||
times_all.append(times_difficult)
|
||||
|
||||
|
||||
BIN
template/tsp.pyc
Normal file
BIN
template/tsp.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user