| SPJDEoptim | R Documentation |
JDEoptim()
Parallel evaluation of the objective function and/or constraints for each candidate solution in the population.
SPJDEoptim(lower, upper, fn,
constr = NULL, meq = 0, eps = 1e-5,
sequential_eval = c("none", "constraints",
"objective", "both"),
..., further_args = list(),
NP = 10*length(lower),
Fl = 0.1, Fu = 1, CRl = 0, CRu = 1.1,
tau_F = 0.1, tau_CR = 0.1, tau_pF = 0.1,
jitter_factor = 0.001,
tol = 1e-15, maxiter = 2000*length(lower),
fnscale = 1, compare_to = c("median", "max"),
add_to_init_pop = NULL,
trace = FALSE, triter = 1,
details = FALSE)
lower, upper |
numeric vectors, the lower and upper bounds of the
search space (box constraints); must be finite
( |
fn |
a |
constr |
a vector |
meq |
an integer, the first |
eps |
the maximal admissible constraint violation for
equality constraints. A numeric vector of small positive tolerance values
with length |
sequential_eval |
a character string that indicates when either the
objective function (if |
... |
[to be used only when run in parallel mode] named arguments
specifying locally-defined functions and other objects required
but not defined in |
further_args |
a list of any further arguments passed to
|
NP |
an integer, the population size. Defaults to |
Fl |
a numeric, the minimum value that the
scaling factor |
Fu |
a numeric, the maximum value that the
scaling factor |
CRl |
a numeric, the minimum value to be used for the
crossover constant |
CRu |
a numeric, the maximum value to be used for the
crossover constant |
tau_F |
a numeric, the probability that the
scaling factor |
tau_CR |
a numeric, the probability that the
crossover constant |
tau_pF |
a numeric, the probability that the
mutation probability |
jitter_factor |
a numeric, the tuning constant for jitter.
If |
tol |
a numeric, the tolerance for the stopping criterion. Default is
|
maxiter |
an integer, the maximum number of iterations allowed.
Default is |
fnscale |
a numeric, the typical magnitude of |
compare_to |
a character string controlling which function should be
applied when evaluating the stopping criterion. It defaults to
|
add_to_init_pop |
numeric vector of length |
trace |
logical indicating whether or not to monitor the
iteration process. Default is |
triter |
an integer, trace output is printed at every
|
details |
logical indicating if the output will contain the solutions
in the final population and their respective |
The optimizer is intended for dealing with computationally expensive
objective functions and/or constraints (see, e.g.,
Storn and Price, 2025). The algorithm has been parallelized simply by
distributing the evaluation of the candidate solutions in the population over
the available processors/cores with
mirai_map() from package mirai.
It is important to note this approach and its implementation
is not equivalent to the purely sequential version
JDEoptim(), the major reason being the fact that an asynchronous
update of the current population is not possible anymore. This in turn almost
always has a deleterious effect on the efficiency of DE. For this
reason although it can run without mirai installed, for example
using sequential_eval = "both", the use of
JDEoptim() is preferred over SPJDEoptim()
in this case.
Note that all support for the parallel computation is provided by package
mirai and controlled directly by end-users; in particular,
resources are declared with mirai::daemons()
before invoking SPJDEoptim().
A list with the following components:
par |
the best solution |
value |
the value of |
iter |
the number of iterations used. |
convergence |
an integer code; |
and if details = TRUE:
poppar |
a |
popcost |
the values of |
Additional arguments are passed to fn and constr through
further_args instead of ... such as in
JDEoptim().
Eduardo L. T. Conceicao mail@eduardoconceicao.org
Storn, Rainer and Price, Kenneth V. (2025) Multi-child DE — a massively parallel differential evolution algorithm; in 2025 IEEE Symposium on Computational Intelligence on Engineering/Cyber Physical Systems (CIES), Trondheim, Norway. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/CIES64955.2025.11007629")}.
if (requireNamespace("mirai", quietly = TRUE)) {
# NOTE: Examples were excluded from testing
# to reduce package check time.
# stays within 2-core limit
mirai::daemons(1, dispatcher = FALSE)
set.seed(42)
# Warning: the examples are run using a very small number of
# iterations to decrease execution time. Because they are very
# cheap to compute, parallel evaluation is actually detrimental.
# Shekel 5 problem
#
# 0 <= xj <= 10, j = {1, 2, 3, 4}
# There are five local minima and the global minimizer is
# located at x* = (4.00, 4.00, 4.00, 4.00) with
# f(x*) ~~ -10.1499.
#
# Source:
# Ali, M. Montaz, Khompatraporn, Charoenchai, and
# Zabinsky, Zelda B. (2005).
# A numerical evaluation of several stochastic algorithms
# on selected continuous global optimization test problems.
# Journal of Global Optimization 31, 635-672.
# https://doi.org/10.1007/s10898-004-9972-2
a_ij <- matrix(c(4, 4, 4, 4,
1, 1, 1, 1,
8, 8, 8, 8,
6, 6, 6, 6,
3, 7, 3, 7), ncol = 4, byrow = TRUE)
c_i <- c(0.1, 0.2, 0.2, 0.4, 0.4)
a_ji <- t(a_ij)
shekel5 <- function(x) {
-sum(1/( colSums((x - a_ji)^2) + c_i ))
}
SPJDEoptim(rep(0, 4), rep(10, 4), shekel5,
a_ji = a_ji, c_i = c_i,
maxiter = 10, trace = TRUE)
# Sinusoidal problem
#
# 0 <= xi <= 180, i = {1, 2, ..., n}
# The variable x is in degrees. Parameter A affects the
# amplitude of the global optimum; B affects the peridiocity
# and hence the number of local minima; z shifts the location
# of the global minimum. The location of the global solution
# is at x* = (90+z, 90+z, ..., 90+z) with the global optimum
# value of f(x*) = -(A+1).
#
# Source:
# Ali, M. Montaz, Khompatraporn, Charoenchai, and
# Zabinsky, Zelda B. (2005).
# A numerical evaluation of several stochastic algorithms
# on selected continuous global optimization test problems.
# Journal of Global Optimization 31, 635-672.
# https://doi.org/10.1007/s10898-004-9972-2
sinusoidal <- function(x, A, B, z) {
var_in_rad <- (x - z)*pi/180
-( A*prod(sin(var_in_rad)) + prod(sin(B*var_in_rad)) )
}
SPJDEoptim(rep(0, 10), rep(180, 10), sinusoidal,
further_args = list(A = 2.5, B = 5, z = 30),
maxiter = 10, trace = TRUE)
mirai::daemons(0) # reset
Sys.sleep(1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.