tsp-grasp
Welcome to tsp-grasp! A Python package with Heuristics for solving the Traveling Salesman Problem (TSP).
Install
The package tspgrasp is available on PyPI, so you can install it via pip by running the following command line:
pip install tspgrasp
To install the package in development versions, clone it from github using:
git clone https://github.com/bruscalia/tsp-grasp.git
And run one of the two following commands:
pip install .
python setup.py install
Make sure Cython and numpy are also available in your python environment.
Alternatively, you can directly run:
pip install git+https://github.com/bruscalia/tsp-grasp.git
Here is a minimum working example in which a symmetric distance matrix is produced from 2-dimensional coordinates.
Use
# Imports
import numpy as np
from scipy.spatial.distance import pdist, squareform
from tspgrasp import Grasp
# Create distance matrix
X = np.random.random((100, 2))
D = squareform(pdist(X))
# Instantiate algorithm and solve problem
grasp = Grasp(seed=12)
sol = grasp(D, time_limit=10, max_iter=100)
# Display cost and tour
print(f"Cost: {sol.cost}")
print(f"Tour: {sol.tour}")
Theory
Greedy Randomized Adaptive Search Procedures (GRASP) are metaheuristics constituted by a hybridization of a semi-greedy procedure with a local search method. For more details please refer to Resende & Ribeiro (2016).
Local search moves implemented were based on the work of Vidal (2022).
Contact
You can reach out to me at bruscalia12@gmail.com
References
Resende, M. G., & Ribeiro, C. C. (2016). Optimization by GRASP. Springer Science+ Business Media New York. https://doi.org/10.1007/978-1-4939-6530-4
Vidal, T. (2022). Hybrid genetic search for the CVRP: Open-source implementation and SWAP* neighborhood. Computers & Operations Research, 140, 105643. https://doi.org/10.1016/j.cor.2021.105643
Metadata
Release files for tspgrasp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tspgrasp-0.1.1.tar.gz | 14.5 kB | Without provenance | Details for tspgrasp-0.1.1.tar.gz |
Built distributions (wheels)
Total release size: 25.8 MB
Release files / tspgrasp-0.1.1.tar.gz
| Download URL | tspgrasp-0.1.1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
509d3225ada9f593317637420a0a9c8d82d64289190e718c52e1cb2153e02822
|
|
BLAKE2b-256 checksum How to use checksums |
11376312b2005f94bb791ae0ed1ac8c416989af2cedd885e7e1e0c8229293167
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp312-cp312-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 520.5 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ed310570b0c8d87b47ab2514982f2099e3378a50fd6f29e8d158e96e063e0fa1
|
|
BLAKE2b-256 checksum How to use checksums |
9c3aab1d3b65c3f78b8a5fc19485e344f78f4dfd96c796a2e23f15e77e0b98a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp312-cp312-macosx_10_9_universal2.whl
| Download URL | tspgrasp-0.1.1-cp312-cp312-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ce99a15a67b8294a5f333e1381a1e5cceee906aa40cbf3a68a2cc049587d4426
|
|
BLAKE2b-256 checksum How to use checksums |
accdbf04ebc6598761d37dec90d3ccb69090a28f15b41283df134ba3d25ce98a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp311-cp311-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 517.0 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1a80505f9fd3d9208515ebf10a449ea6a231a6a2ce3a155f18ca0b4588e0dc84
|
|
BLAKE2b-256 checksum How to use checksums |
592abab471eb4713d3559bc1e8c4d9e21437c05b685e0bf95d022ebd93062642
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
4b72cd37775bc2c75f75902cce62bbb39623b8cef18c0a70121dc5a51bdd69a6
|
|
BLAKE2b-256 checksum How to use checksums |
93d5f01d4953ac0807eaa5d40ce16ea276f2d8645d57df5e055c27198ca1f811
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | tspgrasp-0.1.1-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
517f1b86a0ca3a7460c4d1d8975769c2d3fd3bdd86228327bb76aa3ba98e3ba7
|
|
BLAKE2b-256 checksum How to use checksums |
40494bc4c6df6bbaa4d1e5621366ed7f1de2a5f9d277cf03301a9a7faee93bd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp310-cp310-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 516.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8deb10cd2035a188be2bbb1fb1fa735dc72ceda45bd1974620891aa28f6be556
|
|
BLAKE2b-256 checksum How to use checksums |
dcb3467fc24ce8849dab218a47c5cdc99ee6eb8b2f08136aa02d600d4e0d9b94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2915d5079414c1e97c94ca16adf632c78ce7be4291c7e9d585e2ec070a5ccecd
|
|
BLAKE2b-256 checksum How to use checksums |
04098f5c671f15db3ea002afc7b03a3be60b1068689772ffe2aed7bb45c10f92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp310-cp310-macosx_11_0_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp310-cp310-macosx_11_0_x86_64.whl |
|---|---|
| Size | 584.2 kB |
| Tags | CPython 3.10 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
671868834d4f33cd8c7fb141240bb7debfc5fc6c02b2586a9f56241c2502c3aa
|
|
BLAKE2b-256 checksum How to use checksums |
3656f83c7a6e9d04d6c9df0bcc85f5823dbe2c9cb8113972406ee600fff9cb55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp39-cp39-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 605.1 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f61033355f86050097e59bc2439c3204cbb34697a0a2c279743097e23d136c6c
|
|
BLAKE2b-256 checksum How to use checksums |
98fd60423ee64c63bcc62b75baf6e99e2794f6ca16ad844f09638ace428a23f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
640096e0a46fb297eb9a02592e53e15ee1685a414a7320317e3d02b4363b2871
|
|
BLAKE2b-256 checksum How to use checksums |
c73576271c9ee0a26072a5ca60d9502ca4e7c17701f8300406269d7a474bb619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp39-cp39-macosx_11_0_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp39-cp39-macosx_11_0_x86_64.whl |
|---|---|
| Size | 590.0 kB |
| Tags | CPython 3.9 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
5a1e6d4ea901f9e326e44e21e1e1bec943fc4750f053df26c5a30cc1c8d4a6a7
|
|
BLAKE2b-256 checksum How to use checksums |
913b4fb66f6e4e6bc904afaf1f5da0eeeb0c99db67e9aa46080c101dc46e1939
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp38-cp38-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 610.4 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fbc58b77b95d07d38268645c1e95671535baf742c0630e25b778d8a610072dd4
|
|
BLAKE2b-256 checksum How to use checksums |
c6e9d2fa9205ff019b3ecb73be38fa5e67faf412b50d7017b31b5b8ef1043be2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d7dd14d822e4d051729398892f3d6b33bf180d566a7634524c4c7122554ab34e
|
|
BLAKE2b-256 checksum How to use checksums |
138a00b05486bd3cf38ee9798fa555cc7a80838cad531dda25b60fb0d18d47aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp38-cp38-macosx_11_0_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp38-cp38-macosx_11_0_x86_64.whl |
|---|---|
| Size | 587.9 kB |
| Tags | CPython 3.8 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
14c3c19c62c69d95f89aed2d4a50a9a1bae3833905515898804b0a35e56e4409
|
|
BLAKE2b-256 checksum How to use checksums |
aa09162b17ada60b30b8dd61047845ef2175d95330d6e3f899452eee923d2588
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp37-cp37m-win_amd64.whl
| Download URL | tspgrasp-0.1.1-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 601.7 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
96e73ff53e0afc9bd4697918d487c8cec858f30ec4fed6e2bcd214a679a1e29b
|
|
BLAKE2b-256 checksum How to use checksums |
1a85a6d1e7071d838188a68cdad81d1622620b0cdff55f0adc1152ef266d070e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a24212bf2924975ec30422d6d42acc927cc142dc69f741b47564f0861c3ef89c
|
|
BLAKE2b-256 checksum How to use checksums |
ede896db27f0b15b597e8857f8a87f6023343222eb41cea1962a698d158ef15e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / tspgrasp-0.1.1-cp37-cp37m-macosx_11_0_x86_64.whl
| Download URL | tspgrasp-0.1.1-cp37-cp37m-macosx_11_0_x86_64.whl |
|---|---|
| Size | 591.6 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
194dd4faf7056a1c382bd2a1efb3f63673710aa2d6349152ab31a5bed2cb6429
|
|
BLAKE2b-256 checksum How to use checksums |
7ed2ab857c2e113e6d5fd520bcf923a83049ede7721ffc35626a4766acbec65a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Security for tspgrasp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.