To raise your interest in TSP and GA, SA, Click here to take a look at what this repo do to solve TSP.
This report is structured as follow:
.
├── doc
│ ├── assets
│ ├── report.md
│ └── report.pdf
├── GeneticAlgorithm
│ ├── bin
│ ├── src
│ └── testcases
├── LocalSearch
│ ├── bin
│ ├── src
│ └── testcases
└── SimulatedAnnealing
├── bin
├── src
└── testcases
14 directories, 2 files
Where:
-
doc/
stores the report and assets.
-
LocalSearch/
LocalSearch implementation, in standard organization(src/ for source code, bin/ for binary excutable program, testcases/ for tests).
-
SimulatedAnnealing/
SimulatedAnnealing implementation, in standard organization(src/ for source code, bin/ for binary excutable program, testcases/ for tests).
-
GeneticAlgorithm/
GeneticAlgorithm implementation, in standard organization(src/ for source code, bin/ for binary excutable program, testcases/ for tests).
Note:
- Method :
LocalSearch
,SimulatedAnnealing
,GeneticAlgorithm
- Excutable :
local_search
,simulated_annealing
,genetic_algorithm
-
Copy tsp problem file and solution file to testcases
$ cp ${PATH}/${TSP_NAME}.tsp ${PATH}/${TSP_NAME}.opt.tour ${Method}/testcases/
-
Enter the directory of algorithm you'd like to run.
$ cd ${Method}/bin/
or re-build
$ cd ${Method}/src/ && make clean && make && cd ../bin/
-
Run to solve TSP problem
$ ./${Excutable} ${TSP_NAME} # e.g. ./local_search a280
And then, follow the instruction in command-line.
Remember to press [Enter] to save the result and history, in
testcases/
. -
Visualization
Visualization is based on Python 3.7 and matplotlib, please ensure you've installed them on your device.
$ cd ../testcases/ $ python Benchmarker.py [ls/sa/ga] ${TSP_NAME}
Please choose from [ls/sa/ga] according to the method you've chosen.
Python script will automatically create a directory, please wait for a moment.
Since the result gifs are too large to present here, I build a web-demo here for your convenience, enjoy it and please be patient with those gifs which may loads from server for a while, thanks.
2020/6