View source: R/10-grafos-TSP.R
perturb_tour_4exc | R Documentation |
It performs a random 4-exchange transformation to a cycle.
perturb_tour_4exc(C, V, n)
C |
Cycle to be 4-exchanged |
V |
1:n list, positions to draw from |
n |
Number of vertices of the cycle |
The transformation is carried out by randomly selecting four non-mutually incident edges from the cycle. Upon eliminating these four edges, we obtain four pieces ci of the original cycle. The 4-exchanged cycle is c1, c4, c3, c2. This is a typical 4-exchange which cannot be constructed using 2-exchanges and therefore it is used by local search routines as an escape from 2-opt local minima.
The 4-exchanged cycle.
Cesar Asensio
set.seed(1)
perturb_tour_4exc(1:9, 1:9, 9) # 2 3 9 1 7 8 4 5 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.