ExplicitExploration: Explicit exploration in evolutionary algorithms

View source: R/ExplicitExploration.R

ExplicitExplorationR Documentation

Explicit exploration in evolutionary algorithms

Description

It makes an explicit exploration as proposed in Salinas-Gutiérrez and Zavala, 2023.

Usage

ExplicitExploration(
  fun,
  lower,
  upper,
  n = 30,
  maxiter,
  k = 5,
 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 bounds on the parameters.

upper

Upper bounds on the parameters.

n

Number of individuals per generation

maxiter

Maximum number of iterations.

k

Number of consecutive generations without change in distribution before stopping.

tolerance

Criterion for determining whether the distribution has changed.

...

Additional arguments of the objective function.

Value

Returns a list with the following entries:

par

The top n individuals from the entire search.

Y

The value of the objective function for each of the best individuals.

n_gen

Number of generations required for the search.

par_historical

All individuals generated during the search.

historical

The value of the objective function for all generated individuals.

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

Examples


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 <- c(-5,-5)
upper <- c(5,5)
res <- ExplicitExploration(fun, lower = lower,
                           upper = upper,n = n,
                           maxiter = 20,
                           k = k)

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$par_historical[,1],res$par_historical[,2],
       col = "blue")
points(res$par[,1],res$par[,2], col = "red",
       pch = 19)


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