You can download it as zip or clone it using cmd
git clone https://github.com/Inf1n8/TSP_GA.git
cd TSA_GPA/
Make sure you have the package virtualenv if not then execute pip install virtualenv
- Windows
virtualenv venv
venv\Scripts\activate
- Linux
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Parameters can be changed in config.json
{
"num_location" : 20,
"elite_size" : 20,
"num_generations" : 500,
"population_size" : 100,
"mutation_rate" : 0.01
}
If you want to run the jupyter notebook then type the following command in your terminal:
$> jupyter notebook
Click TSA_GA and run all the cells
Else you can run the python file directly using the command:
python main.py
When you run the python file we get the following outputs:
- Initial distance to complete travelling all the locations
- Final Distance to complete travelling all the locations after n generations
- The best route which can be taken with minimum distance
- Graph visualization between Distance and Generations
- Plot the path that can be taken to cover all the locations