set.seed(1)
n <- 25
z <- cbind(runif(n,min=1,max=10),runif(n,min=1,max=10))
d <- compute_distance_matrix(z)
c1 <- sample(1:n)
c2 <- sample(1:n)
c12 <- crossover_tours(c1, c2, d, n)
compute_tour_distance(c1, d) # 114.5848
compute_tour_distance(c2, d) # 112.8995
compute_tour_distance(c12[1,], d) # 116.3589
compute_tour_distance(c12[2,], d) # 111.5184
Run the code above in your browser using DataLab