Learn R Programming

TSP (version 0.1-2)

solve_TSP: TSP solver interface

Description

Common interface to all symmetric TSP solvers in this package.

Usage

solve_TSP(x, method, control)

Arguments

x
the TSP given as an object of class TSP.
method
method to solve the TSP (default: farthest insertion algorithm; see details).
control
a list of arguments passed on to the TSP solver selected by method.

Value

  • An object of class TOUR.

Details

Currently the following methods are available: [object Object],[object Object],[object Object]

References

Concorde home page http://www.tsp.gatech.edu/concorde/

David Appletgate, Robert Bixby, Vasek Chvatal, William Cook (2001): TSP cuts which do not conform to the template paradigm, Computational Combinatorial Optimization, M. Junger and D. Naddef (editors), Springer.

D. S. Johnson, C. H. Papadimitriou (1985): Performance guarantees for heuristics (chapter 5). In: E. L. Lawler, J. K. Lenstra, A.H.G. Rinnooy Kan, D. B. Shmoys (eds.) The traveling salesman problem - A guided tour of combinatorial optimization, Wiley & Sons.

See Also

TOUR, TSP, write_TSPLIB, tsp_concorde_help.

Examples

Run this code
data("iris")

## create TSP
tsp <- TSP(dist(iris[1:4]))

## reorder
tour1 <- solve_TSP(tsp)
tour2 <- solve_TSP(tsp, method = "nearest_insertion")
tour3 <- solve_TSP(tsp, method = "greedy", control = list(start = 1)) 

tour1
tour2
tour3

## use the external solver which has to be installed separately
tour4 <- solve_TSP(tsp, method = "concorde")
tour4

Run the code above in your browser using DataLab