# NOT RUN {
##################################
## Optimizing the sphere function
# define sphere function as objective function
sphere <- function(x){
return(sum(x^2))
}
## Define parameter
numVar <- 5
rangeVar <- matrix(c(-10,10), nrow=2)
## calculate the optimum solution using Ant Lion Optimizer
resultWOA <- WOA(sphere, optimType="MIN", numVar, numPopulation=20,
maxIter=100, rangeVar)
## calculate the optimum value using sphere function
optimum.value <- sphere(resultWOA)
# }
Run the code above in your browser using DataLab