`tsp-tools` is a package for Traveling Salesman Problem for Python.
Project description
tsp-tools is a package for Traveling Salesman Problem for Python.
import tsp_tools t = tsp_tools.tsp([(0,0), (0,1), (1,0), (1,1)]) print(t) # distance, node index list >>> (4, [0, 2, 3, 1]) mat = [[ 0, 1, 1, 1.5], [ 1, 0, 1.5, 1], [ 1, 1.5, 0, 1], [1.5, 1, 1, 0]] # Distance Matrix r = range(len(mat)) # Dictionary of distance dist = {(i, j): mat[i][j] for i in r for j in r} print(tsp_tools.tsp(r, dist)) >>> (4, [0, 2, 3, 1])
Note: When large size, ortoolpy.ortools_vrp may be efficient.
See also https://pypi.org/project/ortoolpy/
Requirements
Python 3
more-itertools
Features
nothing
Setup
$ pip install tsp-tools
History
0.0.1 (2015-10-2)
first release
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
tsp-tools-0.1.0.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for tsp_tools-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f366156d200b9b16945d53aa05c6dbafce236784d1ab205819ee34e537bb17 |
|
MD5 | 97753db7316244edd2ea9990a460b5ef |
|
BLAKE2b-256 | 8a37df5febbd7afef278f5e037691eea8b975cca410b87523f37a60c39c09cba |