Title: | Many Objective Evolutionary Algorithm |
---|---|
Description: | A set of evolutionary algorithms to solve many-objective optimization. Hybridization between the algorithms are also facilitated. Available algorithms are: 'SMS-EMOA' <doi:10.1016/j.ejor.2006.08.008> 'NSGA-III' <doi:10.1109/TEVC.2013.2281535> 'MO-CMA-ES' <doi:10.1145/1830483.1830573> The following many-objective benchmark problems are also provided: 'DTLZ1'-'DTLZ4' from Deb, et al. (2001) <doi:10.1007/1-84628-137-7_6> and 'WFG4'-'WFG9' from Huband, et al. (2005) <doi:10.1109/TEVC.2005.861417>. |
Authors: | Dani Irawan [aut, cre] |
Maintainer: | Dani Irawan <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.7.1 |
Built: | 2024-11-10 05:30:49 UTC |
Source: | https://github.com/dots26/maoea |
MaOEA contains several algorithms for solving many-objective optimization problems. The algorithms are provided as a sequence of operators used in a single iteration. For example, the SMSEMOA function calls the recombination (SBX) and mutation operator (polynomial mutation) to produce 1 offspring, and perform the S-metric selection. The function then returns a list containing the population and population objective after the procedure is conducted once. The purpose of only doing a single iteration is to support users if they wish to formulate hybrid algorithms.
Alternatively, users can use the optimMaOEA function to solve an optimization problem with their chosen algorithm. This function is a simple wrapper to call the algorithms listed above for several iterations. Using this function, users can simply supply the initial population, objective function, the chosen algorithm, and the number of iterations. If number of iteration is not supplied, then only a single iteration is conducted.
Note: This package uses column-major ordering, i.e. an individual should be contained in a single column, each row represents different variable. All optimization variable should be scaled to 0-1.
Package: | MaOEA |
Type: | Package |
Version: | 0.4.1 |
Date: | 2019-07-12 |
License: | GPL (>= 2) |
LazyLoad: | yes |
This work is funded by the European Commission's H2020 programme through the UTOPIAE Marie Curie Innovative Training Network, H2020-MSCA-ITN-2016, under Grant Agreement No. 722734 as well as through the Twinning project SYNERGY under Grant Agreement No. 692286.
Dani Irawan [email protected]
Dani Irawan [email protected]
Main interface function is optimMaOEA
.
Normalize the objectives to 0-1. The origin is the ideal point. (1,...,1) is not the nadir point. The normalization is done by using adaptive normalization used in NSGA-III.
AdaptiveNormalization(objectiveValue)
AdaptiveNormalization(objectiveValue)
objectiveValue |
Set of objective vectors to normalize |
A list containing the following:
normalizedObjective
The normalized values
idealPoint
The ideal point corresponding to the origin
nadirPoint
The location of nadir point in the normalized Space
nObj <- 5 nIndividual <- 100 nVar <- 10 population <- InitializePopulationLHS(nIndividual,nVar,FALSE) objective <- matrix(,nrow=nObj,ncol=nIndividual) for(individual in 1:nIndividual){ objective[,individual] <- WFG4(population[,individual],nObj) } AdaptiveNormalization(objective)
nObj <- 5 nIndividual <- 100 nVar <- 10 population <- InitializePopulationLHS(nIndividual,nVar,FALSE) objective <- matrix(,nrow=nObj,ncol=nIndividual) for(individual in 1:nIndividual){ objective[,individual] <- WFG4(population[,individual],nObj) } AdaptiveNormalization(objective)
Create a list with cmaes_gen class. Basically, the function transform the population into a class that is accepted by the MOCMAES and SMOCMAES function.
cmaes_gen( population, ps_target = (1/(5 + (1/2)^0.5)), stepSize = 0.5, evoPath = rep(0, nrow(population)), covarianceMatrix = diag(nrow(population)) )
cmaes_gen( population, ps_target = (1/(5 + (1/2)^0.5)), stepSize = 0.5, evoPath = rep(0, nrow(population)), covarianceMatrix = diag(nrow(population)) )
population |
The number of objective functions. A scalar value. |
ps_target |
The target success rate. Used to initialize cmaes_gen$averageSuccessRate. |
stepSize |
The initial step size. |
evoPath |
A vector of numbers indicating evolution path of each variable. |
covarianceMatrix |
Covariance matrix of the variables. |
An object of cmaes_gen class. It can be used as MO-CMA-ES parent. It is a 5 tuple: x (the design point, length = number of variable),averageSuccessRate (scalar),stepSize (scalar), evoPath (evolution path, vector, length = number of variable ),covarianceMatrix (square matrix with ncol = nrow = number of variable).
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 )^0.5 ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- MOCMAES(a_list,nObjective,WFG8,control,nObjective)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 )^0.5 ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- MOCMAES(a_list,nObjective,WFG8,control,nObjective)
Compute the R2-HV from Shang et al.
compute_R2HV(dataPoints, reference, weights = NULL, nPoints = 100)
compute_R2HV(dataPoints, reference, weights = NULL, nPoints = 100)
dataPoints |
The Points coordinate. Each column contains a single point (column major). |
reference |
The reference point for computing R2-mtch (similar as reference for HV) |
weights |
The weights/direction to be used to compute the achievement scalarization. Each column contains a single weight vector. If no weight is supplied, weights are generated using Sobol sequences. |
nPoints |
Used only when no weights are supplied. An input for the weight generator (sobol sequences). This defines how many points are created. |
The function return the powered R2-indicator of the set.
Ke Shang, Hisao Ishibuchi, Min-Ling Zhang, and Yiping Liu. 2018. A new R2 indicator for better hypervolume approximation. In Proceedings of the Genetic and Evolutionary Computation Conference (GECCO '18), Hernan Aguirre (Ed.). ACM, New York, NY, USA, 745-752. DOI: https://doi.org/10.1145/3205455.3205543
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2HV(points,reference)
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2HV(points,reference)
Compute the R2-HVC from Shang et al.
compute_R2HVC( dataPoints, reference, weights = NULL, alpha = 1, nWeight = 300, indexOfInterest = 1:ncol(dataPoints) )
compute_R2HVC( dataPoints, reference, weights = NULL, alpha = 1, nWeight = 300, indexOfInterest = 1:ncol(dataPoints) )
dataPoints |
The Points coordinate. Each column contains a single point (column major). |
reference |
The reference point for computing R2-mtch (similar as reference for HV) |
weights |
The weights/direction to be used to compute the achievement scalarization. Each column contains a single weight vector. If no weight is supplied, weights are generated using Sobol sequences |
alpha |
Power factor on the gmtch and g*2tch utility functions. |
nWeight |
Used only when no weights are supplied. The number of weights generated by sobol sequence. |
indexOfInterest |
individuals to be evaluated. The R2 values will only be reported/returned for these individuals. |
The function return R2-indicator contribution of each point.
K. Shang, H. Ishibuchi and X. Ni, "R2-based Hypervolume Contribution Approximation," in IEEE Transactions on Evolutionary Computation. doi: 10.1109/TEVC.2019.2909271
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2HVC(points,reference)
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2HVC(points,reference)
Compute the R2-mtch indicator from Shang et al.
compute_R2mtch(dataPoints, reference, weights = NULL, nWeight = 100)
compute_R2mtch(dataPoints, reference, weights = NULL, nWeight = 100)
dataPoints |
The Points coordinate. Each column contains a single point (column major). |
reference |
The reference point for computing R2-mtch (similar as reference for HV) |
weights |
The weights/direction to be used to compute the achievement scalarization. Each column contains a single weight vector. If no weight is supplied, weights are generated using Sobol sequences. |
nWeight |
Used only when no weights are supplied. An input for the sobol weight generation. This defines how many points to be generated. |
The function return the R2-indicator of the set.
Ke Shang, Hisao Ishibuchi, Min-Ling Zhang, and Yiping Liu. 2018. A new R2 indicator for better hypervolume approximation. In Proceedings of the Genetic and Evolutionary Computation Conference (GECCO '18), Hernan Aguirre (Ed.). ACM, New York, NY, USA, 745-752. DOI: https://doi.org/10.1145/3205455.3205543
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2mtch(points,reference)
nPointToSample <- 100 nObjective <- 3 points <- matrix(runif(nPointToSample*nObjective), nrow = nObjective) # sample the points ranks <- nsga2R::fastNonDominatedSorting(t(points)) # non-dominated sorting points <- points[,ranks[[1]],drop=FALSE] # take only the non-dominated front nPoints <- ncol(points) # check how many points are on the non-dominated front reference <- rep(2,nObjective) compute_R2mtch(points,reference)
Generate a set of weights following Das and Dennis's method. Each column returned is a weight vector.
createWeights(nDim, axisDivision = nDim + 2, noZero = FALSE)
createWeights(nDim, axisDivision = nDim + 2, noZero = FALSE)
nDim |
The dimensionality of the problem. In EA, usually this is used in the objective space, hence nDim = nObjective |
axisDivision |
Used only when no weights are supplied. An input for the structured weight distribution. This defines how many division are created in each axis. |
noZero |
Default to false. If set to TRUE, reference vector containing zero, e.g. (1,0,0) will be removed. Used to generate weight in modified tch method. |
The function return a set of weight vectors.
Indraneel Das and J. E. Dennis. 1998. Normal-Boundary Intersection: A New Method for Generating the Pareto Surface in Nonlinear Multicriteria Optimization Problems. SIAM Journal on Optimization 1998 8:3, 631-657.
nObjective <- 3 axisDiv <- 6 createWeights(nObjective,axisDiv)
nObjective <- 3 axisDiv <- 6 createWeights(nObjective,axisDiv)
Generate a set of weights following Sobol sequence generator
createWeightsSobol(nWeights, nDim, seed = 4177)
createWeightsSobol(nWeights, nDim, seed = 4177)
nWeights |
Number of weights to generate. |
nDim |
The dimensionality of the problem. In EA, usually this is used in the objective space, hence nDim = nObjective |
seed |
Seed for scrambling |
The function return a set of weight vectors.
nObjective <- 3 nPoint <- 1000 createWeightsSobol(nPoint,nObjective)
nObjective <- 3 nPoint <- 1000 createWeightsSobol(nPoint,nObjective)
The DTLZ1 test function.
DTLZ1(individual, nObj)
DTLZ1(individual, nObj)
individual |
The vector of individual (or matrix of population) to be evaluated. |
nObj |
The number of objective |
A matrix of size nObjective x population size, containing the objective values for each individual.
Deb, K., Thiele, L., Laumanns, M., Zitzler, E.: Scalable Multi-Objective Optimization Test Problems. In: Congress on Evolutionary Computation (CEC). pp. 825–830. IEEE Press, Piscataway, NJ (2002)
individual <- stats::runif(14) nObj <- 4 DTLZ1(individual,nObj)
individual <- stats::runif(14) nObj <- 4 DTLZ1(individual,nObj)
The DTLZ2 test function.
DTLZ2(individual, nObj)
DTLZ2(individual, nObj)
individual |
The vector of individual (or matrix of population) to be evaluated. |
nObj |
The number of objective |
A matrix of size nObjective x population size, containing the objective values for each individual.
Deb, K., Thiele, L., Laumanns, M., Zitzler, E.: Scalable Multi-Objective Optimization Test Problems. In: Congress on Evolutionary Computation (CEC). pp. 825–830. IEEE Press, Piscataway, NJ (2002)
individual <- stats::runif(14) nObj <- 4 DTLZ2(individual,nObj)
individual <- stats::runif(14) nObj <- 4 DTLZ2(individual,nObj)
The DTLZ3 test function.
DTLZ3(individual, nObj)
DTLZ3(individual, nObj)
individual |
The vector of individual (or matrix of population) to be evaluated. |
nObj |
The number of objective |
A matrix of size nObjective x population size, containing the objective values for each individual.
Deb, K., Thiele, L., Laumanns, M., Zitzler, E.: Scalable Multi-Objective Optimization Test Problems. In: Congress on Evolutionary Computation (CEC). pp. 825–830. IEEE Press, Piscataway, NJ (2002)
individual <- stats::runif(14) nObj <- 4 DTLZ3(individual,nObj)
individual <- stats::runif(14) nObj <- 4 DTLZ3(individual,nObj)
The DTLZ4 test function.
DTLZ4(individual, nObj, alpha = 100)
DTLZ4(individual, nObj, alpha = 100)
individual |
The vector of individual (or matrix of population) to be evaluated. |
nObj |
The number of objective |
alpha |
Alpha value of DTLZ4 function. |
A matrix of size nObjective x population size, containing the objective values for each individual.
Deb, K., Thiele, L., Laumanns, M., Zitzler, E.: Scalable Multi-Objective Optimization Test Problems. In: Congress on Evolutionary Computation (CEC). pp. 825–830. IEEE Press, Piscataway, NJ (2002)
individual <- stats::runif(14) nObj <- 4 DTLZ4(individual,nObj)
individual <- stats::runif(14) nObj <- 4 DTLZ4(individual,nObj)
Evaluate individual with the specified test function. Non-feasible solution are given Inf as objective values.
EvaluateIndividual(individual, fun, ...)
EvaluateIndividual(individual, fun, ...)
individual |
The individual to be evaluated |
fun |
A string containing which problem is being solved. Currently available DTLZ1-DTLZ4, WFG4-WFG9. |
... |
Further parameters used by |
A matrix of size nObjective, containing the objective values.
individual <- stats::runif(8) EvaluateIndividual(individual,WFG4,3) # the 3 is passed to WFG4 nObj
individual <- stats::runif(8) EvaluateIndividual(individual,WFG4,3) # the 3 is passed to WFG4 nObj
Evaluate a population with the specified test function. Non-feasible solution are given Inf as objective values.
EvaluatePopulation(pop, fun, ...)
EvaluatePopulation(pop, fun, ...)
pop |
The population to be evaluated |
fun |
A string containing which problem is being solved. Currently available in the package: DTLZ1-DTLZ4, WFG4-WFG9. |
... |
Further parameters used by |
A matrix of size nObjective, containing the objective values.
pop <- matrix(runif(8*50),nrow=8) # 8 variables, 50 individuals EvaluatePopulation(pop,WFG4,3) # the 3 is passed to WFG4 nObj
pop <- matrix(runif(8*50),nrow=8) # 8 variables, 50 individuals EvaluatePopulation(pop,WFG4,3) # the 3 is passed to WFG4 nObj
Get the hypervolume (HV) contribution of the population. Dominated front will give 0 contribution.
GetHVContribution( populationObjective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
GetHVContribution( populationObjective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
populationObjective |
The objective value of the corresponding individual |
reference |
The reference point for computing HV |
method |
the HV computation method. Currently ignored and uses the WFG exact method. |
ref_multiplier |
Multiplier to the nadir point for dynamic reference point location |
A vector of length ncol(populationObjective)
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetHVContribution(objective,reference)
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetHVContribution(objective,reference)
Compute the hypervolume formed by the points w.r.t. a reference point. If no reference is supplied, use the nadir point*(1.1,...,1.1).
GetHypervolume( objective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
GetHypervolume( objective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
objective |
The set of points in the objective space (The objective values). A single column should contain one point, so the size would be numberOfObjective x nPoint, e.g. in 5 objective problem, it is 5 x n. |
reference |
The reference point for HV computation. A column vector. |
method |
Exact using WFG method or approximate HV using the method by Bringmann and Friedrich. Default to "exact". |
ref_multiplier |
Multiplier to the nadir point for dynamic reference point location |
Hypervolume size, a scalar value.
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,reference,"exact") # using reference point
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,reference,"exact") # using reference point
Get Inverted Generational Distance (IGD) value of the population objective w.r.t. a matrix of reference set (each row contain 1 point).
GetIGD(populationObjective, referenceSet)
GetIGD(populationObjective, referenceSet)
populationObjective |
The objective value of the corresponding individual |
referenceSet |
The reference points for computing IGD |
The IGD metric. A Scalar value.
Get the hypervolume (HV) contribution of the individual with least HV contribution.
GetLeastContribution( populationObjective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
GetLeastContribution( populationObjective, reference = NULL, method = "exact", ref_multiplier = 1.1 )
populationObjective |
The objective value of the corresponding individual |
reference |
The reference point for computing HV |
method |
the HV computation method |
ref_multiplier |
Multiplier to the nadir point for dynamic reference point location |
The HV contribution value of the least contributor.
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetLeastContribution(objective,reference,"exact")
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetLeastContribution(objective,reference,"exact")
Get index of the individual with least hypervolume (HV) contribution. For the contribution itself, use GetLeastContribution()
GetLeastContributor( populationObjective, reference = NULL, method = "exact", hypervolumeMethodParam = list(), ref_multiplier = 1.1 )
GetLeastContributor( populationObjective, reference = NULL, method = "exact", hypervolumeMethodParam = list(), ref_multiplier = 1.1 )
populationObjective |
The objective value of the corresponding individual |
reference |
The reference point for computing HV |
method |
the HV computation method |
hypervolumeMethodParam |
A list of parameters to be passed to the hypervolumeMethod |
ref_multiplier |
Multiplier to the nadir point for dynamic reference point location |
The index of the least contributor, an integer.
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetLeastContributor(objective,reference,"exact")
nObjective <- 5 # the number of objectives nPoint <- 10 # the number of points that will form the hypervolume objective <- matrix(stats::runif(nObjective*nPoint), nrow = nObjective, ncol = nPoint) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example GetHypervolume(objective,,"exact") # no reference supplied reference <- rep(2,nObjective) # create a reference point at (2,2,2,2,2) if(py_module_ready) # prevent error on testing the example GetLeastContributor(objective,reference,"exact")
Create initial sample using Latin Hypercube Sampling (LHS) method. The variables will be ranged between 0-1
InitializePopulationLHS( numberOfIndividuals, chromosomeLength, minVal = 0, maxVal = 1, samplingMethod = 0 )
InitializePopulationLHS( numberOfIndividuals, chromosomeLength, minVal = 0, maxVal = 1, samplingMethod = 0 )
numberOfIndividuals |
The number of individual in the population (ncol). Integer > 0. |
chromosomeLength |
The number of variables per individual (nrow) |
minVal |
Minimum value of the resulting sample |
maxVal |
Maximum value of the resulting sample |
samplingMethod |
Not used |
A matrix of size chromosomeLength x nIndividual.
nVar <- 14 nIndividual <- 100 InitializePopulationLHS(nIndividual,nVar,FALSE)
nVar <- 14 nIndividual <- 100 InitializePopulationLHS(nIndividual,nVar,FALSE)
Install the required python package via conda.
install_python_dependencies(conda = "auto", envname = NULL, ...)
install_python_dependencies(conda = "auto", envname = NULL, ...)
conda |
Default: auto |
envname |
Python virtual environment where the modules will be installed, default to 'r-reticulate' |
... |
Further argument to pass to reticulate::py_install |
0 if dependencies installed and loaded successfully, 1 if fails.
Import the required python package if it fails onLoad.
load_python_dependencies()
load_python_dependencies()
0 if dependencies loaded successfully, 1 if fails.
Do an iteration of population based Multi-Objective Covariance Matrix Adaptation Evolution Strategy (MO-CMA-ES). The variation is using simulated binary crossover (SBX) and mutation following the CMA. The original MO-CMA-ES does not use crossover, to do this simply set crossoverProbability to zero.
MOCMAES(parent, nObjective, fun, control = list(), ...)
MOCMAES(parent, nObjective, fun, control = list(), ...)
parent |
The parent generation, an object of class cmaes_gen. The MO-CMA-ES parent is a 5 tuple: x (the design point, length = number of variable),averageSuccessRate (scalar),stepSize (scalar), evoPath (evolution path, vector, length = number of variable ),covarianceMatrix (square matrix with ncol = nrow = number of variable). The parent is then should be a vector of lists (see example). |
nObjective |
The number of objective functions. A scalar value. |
fun |
Objective function being solved. |
control |
List of parameters for CMA-ES. Available control are as follows:
|
... |
Further arguments to be passed to |
Returns a list for the next generation. It contains list$new_generation (class: cmaes_gen), list$population (basically a copy of list$new_generation[[]]$x), and list$populationObjective
Voß, T., Hansen, N., Igel, C.: Improved step size adaptation for the MO-CMA-ES. In: Genetic and Evolutionary Computation (GECCO). pp. 487–494. ACM, New York, NY (2010)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 )^0.5 ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- MOCMAES(a_list,nObjective,WFG8,control,nObjective)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 )^0.5 ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of MO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- MOCMAES(a_list,nObjective,WFG8,control,nObjective)
Normalize the objectives AND reference (combined) to 0-1. The origin is the ideal point. (1,...,1) is the nadir.
Normalize(objectiveValue, referencePoints = NULL)
Normalize(objectiveValue, referencePoints = NULL)
objectiveValue |
Set of objective vectors to normalize |
referencePoints |
Set of reference points to transform following the objective vector normalization |
A list containing the following:
normalizedObjective
The normalized values
idealPoint
The ideal point corresponding to the origin
transformedReference
The location of reference points in the normalized Space
nObj <- 5 nVar <- 10 nIndividual <- 100 population <- InitializePopulationLHS(nIndividual,nVar,FALSE) objective <- matrix(,nrow=nObj,ncol=nIndividual) for(individual in 1:nIndividual){ objective[,individual] <- WFG4(population[,individual],nObj) } Normalize(objective)
nObj <- 5 nVar <- 10 nIndividual <- 100 population <- InitializePopulationLHS(nIndividual,nVar,FALSE) objective <- matrix(,nrow=nObj,ncol=nIndividual) for(individual in 1:nIndividual){ objective[,individual] <- WFG4(population[,individual],nObj) } Normalize(objective)
Do an iteration of Elitist Non-dominated Sorting Genetic Algorithm version III (NSGA-III). THe variation is using SBX and polynomial mutation.
NSGA3(population, fun, nObjective, control = list(), ...)
NSGA3(population, fun, nObjective, control = list(), ...)
population |
The parent generation. One individual per column. nrow = number of variable, ncol = number of individuals in the population. |
fun |
Objective function being solved. Currently available in the package DTLZ1-DTLZ4, WFG4-WFG9. |
nObjective |
The number of objective functions. A scalar value. Needed to generate weight vectors. |
control |
A list, containing the following:
|
... |
Further arguments to be passed to |
#' @return Returns a list for the next generation
population
The new generation design points. Column major.
populationObjective
The new generation's objective values. Column major.
Deb, K., Jain, H.: An evolutionary many-objective optimization algorithm using reference-point-based nondominated sorting approach, part I: Solving problems with box constraints. Trans. Evol. Comp. 18 (4), 577–601 (2014)
nVar <- 14 nObjective <- 5 nIndividual <- 100 #control for NSGA3 ctrl <- list(crossoverProbability = 1, mutationProbability = 1/nVar) #Initial population population <- matrix(runif(nIndividual*nVar), nrow = nVar) # run a generation of NSGA-III with standard WFG8 test function. NSGA3(population, WFG8,nObjective,ctrl,nObjective)
nVar <- 14 nObjective <- 5 nIndividual <- 100 #control for NSGA3 ctrl <- list(crossoverProbability = 1, mutationProbability = 1/nVar) #Initial population population <- matrix(runif(nIndividual*nVar), nrow = nVar) # run a generation of NSGA-III with standard WFG8 test function. NSGA3(population, WFG8,nObjective,ctrl,nObjective)
Main interface for the many-objective optimization evolutionary algorithm (MaOEA) package.
optimMaOEA( x = NULL, fun, solver = NSGA3, nObjective, nGeneration = 1, nVar = nrow(x), populationSize = ncol(x), seed = 2000, control = list(), ... )
optimMaOEA( x = NULL, fun, solver = NSGA3, nObjective, nGeneration = 1, nVar = nrow(x), populationSize = ncol(x), seed = 2000, control = list(), ... )
x |
The initial population. If not supplied, will be generated using LHS. Column major, each column contain one entry. |
fun |
Objective function being solved. |
solver |
Function name of the solver. Currently available: SMSEMOA, MOCMAES, SMOCMAES, and NSGA3. |
nObjective |
The number of objective functions. A scalar value. |
nGeneration |
Optional, the number of generation the solver should run. |
nVar |
Number of variables, will be used if |
populationSize |
Number of individuals in the population, will be used if |
seed |
random number seed for reproduction of code |
control |
A list, containing the following:
|
... |
Further arguments to be passed to |
Returns a list for the next generation
population
The new generation design points.
populationObjective
The new generation's objective values.
nVar <- 14 nObjective <- 5 nIndividual <- 100 #control for NSGA3 ctrl <- list(crossoverProbability = 1, mutationProbability = 1/nVar) #Initial population can be supplied, like below but for this example, we skip it #population <- matrix(runif(nIndividual*nVar), nrow = nVar) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready){ # prevent error on testing the example # Hybrid NSGA-III and SMSEMOA example # 2 calls for nObjective. 1 for optimMaOEA, 1 for WFG8 # generate initial population and run 10 gen. NSGA-III with standard WFG8 test function. newPop <- optimMaOEA( , WFG8,NSGA3,nObjective,10,nVar,nIndividual,,ctrl,nObjective)$x # run 5 generations of SMSEMOA with standard WFG8 test function starting with newPop. result <- optimMaOEA( newPop, WFG8,SMSEMOA,nObjective,5,,,1000,ctrl,nObjective) finalPop <- result$x finalObjective <- result$y }
nVar <- 14 nObjective <- 5 nIndividual <- 100 #control for NSGA3 ctrl <- list(crossoverProbability = 1, mutationProbability = 1/nVar) #Initial population can be supplied, like below but for this example, we skip it #population <- matrix(runif(nIndividual*nVar), nrow = nVar) numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready){ # prevent error on testing the example # Hybrid NSGA-III and SMSEMOA example # 2 calls for nObjective. 1 for optimMaOEA, 1 for WFG8 # generate initial population and run 10 gen. NSGA-III with standard WFG8 test function. newPop <- optimMaOEA( , WFG8,NSGA3,nObjective,10,nVar,nIndividual,,ctrl,nObjective)$x # run 5 generations of SMSEMOA with standard WFG8 test function starting with newPop. result <- optimMaOEA( newPop, WFG8,SMSEMOA,nObjective,5,,,1000,ctrl,nObjective) finalPop <- result$x finalObjective <- result$y }
Do an iteration of population based steady state Multi-Objective Covariance Matrix Adaptation Evolution Strategy (MO-CMA-ES). The variation is using simulated binary crossover (SBX) and mutation following the CMA. The original MO-CMA-ES does not use crossover, to do this simply set crossoverProbability to zero.
SMOCMAES(parent, nObjective, fun, control = list(), ...)
SMOCMAES(parent, nObjective, fun, control = list(), ...)
parent |
The parent generation, an object of class cmaes_gen. The MO-CMA-ES parent is a 5 tuple: x (the design point, length = number of variable),averageSuccessRate (scalar),stepSize (scalar), evoPath (evolution path, vector, length = number of variable ),covarianceMatrix (square matrix with ncol = nrow = number of variable). The parent is then should be a vector of lists (see example). |
nObjective |
The number of objective functions. A scalar value. |
fun |
Objective function being solved. |
control |
List of parameters for CMA-ES. Available control are as follows:
|
... |
Further arguments to be passed to |
Returns a list for the next generation. It contains list$new_generation (class: cmaes_gen), list$population (basically a copy of list$new_generation[[]]$x), and list$populationObjective
Voß, T., Hansen, N., Igel, C.: Improved step size adaptation for the MO-CMA-ES. In: Genetic and Evolutionary Computation (GECCO). pp. 487–494. ACM, New York, NY (2010)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 ) ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of SMO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- SMOCMAES(a_list,nObjective,WFG8,control,nObjective)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 ps_target <- 1 / (5 + ( 1 / 2 ) ) pop <- matrix(stats::runif(nIndividual*nVar), nrow = nVar) # create the population a_list <- cmaes_gen(pop) control <- list(successProbTarget=ps_target,crossoverProbability=crossoverProbability) # run a generation of SMO-CMA-ES with standard WFG8 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example newGeneration <- SMOCMAES(a_list,nObjective,WFG8,control,nObjective)
Do an iteration of S-Metric Selection (SMS)-EMOA. The variation used is simulated binary crossover (SBX) and polynomial mutation.
SMSEMOA( population, fun, nObjective = nrow(populationObjective), populationObjective = NULL, control = list(), ... )
SMSEMOA( population, fun, nObjective = nrow(populationObjective), populationObjective = NULL, control = list(), ... )
population |
The parent generation. One individual per column. |
fun |
Objective function being solved. Currently available in the package DTLZ1-DTLZ4, WFG4-WFG9. |
nObjective |
Number of objective. Ignored as of version 0.6.1; number of row from fun is used instead. |
control |
(list) Options to control the SMS-EMOA:
|
... |
Further arguments to be passed to |
Returns a list for the next generation
population
The new generation. Column major, each row contain 1 set of objectives.
successfulOffspring
Binary, 1 if the offspring is kept in the new generation. Used in some adaptive schemes.
populationObjective
The new generation's objective values.
searchDir
The search direction used. Not NULL if orthogonal sampling is used. Can be used to do weighted optimization.
Beume, N., Naujoks, B., Emmerich, M.: SMS-EMOA: Multiobjective selection based on dominated hypervolume. Eur. J. Oper. Res. 181 (3), 1653 – 1669 (2007)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 mutationProbability <- 1/nVar population <- matrix(runif(nIndividual*nVar), nrow = nVar) # run a generation of SMS-EMOA with standard WFG6 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example SMSEMOA(population = population, fun = WFG6, nObjective = nObjective, populationObjective = NULL, control = list(crossoverProbability = crossoverProbability, mutationProbability = mutationProbability, mutationMethod = "poly"), nObj=nObjective)
nVar <- 14 nObjective <- 5 nIndividual <- 100 crossoverProbability <- 1 mutationProbability <- 1/nVar population <- matrix(runif(nIndividual*nVar), nrow = nVar) # run a generation of SMS-EMOA with standard WFG6 test function. numpyready <- reticulate::py_module_available('numpy') pygmoready <- reticulate::py_module_available('pygmo') py_module_ready <- numpyready && pygmoready if(py_module_ready) # prevent error on testing the example SMSEMOA(population = population, fun = WFG6, nObjective = nObjective, populationObjective = NULL, control = list(crossoverProbability = crossoverProbability, mutationProbability = mutationProbability, mutationMethod = "poly"), nObj=nObjective)
The WFG1 test function.
WFG1(individual, nObj, k = nObj - 1)
WFG1(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG1(individual,nObj)
individual <- runif(14) nObj <- 4 WFG1(individual,nObj)
The WFG2 test function.
WFG2(individual, nObj, k = nObj - 1)
WFG2(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG2(individual,nObj)
individual <- runif(14) nObj <- 4 WFG2(individual,nObj)
The WFG3 test function.
WFG3(individual, nObj, k = nObj - 1)
WFG3(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG3(individual,nObj)
individual <- runif(14) nObj <- 4 WFG3(individual,nObj)
The WFG4 test function.
WFG4(individual, nObj, k = nObj - 1)
WFG4(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG4(individual,nObj)
individual <- runif(14) nObj <- 4 WFG4(individual,nObj)
The WFG5 test function.
WFG5(individual, nObj, k = nObj - 1)
WFG5(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG5(individual,nObj)
individual <- runif(14) nObj <- 4 WFG5(individual,nObj)
The WFG6 test function.
WFG6(individual, nObj, k = nObj - 1)
WFG6(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG6(individual,nObj)
individual <- runif(14) nObj <- 4 WFG6(individual,nObj)
The WFG7 test function.
WFG7(individual, nObj, k = nObj - 1)
WFG7(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG7(individual,nObj)
individual <- runif(14) nObj <- 4 WFG7(individual,nObj)
The WFG8 test function.
WFG8(individual, nObj, k = nObj - 1)
WFG8(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG8(individual,nObj)
individual <- runif(14) nObj <- 4 WFG8(individual,nObj)
The WFG9 test function.
WFG9(individual, nObj, k = nObj - 1)
WFG9(individual, nObj, k = nObj - 1)
individual |
The individual to be evaluated, the search space should be in [0-2i] for variable number i. Can accept multiple individualm each in different column. |
nObj |
The number of objective |
k |
Number of distance related parameters. The reference suggests a positive integer multiplied by (nObj-1). Default to nObj-1 |
A matrix of size nObjective, containing the objective values.
Huband, S., Hingston, P., Barone, L., While, L.: A review of multiobjective test problems and a scalable test problem toolkit. Trans. Evol. Comp 10 (5), 477–506 (2006)
individual <- runif(14) nObj <- 4 WFG9(individual,nObj)
individual <- runif(14) nObj <- 4 WFG9(individual,nObj)