No project description provided
Project description
Traveling Salesman Problem (TSP) Solver
This python library gives a solver to efficiently find good sub-optimal solutions to the TSP. It uses the 2-opt heuristic and the search part is implemented in rust.
Install
To install the library, run:
pip install tsp_2opt
For now, the library is working only on MacOS X platforms.
Use
The current version relies on the availability of a distance matrix, i.e. matrix giving pair-wise distance between cities in the TSP instance.
Here is a small example :
from tsp_2opt.solver import tsp_solver
distances = [[0, 2, 3], [2, 0, 4], [3, 4, 0]]
route, length = tsp_solver(distances)
The solution obtained to a TSP instance after performing the 2-opt heuristic depends on the initial solution (starting point of the search), therefore this library runs the heuristic n times with n different starting point in parralel (true parallelism is possible thanks to rust) and the best obtained is returned. You can pass n as a parameter to tsp_solver() and control the maximum number of workers :
tsp_solver(distances, workers, n)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsp_2opt-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl.
File metadata
- Download URL: tsp_2opt-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl
- Upload date:
- Size: 161.5 kB
- Tags: CPython 3.8, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06c65dd1081ad6d7bb01cee4ccfc1be16041ca1dbcc60c894be104e476c0d607
|
|
| MD5 |
eb6850be882d38259fe59385ebdd962e
|
|
| BLAKE2b-256 |
3f9d7985b5c0c188bd9fb9eec22c0c3793dc49d2c4a5a3e999f1705041161ba8
|