Python project scaffold
Project description
tspsolve
Algorithms for the traveling salesman problem (TSP) in Python.
Implemented so far:
-
Nearest neighbor algorithm
import tspsolve # Create matrix of distances d path = tspsolve.nearest_neighbor(d)
-
2-opt improvement
import tspsolve # Create matrix of distances d and an initial path new_path = tspsolve.two_opt(d, path, verbose=True)
For Euclidiean TSP, the distance matrix can be computed efficiently with
dx = numpy.subtract.outer(x, x)
dy = numpy.subtract.outer(y, y)
d = numpy.sqrt(dx ** 2 + dy ** 2)
Installation
tspsolve is available from the Python Package Index, so simply type
pip install -U tspsolve
to install or upgrade.
Testing
To run the tspsolve unit tests, check out this repository and type
pytest
Distribution
To create a new release
-
bump the
__version__number, -
publish to PyPi and GitHub:
make publish
License
tspsolve is published under the MIT license.
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 Distribution
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 tspsolve-0.1.0.tar.gz.
File metadata
- Download URL: tspsolve-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1788778c683c5d360bd99e0363fd2280e1b9ce8f1f4454526b2d8d3f96215c0
|
|
| MD5 |
c0694e6863357e7e93d409501c10f888
|
|
| BLAKE2b-256 |
48f1bb6ebe41eca3fe831e0007e3eca6ef3ec28f1b3a45cd55de7948f826299b
|
File details
Details for the file tspsolve-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: tspsolve-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c162b71222e086ddca6a43d3874164c98cfdd22913a9c17f6b44972c9dcdbc2
|
|
| MD5 |
b73310470682d9834330a007349bba70
|
|
| BLAKE2b-256 |
e82cc08c1f37b0587da38f3936509d69ec5dc9ec09f96744743bc8a2705d66e4
|