TSP/ 0000755 0001762 0000144 00000000000 14413041204 010711 5 ustar ligges users TSP/NAMESPACE 0000644 0001762 0000144 00000003505 14402152764 012147 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method(as.ATSP,dist)
S3method(as.ATSP,matrix)
S3method(as.ETSP,data.frame)
S3method(as.ETSP,matrix)
S3method(as.TOUR,integer)
S3method(as.TOUR,numeric)
S3method(as.TSP,ETSP)
S3method(as.TSP,dist)
S3method(as.TSP,matrix)
S3method(as.dist,TSP)
S3method(as.matrix,ATSP)
S3method(as.matrix,ETSP)
S3method(cut_tour,TOUR)
S3method(image,ATSP)
S3method(image,ETSP)
S3method(image,TSP)
S3method(insert_dummy,ATSP)
S3method(insert_dummy,ETSP)
S3method(insert_dummy,TSP)
S3method(labels,ATSP)
S3method(labels,ETSP)
S3method(labels,TSP)
S3method(n_of_cities,ATSP)
S3method(n_of_cities,ETSP)
S3method(n_of_cities,TSP)
S3method(n_of_cities,default)
S3method(plot,ETSP)
S3method(print,ATSP)
S3method(print,ETSP)
S3method(print,TOUR)
S3method(print,TSP)
S3method(solve_TSP,ATSP)
S3method(solve_TSP,ETSP)
S3method(solve_TSP,TSP)
S3method(tour_length,ATSP)
S3method(tour_length,ETSP)
S3method(tour_length,TOUR)
S3method(tour_length,TSP)
S3method(tour_length,integer)
S3method(write_TSPLIB,ATSP)
S3method(write_TSPLIB,ETSP)
S3method(write_TSPLIB,TSP)
export(ATSP)
export(ETSP)
export(TOUR)
export(TSP)
export(as.ATSP)
export(as.ETSP)
export(as.TOUR)
export(as.TSP)
export(concorde_help)
export(concorde_path)
export(cut_tour)
export(filter_ATSP_as_TSP_dummies)
export(insert_dummy)
export(linkern_help)
export(n_of_cities)
export(read_TSPLIB)
export(reformulate_ATSP_as_TSP)
export(solve_TSP)
export(tour_length)
export(write_TSPLIB)
importFrom(foreach,"%dopar%")
importFrom(foreach,foreach)
importFrom(grDevices,gray.colors)
importFrom(graphics,image.default)
importFrom(graphics,plot)
importFrom(graphics,polygon)
importFrom(graphics,text)
importFrom(stats,as.dist)
importFrom(stats,dist)
importFrom(utils,head)
importFrom(utils,read.table)
importFrom(utils,tail)
importFrom(utils,write.table)
useDynLib(TSP, .registration=TRUE)
TSP/README.md 0000644 0001762 0000144 00000005110 14402144250 012170 0 ustar ligges users
#
R package TSP - Traveling Salesperson Problem (TSP)
[](https://CRAN.R-project.org/package=TSP)
[](https://mhahsler.r-universe.dev/TSP)
[](https://CRAN.R-project.org/package=TSP)
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.
## Installation
**Stable CRAN version:** Install from within R with
``` r
install.packages("TSP")
```
**Current development version:** Install from
[r-universe.](https://mhahsler.r-universe.dev/TSP)
``` r
install.packages("TSP", repos = "https://mhahsler.r-universe.dev")
```
## 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
```
## object of class 'TSP'
## 312 cities (distance 'euclidean')
Find a tour using the default heuristic.
``` r
tour <- solve_TSP(tsp)
tour
```
## object of class 'TOUR'
## result of method 'arbitrary_insertion+two_opt' for 312 cities
## tour length: 41389
Show the first few cities in the tour.
``` r
head(tour, n = 10)
```
## Jacksonville, FL Gainesville, FL Daytona Beach, FL
## 127 101 72
## Orlando, FL Tampa, FL Saint Petersburg, FL
## 190 275 234
## Sarasota, FL West Palm Beach, FL Miami, FL
## 247 296 164
## Key West, FL
## 136
An online example application of TSP can be found on
[shinyapps](https://shrinidhee.shinyapps.io/SimpleTSP).
## 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/)
TSP/data/ 0000755 0001762 0000144 00000000000 13623555031 011634 5 ustar ligges users TSP/data/USCA312.rda 0000644 0001762 0000144 00000226044 12606077054 013321 0 ustar ligges users 7zXZ i"6 ! XS] )TW"nRʟXS#&'ƯNP7ϡBDxo"ZZk_^Cl'תᙧ38_efTaWFon됤1>C}CqR=/x AcGy)4myNc5G_fS