Two-Opt
Implementation of a Two-Opt local search.
optim2Opt(x = NULL, fun, control = list())
x |
start solution of the local search |
fun |
function that determines cost or length of a route/permutation |
control |
(list), with the options:
|
a list with:
xbest
best solution found
ybest
fitness of the best solution
count
number of performed target function evaluations
Wikipedia contributors. "2-opt." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 13 Jun. 2014. Web. 21 Oct. 2014. (http://en.wikipedia.org/wiki/2-opt)
seed=0 #distance dF <- distancePermutationHamming #creation cF <- function()sample(5) #objective function lF <- landscapeGeneratorUNI(1:5,dF) #start optimization set.seed(seed) res <- optim2Opt(,lF,list(creationFunction=cF,budget=100, vectorized=TRUE)) ##target function is "vectorized", expects list of solutions as input res
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.