The R Project SVN R

Rev

Rev 27474 | Rev 29354 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27474 Rev 27716
Line 247... Line 247...
247
(r2 <- optim(res$par, fw, method="BFGS"))
247
(r2 <- optim(res$par, fw, method="BFGS"))
248
points(r2$par, r2$val, pch = 8, col = "red", cex = 2)
248
points(r2$par, r2$val, pch = 8, col = "red", cex = 2)
249
 
249
 
250
## Combinatorial optimization: Traveling salesman problem
250
## Combinatorial optimization: Traveling salesman problem
251
library(stats) # normally loaded
251
library(stats) # normally loaded
252
library(ts)  # for embed, normally loaded
-
 
253
 
252
 
254
data(eurodist)
253
data(eurodist)
255
eurodistmat <- as.matrix(eurodist)
254
eurodistmat <- as.matrix(eurodist)
256
 
255
 
257
distance <- function(sq) {  # Target function
256
distance <- function(sq) {  # Target function