diff --git a/Workshop - 1 (Random, BFS, DFS, DP).ipynb b/Workshop - 1 (Random, BFS, DFS, DP).ipynb index f7a1dd4..4faa6ee 100644 --- a/Workshop - 1 (Random, BFS, DFS, DP).ipynb +++ b/Workshop - 1 (Random, BFS, DFS, DP).ipynb @@ -69,7 +69,7 @@ "cell_type": "markdown", "metadata": {}, "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", "# pcb442: 58952 (BFS), 61984 (DFS)\n", "\n", - "# Hard\n", + "# Difficult\n", "# dsj1000: time-out (DP-BFS) 23,552,227 (DP-DFS)" ] }, diff --git a/Workshop - 2 (UCS, A, Hill-Climbing).ipynb b/Workshop - 2 (UCS, A, Hill-Climbing).ipynb index 0384a83..cf10744 100644 --- a/Workshop - 2 (UCS, A, Hill-Climbing).ipynb +++ b/Workshop - 2 (UCS, A, Hill-Climbing).ipynb @@ -69,7 +69,7 @@ "cell_type": "markdown", "metadata": {}, "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", "# pcb442: 58952 (UCS-BFS), time-out (A-Star)\n", "\n", - "# Hard\n", + "# Difficult\n", "# dsj1000: time-out (UCS-BFS), 542,620,572 (Hill-Climbing)" ] }, diff --git a/Workshop - 4 (TSP SA).ipynb b/Workshop - 4 (TSP SA).ipynb index f5c957c..fc21548 100644 --- a/Workshop - 4 (TSP SA).ipynb +++ b/Workshop - 4 (TSP SA).ipynb @@ -69,7 +69,7 @@ "cell_type": "markdown", "metadata": {}, "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**." ] }, { diff --git a/Workshop - 5 (ACO, PSO).ipynb b/Workshop - 5 (ACO, PSO).ipynb index f54c550..865c9b5 100644 --- a/Workshop - 5 (ACO, PSO).ipynb +++ b/Workshop - 5 (ACO, PSO).ipynb @@ -69,7 +69,7 @@ "cell_type": "markdown", "metadata": {}, "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**." ] }, { diff --git a/Workshop - 6 (GA, SOM).ipynb b/Workshop - 6 (GA, SOM).ipynb index 9c6d996..d5dca89 100644 --- a/Workshop - 6 (GA, SOM).ipynb +++ b/Workshop - 6 (GA, SOM).ipynb @@ -69,7 +69,7 @@ "cell_type": "markdown", "metadata": {}, "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**." ] }, { diff --git a/template/data/hard/dsj1000.tsp b/template/data/difficult/dsj1000.tsp similarity index 100% rename from template/data/hard/dsj1000.tsp rename to template/data/difficult/dsj1000.tsp diff --git a/template/main.py b/template/main.py index 1f73678..32851b7 100644 --- a/template/main.py +++ b/template/main.py @@ -1,9 +1,26 @@ -import os -import signal -import json +import argparse from tsp import TSP_Bench_ALL +from tsp import TSP_Bench_PATH + from model.my_model import MyModel 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) diff --git a/template/tsp.py b/template/tsp.py index 6ad480f..2fbade1 100644 --- a/template/tsp.py +++ b/template/tsp.py @@ -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_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_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_medium) - fitness_lists_all.append(fitness_lists_hard) + fitness_lists_all.append(fitness_lists_difficult) times_all.append(times_simple) 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]