[new] Difficulty level selection
This commit is contained in:
parent
352639f91b
commit
c15357f153
|
|
@ -69,7 +69,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"There are problems at different levels. **3 simple, 2 medium, 1 hard**."
|
"There are problems at different levels. **3 simple, 2 medium, 1 difficult**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -963,7 +963,7 @@
|
||||||
"# a280: 3088 (BFS), 3558 (DFS)\n",
|
"# a280: 3088 (BFS), 3558 (DFS)\n",
|
||||||
"# pcb442: 58952 (BFS), 61984 (DFS)\n",
|
"# pcb442: 58952 (BFS), 61984 (DFS)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Hard\n",
|
"# Difficult\n",
|
||||||
"# dsj1000: time-out (DP-BFS) 23,552,227 (DP-DFS)"
|
"# dsj1000: time-out (DP-BFS) 23,552,227 (DP-DFS)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"There are problems at different levels. **3 simple, 2 medium, 1 hard**."
|
"There are problems at different levels. **3 simple, 2 medium, 1 difficult**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -901,7 +901,7 @@
|
||||||
"# a280: 3088 (UCS-BFS), time-out (A-Star)\n",
|
"# a280: 3088 (UCS-BFS), time-out (A-Star)\n",
|
||||||
"# pcb442: 58952 (UCS-BFS), time-out (A-Star)\n",
|
"# pcb442: 58952 (UCS-BFS), time-out (A-Star)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Hard\n",
|
"# Difficult\n",
|
||||||
"# dsj1000: time-out (UCS-BFS), 542,620,572 (Hill-Climbing)"
|
"# dsj1000: time-out (UCS-BFS), 542,620,572 (Hill-Climbing)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"There are problems at different levels. **3 simple, 2 medium, 1 hard**."
|
"There are problems at different levels. **3 simple, 2 medium, 1 difficult**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"There are problems at different levels. **3 simple, 2 medium, 1 hard**."
|
"There are problems at different levels. **3 simple, 2 medium, 1 difficult**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"There are problems at different levels. **3 simple, 2 medium, 1 hard**."
|
"There are problems at different levels. **3 simple, 2 medium, 1 difficult**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,26 @@
|
||||||
import os
|
import argparse
|
||||||
import signal
|
|
||||||
import json
|
|
||||||
|
|
||||||
from tsp import TSP_Bench_ALL
|
from tsp import TSP_Bench_ALL
|
||||||
|
from tsp import TSP_Bench_PATH
|
||||||
|
|
||||||
from model.my_model import MyModel
|
from model.my_model import MyModel
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
TSP_Bench_ALL('./', MyModel)
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument('-s', '--simple', action='store_true', help='Benchmark all simple 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.medium):
|
||||||
|
TSP_Bench_PATH("./data/medium/", MyModel, timeout=180)
|
||||||
|
if (args.difficult):
|
||||||
|
TSP_Bench_PATH("data/difficult/", MyModel, timeout=300)
|
||||||
|
|
||||||
|
if( (not args.simple) and (not args.medium) and (not args.difficult) ):
|
||||||
|
TSP_Bench_ALL('./', MyModel)
|
||||||
|
|
|
||||||
|
|
@ -147,18 +147,18 @@ def TSP_Bench_ALL(root, model):
|
||||||
|
|
||||||
best_solutions_simple, fitness_lists_simple, times_simple = TSP_Bench_PATH(os.path.join(root, "data/simple/"), model, timeout=60)
|
best_solutions_simple, fitness_lists_simple, times_simple = TSP_Bench_PATH(os.path.join(root, "data/simple/"), 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_medium, fitness_lists_medium, times_medium = TSP_Bench_PATH(os.path.join(root, "data/medium/"), model, timeout=180)
|
||||||
best_solutions_hard, fitness_lists_hard, times_hard = TSP_Bench_PATH(os.path.join(root, "data/hard/"), model, timeout=300)
|
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_simple)
|
||||||
best_solutions_all.append(best_solutions_medium)
|
best_solutions_all.append(best_solutions_medium)
|
||||||
best_solutions_all.append(best_solutions_hard)
|
best_solutions_all.append(best_solutions_difficult)
|
||||||
|
|
||||||
fitness_lists_all.append(fitness_lists_simple)
|
fitness_lists_all.append(fitness_lists_simple)
|
||||||
fitness_lists_all.append(fitness_lists_medium)
|
fitness_lists_all.append(fitness_lists_medium)
|
||||||
fitness_lists_all.append(fitness_lists_hard)
|
fitness_lists_all.append(fitness_lists_difficult)
|
||||||
|
|
||||||
times_all.append(times_simple)
|
times_all.append(times_simple)
|
||||||
times_all.append(times_medium)
|
times_all.append(times_medium)
|
||||||
times_all.append(times_hard)
|
times_all.append(times_difficult)
|
||||||
|
|
||||||
return [item for sublist in best_solutions_all for item in sublist], [item for sublist in fitness_lists_all for item in sublist], [item for sublist in times_all for item in sublist]
|
return [item for sublist in best_solutions_all for item in sublist], [item for sublist in fitness_lists_all for item in sublist], [item for sublist in times_all for item in sublist]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue