Learn R Programming

gor (version 2.0)

plot_tour: TSP tour simple plotting

Description

Plotting tours constructed by tour-building routines for TSP

Usage

plot_tour(z, h, ...)

Value

This function is called by its side effect.

Arguments

z

Set of points of a TSP

h

List with $tour and $distance components returned from a TSP tour building algorithm

...

Parameters to be passed to plot

Author

Cesar Asensio

Details

It plots the two-dimensional cities of a TSP and a tour among them for visualization purposes. No aesthetically appealing effort has been invested in this function.

See Also

build_tour_nn nearest neighbor heuristic with a single starting point, build_tour_nn_best repeats the previous algorithm with all possible starting points, compute_distance_matrix computes the distance matrix of a set of two-dimensional points.

Examples

Run this code
set.seed(1)
n <- 25
z <- cbind(runif(n,min=1,max=10),runif(n,min=1,max=10))
d <- compute_distance_matrix(z)
b <- build_tour_nn_best(d, n)
plot_tour(z,b)

Run the code above in your browser using DataLab