文件名称:weka
介绍说明--下载内容均来自于网络,请自行研究使用
tspData <- read.csv( D:\\weka\\hw\\TSP.csv , header = T, sep = , )
#tspData <- `colnames<-`(tspData,c(1:8))
D <- as.matrix(tspData)
tourLength <- function(tour, distMatrix)
{ tour <- c(tour, tour[1])
route <- embed(tour, 2)[, 2:1]
sum(distMatrix[route]) }
tpsFitness <- function(tour, ...) 1/tourLength(tour, ...)
GA.fit <- ga(type = permutation , fitness = tpsFitness, distMatrix = tspData, min = 1, max = 8, popSize = 10, maxiter = 500, run = 100, pmutation = 0.2, monitor = NULL)
summary(GA.fit)
-tspData <- read.csv( D:\\weka\\hw\\TSP.csv , header = T, sep = , )
#tspData <- `colnames<-`(tspData,c(1:8))
D <- as.matrix(tspData)
tourLength <- function(tour, distMatrix)
{ tour <- c(tour, tour[1])
route <- embed(tour, 2)[, 2:1]
sum(distMatrix[route]) }
tpsFitness <- function(tour, ...) 1/tourLength(tour, ...)
GA.fit <- ga(type = permutation , fitness = tpsFitness, distMatrix = tspData, min = 1, max = 8, popSize = 10, maxiter = 500, run = 100, pmutation = 0.2, monitor = NULL)
summary(GA.fit)
#tspData <- `colnames<-`(tspData,c(1:8))
D <- as.matrix(tspData)
tourLength <- function(tour, distMatrix)
{ tour <- c(tour, tour[1])
route <- embed(tour, 2)[, 2:1]
sum(distMatrix[route]) }
tpsFitness <- function(tour, ...) 1/tourLength(tour, ...)
GA.fit <- ga(type = permutation , fitness = tpsFitness, distMatrix = tspData, min = 1, max = 8, popSize = 10, maxiter = 500, run = 100, pmutation = 0.2, monitor = NULL)
summary(GA.fit)
-tspData <- read.csv( D:\\weka\\hw\\TSP.csv , header = T, sep = , )
#tspData <- `colnames<-`(tspData,c(1:8))
D <- as.matrix(tspData)
tourLength <- function(tour, distMatrix)
{ tour <- c(tour, tour[1])
route <- embed(tour, 2)[, 2:1]
sum(distMatrix[route]) }
tpsFitness <- function(tour, ...) 1/tourLength(tour, ...)
GA.fit <- ga(type = permutation , fitness = tpsFitness, distMatrix = tspData, min = 1, max = 8, popSize = 10, maxiter = 500, run = 100, pmutation = 0.2, monitor = NULL)
summary(GA.fit)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ga-r-console.txt
ga.txt