rnsga2 | R Documentation |
Minimization of a fitness function using reference point based non-dominated sorting genetic algorithms - II (R-NSGA-IIs). Multiobjective evolutionary algorithms
rnsga2(
type = c("binary", "real-valued", "permutation"),
fitness,
...,
lower,
upper,
nBits,
population = rmooControl(type)$population,
selection = rmooControl(type)$selection,
crossover = rmooControl(type)$crossover,
mutation = rmooControl(type)$mutation,
reference_dirs = NULL,
epsilon = 0.001,
normalization = c("ever", "front", "no"),
extreme_points_as_ref_dirs = FALSE,
weights = NULL,
popSize = 50,
nObj = NULL,
pcrossover = 0.8,
pmutation = 0.1,
maxiter = 100,
run = maxiter,
maxFitness = Inf,
names = NULL,
suggestions = NULL,
parallel = FALSE,
monitor = if (interactive()) rmooMonitor else FALSE,
summary = FALSE,
seed = NULL
)
type |
the type of genetic algorithm to be run depending on the nature of decision variables. Possible values are:
|
fitness |
the fitness function, any allowable R function which takes as input an individual string representing a potential solution, and returns a numerical value describing its 'fitness'. |
... |
additional arguments to be passed to the fitness function. This allows to write fitness functions that keep some variables fixed during the search |
lower |
a vector of length equal to the decision variables providing the lower bounds of the search space in case of real-valued or permutation encoded optimizations. |
upper |
a vector of length equal to the decision variables providing the upper bounds of the search space in case of real-valued or permutation encoded optimizations. |
nBits |
a value specifying the number of bits to be used in binary encoded optimizations |
population |
an R function for randomly generating an initial population.
See |
selection |
an R function performing selection, i.e. a function which
generates a new population of individuals from the current population
probabilistically according to individual fitness. See |
crossover |
an R function performing crossover, i.e. a function which
forms offsprings by combining part of the genetic information from their
parents. See |
mutation |
an R function performing mutation, i.e. a function which
randomly alters the values of some genes in a parent chromosome.
See |
reference_dirs |
Function to generate reference points using Das and Dennis approach or matrix with supplied reference points. |
epsilon |
controls the extent of obtained solutions by grouping all solutions that have a normalized difference sum in objective values of epsilon or less. |
normalization |
of the ideal points and nadir. They can be:
|
extreme_points_as_ref_dirs |
flag to use extreme points as reference points. |
weights |
vector specifies the importance of one objective function over the other, by default all objectives have equal weights. |
popSize |
the population size. |
nObj |
number of objective in the fitness function. |
pcrossover |
the probability of crossover between pairs of chromosomes. Typically this is a large value and by default is set to 0.8. |
pmutation |
the probability of mutation in a parent chromosome. Usually mutation occurs with a small probability, and by default is set to 0.1. |
maxiter |
the maximum number of iterations to run before the NSGA search is halted. |
run |
the number of consecutive generations without any improvement in the best fitness value before the NSGA is stopped |
maxFitness |
the upper bound on the fitness function after that the NSGA search is interrupted. |
names |
a vector of character strings providing the names of decision variables. |
suggestions |
a matrix of solutions strings to be included in the initial population. If provided the number of columns must match the number of decision variables. |
parallel |
An optional argument which allows to specify if the NSGA-II should be run sequentially or in parallel. |
monitor |
a logical or an R function which takes as input the current state of the nsga-class object and show the evolution of the search. By default, for interactive sessions the function rmooMonitor prints the average and best fitness values at each iteration. If set to plot these information are plotted on a graphical device. Other functions can be written by the user and supplied as argument. In non interactive sessions, by default monitor = FALSE so any output is suppressed. |
summary |
If there will be a summary generation after generation. |
seed |
an integer value containing the random number generator state. This argument can be used to replicate the results of a NSGA search. Note that if parallel computing is required, the doRNG package must be installed. |
R-NSGA-II is a meta-heuristic proposed by K. Deb and J. Sundar in 2006. It is a modification of NSGA-II based on reference points in which the decision-maker supplies one or more preference points and a weight vector that will guide the solutions towards regions desired by the user.
Returns an object of class rnsga2-class. See rnsga2 for a description of available slots information.
Francisco Benitez benitezfj94@gmail.com
Kalyanmoy Deb and J. Sundar. 2006. Reference point based multi-objective optimization using evolutionary algorithms. In Proceedings of the 8th annual conference on Genetic and evolutionary computation (GECCO '06). Association for Computing Machinery, New York, NY, USA, 635–642. doi: 10.1145/1143997.1144112
nsga()
, nsga2()
, nsga3()
#Example
#Two Objectives - Real Valued
zdt1 <- function (x) {
if (is.null(dim(x))) {
x <- matrix(x, nrow = 1)
}
n <- ncol(x)
g <- 1 + rowSums(x[, 2:n, drop = FALSE]) * 9/(n - 1)
return(cbind(x[, 1], g * (1 - sqrt(x[, 1]/g))))
}
#Define the reference points
reference_points = rbind(c(0.2, 0.8), c(0.8, 0.2), c(0.4, 0.5))
#Not run:
## Not run:
result <- rnsga2(type = "real-valued",
fitness = zdt1,
lower = c(0,0),
upper = c(1,1),
reference_dirs = reference_points,
popSize = 100,
nObj = 2,
monitor = FALSE,
maxiter = 500,
seed = 45)
## End(Not run)
#Example 2
#Three Objectives - Real Valued
dtlz1 <- function (x, nobj = 3){
if (is.null(dim(x))) {
x <- matrix(x, 1)
}
n <- ncol(x)
y <- matrix(x[, 1:(nobj - 1)], nrow(x))
z <- matrix(x[, nobj:n], nrow(x))
g <- 100 * (n - nobj + 1 + rowSums((z - 0.5)^2 - cos(20 * pi * (z - 0.5))))
tmp <- t(apply(y, 1, cumprod))
tmp <- cbind(t(apply(tmp, 1, rev)), 1)
tmp2 <- cbind(1, t(apply(1 - y, 1, rev)))
f <- tmp * tmp2 * 0.5 * (1 + g)
return(f)
}
#Define the reference points
reference_points <- rbind(c(1.0, 0.5, 0.0), c(0.0, 0.5, 1.0), c(0.5, 0.5, 0.5))
#Not run:
## Not run:
result <- rnsga2(type = "real-valued",
fitness = dtlz1,
lower = c(0,0,0),
upper = c(1,1,1),
reference_dirs = reference_points,
popSize = 92,
nObj = 3,
monitor = FALSE,
maxiter = 500)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.