Skip to content

shmulvad/fast-tsp

Repository files navigation

fast-tsp

Documentation Status Pip Actions Status PyPI - Version GitHub issues GitHub license

A library for computing near optimal solution to large instances of the TSP (Travelling Salesman Problem) fast using a local solver. The library is written in C++ and provides Python bindings.

Quickstart

First install the library

$ pip install fast-tsp

Then run the problem on your 2D distance matrix:

import fast_tsp
dists = [
    [ 0, 63, 72, 70],
    [63,  0, 57, 53],
    [72, 57,  0,  4],
    [70, 53,  4,  0],
]
tour = fast_tsp.find_tour(dists)
print(tour)  # [0, 1, 3, 2]

Documentation

Documentation can be found at https://fast-tsp.readthedocs.io/.

You can build the documentation by cding to docs/ and running make clean && make html.

Citation

If you find that this project helps your research, please consider citing it using the metadata from the CITATION.cff file.

License

This library is licensed under the MIT license. Additionally, it uses pybind11 which is provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.