TSP-GA-master
所属分类:数值算法/人工智能
开发工具:Python
文件大小:7KB
下载次数:1
上传日期:2021-01-02 12:03:12
上 传 者:
Kyrin656
说明: 基于python语言,智能优化算法解决优化组合问题,ga求解tsp
(Genetic algorithm for traveling salesman problem)
文件列表:
LICENSE (1076, 2018-07-20)
data (0, 2018-07-20)
data\cities.csv (506, 2018-07-20)
setup.py (859, 2018-07-20)
src (0, 2018-07-20)
src\main.py (1398, 2018-07-20)
src\tsp_ga.py (5628, 2018-07-20)
src\utils.py (1558, 2018-07-20)
## Overview
This repository contains a generic Python implementation of a Genetic Algorithm to solve the Travelling Salesman Problem (TSP). Geographic coordinates of cities are provided as input to generate a edge-weighted complete graph where the weights are the distance between the cities in kilometers.
## Output Example
![output-ga](https://i.imgur.com/Zkj0z7m.png)
## Requirements
You'll need Python 3.x x*** to be able to run theses projects.
If you do not have Python installed yet, it is recommended that you install the [Anaconda](https://www.anaconda.com/download/) distribution of Python, which has almost all packages required in these project.
You can also install Python 3.x x*** from [here](https://www.python.org/downloads/)
## Instructions
1. Clone the repository and navigate to the downloaded folder.
```bash
git clone https://github.com/lccasagrande/TSP-GA.git
cd TSP-GA
```
2. Install required packages:
```bash
pip install -e .
```
Or:
```bash
pip install -e . --user
```
3. Navigate to the src folder and execute:
```bash
cd src
python main.py -v 1 --pop_size 500 --tourn_size 50 --mut_rate 0.02 --n_gen 20 --cities_fn '../data/cities.csv'
```
近期下载者:
相关文件:
收藏者: