Download DATA.zip
from Canvas and extract all files to the data/
directory.
Run the program using the following script
python run_tsp.py -inst <filename> -alg [BF | Approx | LS] -time <cutoff_in_seconds> -seed <random_seed>
For example, to run brute force:
python run_tsp.py -inst Atlanta.tsp -alg BF -time 600 -seed 0
: run the brute force algorithm on theAtlanta
graph in thedata/
directory.
To run local search:
python run_tsp.py -inst Atlanta.tsp -alg LS -time 600 -seed 0
To run approximation:
python run_tsp.py -inst Atlanta.tsp -alg Approx -time 600 -seed 0
Alternatively, you can also use our provided exec
file, which is just a bash script:
./exec -inst Atlanta.tsp -alg BF -time 600 -seed 0
./exec -inst Atlanta.tsp -alg LS -time 600 -seed 0
./exec -inst Atlanta.tsp -alg Approx -time 600 -seed 0
python >= 3.6
We will need PyInstaller.
-
Install PyInstaller: PyInstaller can be installed using pip. Open your terminal and run:
-
pip install pyinstaller
-
Create the Executable: Navigate to the project directory
CSE6140_TSP
run the following command: -
Generate the executable
pyinstaller --onefile run_tsp.py
The
--onefile
option tells PyInstaller to package everything into a single executable file. -
Generate the executable
pyinstaller --onefile run_tsp.py