# NOT RUN {
##################################
## Optimizing the quartic with noise function
# define Quartic with noise function as objective function
quartic <- function(x){
dim <- length(x)
result <- sum(c(1:dim)*(x^4))+runif(1)
return(result)
}
## Define parameter
B0 <- 1
gamma <- 1
alphaFFA <- 0.2
numVar <- 5
rangeVar <- matrix(c(-1.28,1.28), nrow=2)
## calculate the optimum solution using Firefly Algorithm
resultFFA <- FFA(quartic, optimType="MIN", numVar, numPopulation=20,
maxIter=100, rangeVar, B0, gamma, alphaFFA)
## calculate the optimum value using sphere function
optimum.value <- quartic(resultFFA)
# }
Run the code above in your browser using DataLab