Description Usage Arguments Details Value References Examples
Modified version of the DE algorithm, proposed by Zhu et al., for solving optimization problems with bound constraints, where the mutation strategy is randomly selected
between DE/best/1
and DE/rand/1
with a probability that favours the first with the progress of the run of the algorithm.
1 |
funcname |
function to optimize |
lo |
lower bound (same for each component of the vector x) |
up |
upper bound (same for each component of the vector x) |
n |
problem size |
NP |
population size (should be ~ four times the size of the problem) |
n_gen |
number of generations (~ ten times the value of NP) |
... |
parameters to pass at objective function to optimize |
This modified version selects two mutation strategies every generation:
DE/best/1
with probability p1 = 1/(1+exp(-0.005*g))
DE/rand/1
with probability 1-p1
Note that the probability for the strategy DE/best/1
increases as the generation counter does.
This will favour this strategy with the run of the algorithm.
Mutation factor F
is selected from a Gaussian distribution with mean 0.6 and standard deviation 0.2. Of course negative values
are not acceptable. The crossover rate is picked randomly from the range between 0.1 and 0.9.
The output of the function DEbase
is a list (of length 3) containing the following elements:
f_best
: the best value found by the algorithm for the last generation
x_best
: the vector which corresponds to the best overall function value
f
: the vector of the n_gen
optimal values found by the algorithm at each generation
W. Zhu, Y. Tang, J. Fang, W. Zhang, Adaptive population tuning scheme for differential evolution. Information Sciences, vol. 223 n. 13, 2013, pp. 390–401.
S. Das, S. Mullick, P. N. Suganthan, Recent advances in differential evolution– an updated survey. Swarm and evolutionary computation, vol. 23, 2016, pp. 1–30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##implementation of the schwefel function
schwef <- function(x)
{
if(is.vector(x))
{
d <- length(x)
sum <- sum(x*sin(sqrt(abs(x))))
y <- 418.9829*d - sum
return(y)
}
if(is.matrix(x))
{
d <- ncol(x)
sum <- apply(x*sin(sqrt(abs(x))),1,sum)
y <- 418.9829*d - sum
return(y)
}
}
##application of DEbase function
set.seed(123)
d <- MDE(schwef,-500,500,10,40,400)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.