Description Usage Arguments Value Examples
The non sorting genetic algorithm is finding the Pareto front
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | NSGA(
X,
fn,
n_objective,
sens = rep("min", n_objective),
N = round(NROW(X)/2),
g = NULL,
k_tournament = 10,
n_echange = 2,
n_bloc = 2,
crossing_over_method = "uniforme",
mutation_method = "simple",
freq_m = 0.3,
type_var = NULL,
distri_Xi = NULL,
seed = NULL,
TT = 20,
verbose = TRUE,
front_tracking = TRUE,
updateProgress = NULL,
path_tracking = NULL
)
|
X |
matrix or data.frame of the initial population |
fn |
multivarious functions taking X as argument and return p objectifs for each individu (row) of X |
n_objective |
number of objective |
sens |
vector of size n_objective containing either "min" (by default) or "max" to choose how to optimize each objectif. |
N |
integer indicating the size of the population |
g |
list of constraint given as function of X. NULL by default |
k_tournament |
integer between 2 and N indicating the number of individu to pick at each tournament |
n_echange |
integer between 1 and NCOL(X) indicating the number of exchanges done between both parents |
n_bloc |
integer between 1 and NCOL(X) indicating the number of bloc switch between both parents |
crossing_over_method |
crossingover method to use in c("uniforme", "bloc") |
mutation_method |
mutation method to use in c("simple", "mixte") |
freq_m |
mutation frequence for categorial variable or all variable when mutation_method="simple" |
type_var |
type of the X variables. NULL by default |
distri_Xi |
list containing NCOL(X) inner list where four parameter are given for a numeric variable: min, max, mean, sd and one if it is categorical variable : levels |
seed |
integer to set the seed and therefore obtain reproducible exemple. |
TT |
integer indicating the number of population to grow |
verbose |
if TRUE, echo information about the time generating the last population |
front_tracking |
if TRUE, the objectif achievement of each population is stored in the result |
updateProgress |
function to follow the progression of the running function |
path_tracking |
path where to write the step of the running function. |
a vecteur of rank associated with the individus of X
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(tidyverse)
set.seed(1234)
n <- 300
q = 3
mini <- rep(x = -2, times = q)
maxi <- rep(x = 2, times = q)
X <- lapply(seq_len(q), function(k){
res <- data.frame(X=runif(n = n, min = mini[k], max = maxi[k]))
names(res) <- paste0("X", k)
res
}) %>% bind_cols()
fn <- list(
Y1 = function(X) unlist(X[1] + 2*X[2] + X[3]),
Y2 = function(X) unlist(-X[1] - X[2] - 3*X[3])
)
res = NSGA(X = X, fn, N=50)
plot(res$Y)
res = NSGA(X = X, fn, N=50, sens = rep("max", length(fn)))
plot(res$Y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.