EDA.mnorm: Distribution estimation algorithm with multivariate normal...

View source: R/EDA.mnorm.R

EDA.mnormR Documentation

Distribution estimation algorithm with multivariate normal distribution.

Description

Implements an EDA with multivariate normal distribution.

Usage

EDA.mnorm(fun,
  lower,
  upper,
  n = 30,
  maxiter,
  k = 2,
  k0 = 10,
  tolerance = 0.01,
  ...)

Arguments

fun

A function to be minimized, with first argument the vector of parameters over which minimization is to take place.

lower

Lower limits of the parameters.

upper

Upper bounds on the parameters.

n

Number of individuals per generation

maxiter

Maximum number of iterations.

k

The minimum number of consecutive generations using the same search distribution.

k0

The minimum number of consecutive generations using the uniform distribution.

tolerance

Criterion for determining whether the distribution has changed.

...

Additional arguments of the objective function.

Details

Implements an EDA with multivariate normal distribution that uses the proposal presented in Salinas-Gutiérrez and Zavala, 2023 before changing the model.

Value

Returns a list with the following entries:

sol

The best solution found.

par

The n best individuals generated by the last model.

value

The best value of the objective function.

historical

The best fitness value in each generatio.

References

Salinas-Gutiérrez, R., & Zavala, A. E. M. (2023).An explicit exploration strategy for evolutionary algorithms. Applied Soft Computing, 140. https://doi.org/10.1016/j.asoc.2023.110230

See Also

EDA.ecdf, EDA.hist, EDA.norm, ExplicitExploration

Examples


#Example happy cat
fun <- function(X){
  D <- length(X)
  f <- abs(sum(X^2) - D)^(1/4) + (0.5 * sum(X^2) + sum(X))/D + 0.5
  return(f)
}
n <- 30
k <- 2
tolerance <- 0.01
lower <- rep(-5,2)
upper <- rep(5,2)
res <- EDA.mnorm(fun, lower = lower,
                upper = upper,n = n,
                k = k, tolerance = tolerance,
                maxiter = 200)
z <- outer(X = seq(-5, 5, 0.05), Y = seq(-5, 5, 0.05),
           FUN = Vectorize(function(X, Y) { fun(c(X, Y)) }))
contour(seq(-5, 5, 0.05),seq(-5, 5, 0.05),z,
        nlevels = 20, cex.axis = .8)
points(res$sol[1],res$sol[2],
       col = "blue", pch = 19)

#Multiple regression example
set.seed(pi)
x1 <- rnorm(n = 100, mean = 10, sd = 5)
x2 <- rnorm(n = 100, mean = 8, sd = 2)
y <- 7 + 4 * x1 - 6 * x2 + rnorm(n = 100, mean = 0, sd = 3)

ec <- function(par,y,x1,x2){
  b0 <- par[1]
  b1 <- par[2]
  b2 <- par[3]
  y_hat <- b0 + b1 * x1 + b2 * x2
  value <- sum((y - y_hat)^2)
  return(value)
}

opt <- EDA.mnorm(fun = ec, lower = c(-20,-20,-20),
                 upper = c(20,20,20), maxiter = 150,
                 y = y, x1 = x1, x2 = x2)
opt$sol

EEEA documentation built on June 10, 2025, 9:13 a.m.

Related to EDA.mnorm in EEEA...