Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mhahsler/tsp

Traveling Salesperson Problem - R package
https://github.com/mhahsler/tsp

concorde-tsp-solver cran r tsp

Last synced: 8 days ago
JSON representation

Traveling Salesperson Problem - R package

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r echo=FALSE, results = 'asis'}
pkg <- 'TSP'

source("https://raw.githubusercontent.com/mhahsler/pkg_helpers/main/pkg_helpers.R")
pkg_title(pkg)
```
[![Anaconda.org](https://anaconda.org/conda-forge/r-tsp/badges/version.svg)](https://anaconda.org/conda-forge/r-tsp)

## Introduction

This package provides the
basic infrastructure and some algorithms for the traveling
salesman problems (symmetric, asymmetric and Euclidean TSPs).
The package provides some simple algorithms and
an interface to the [Concorde TSP solver](http://www.math.uwaterloo.ca/tsp/concorde/) and its implementation of the
Chained-Lin-Kernighan heuristic.

```{r echo=FALSE, results = 'asis'}
pkg_usage(pkg)
pkg_citation(pkg, 2L)
pkg_install(pkg)
```

## Usage

Load a data set with 312 cities (USA and Canada) and create a TSP object.
```{r}
library("TSP")
data("USCA312")

tsp <- TSP(USCA312)
tsp
```

Find a tour using the default heuristic.
```{r}
tour <- solve_TSP(tsp)
tour
```

Show the first few cities in the tour.
```{r}
head(tour, n = 10)
```

An online example application of TSP can be found on [shinyapps](https://shrinidhee.shinyapps.io/SimpleTSP).

## Help and Bug Reports

You can find Q&A's and ask your own questions at
https://stackoverflow.com/search?q=TSP+R

Please submit bug reports to https://github.com/mhahsler/TSP/issues

## References

* Michael Hahsler and Kurt Hornik, [TSP - Infrastructure for the Traveling Salesperson Problem,](http://dx.doi.org/10.18637/jss.v023.i02) _Journal of Statistical Software,_ 22(2), 2007.
* [TSP package vignette](https://cran.r-project.org/package=TSP/vignettes/TSP.pdf) with complete examples.
* [Reference manual](https://cran.r-project.org/package=TSP/TSP.pdf)
* [Concorde TSP solver home page.](http://www.math.uwaterloo.ca/tsp/concorde/)