caRamel is a multiobjective evolutionary algorithm combining the MEAS algorithm and the NGSA-II algorithm.
Download the package from CRAN or GitHub and then install and load it.
The Kursawe test function to optimize has two objectives and three variables.
kursawe <- function(i) {
k1 <- -10 * exp(-0.2 * sqrt(x[i,1] ^ 2 + x[i,2] ^ 2)) - 10 * exp(-0.2 * sqrt(x[i,2] ^2 + x[i,3] ^ 2))
k2 <- abs(x[i,1]) ^ 0.8 + 5 * sin(x[i,1] ^ 3) + abs(x[i,2]) ^ 0.8 + 5 * sin(x[i,2] ^3) + abs(x[i,3]) ^ 0.8 + 5 * sin(x[i,3] ^ 3)
return(c(k1, k2))
}
For instance, the following caRamel parameters for all the Kursawe optimizations can be:
nvar <- 3 # number of variables
bounds <- matrix(data = 1, nrow = nvar, ncol = 2) # upper and lower bounds
bounds[, 1] <- -5 * bounds[, 1]
bounds[, 2] <- 5 * bounds[, 2]
nobj <- 2 # number of objectives
minmax <- c(FALSE, FALSE) # minimization for both objectives
popsize <- 100 # size of the genetic population
archsize <- 100 # size of the archive for the Pareto front
maxrun <- 1000 # maximum number of calls
prec <- matrix(1.e-3, nrow = 1, ncol = nobj) # convergence criteria
In this part we will run caRamel three times on the Kursawe test function and save all the front results.
nrepeat <- 3 # number of calls to caRamel
concat_results_objectives <- NULL # save results for all the calls
concat_results_parameters <- NULL
for (i in seq(nrepeat)) {
optres <- caRamel(nobj,
nvar,
minmax,
bounds,
kursawe,
popsize,
archsize,
maxrun,
prec,
carallel = 0,
graph = FALSE,
verbose = FALSE)
concat_results_objectives <- rbind(concat_results_objectives,
optres$objectives)
concat_results_parameters <- rbind(concat_results_parameters,
optres$parameters)
}
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 7 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 11 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 10 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 8 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 8 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 10 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 5 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 9 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 5 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 14 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 9 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 11 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 5 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 4 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 9 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 7 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 2 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 3 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 15 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 1 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 17 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 18 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
## Warning in delaunayn(obj): 15 points missing from triangulation.
## It is possible that setting the 'options' argument of delaunayn may help.
## For example:
## options = "Qt Qc Qz Qbb"
## options = "Qt Qc Qz QbB"
## If these options do not work, try shifting the centre of the points
## to the origin by subtracting the mean coordinates from every point.
Then all the results are reduced using the pareto function in order to get a new global front:
results_objectives <- concat_results_objectives
results_objectives[, !minmax] <- -results_objectives[, !minmax] # important !
is_pareto <- pareto(results_objectives) # mask
global_results_objectives <- concat_results_objectives[is_pareto, ] # front from the three previous fronts
global_results_parameters <- concat_results_parameters[is_pareto, ]