Description Usage Arguments Details Value References Examples
In FER-PSO, Fitness and Euclidean distance Ratio (FER)
is calculated based on the fitness difference and
the Euclidean distance between a particle's personal best and
other personal bests of the particles in the population. The
key advantage is that FER-PSO removes the need of prespecifying
niching parameters that are commonly required in
existing niching evolutiobary algorithms for multimodal optimization.
Furthermore, a local search technique has been used to enhance the ability to
locate most global or local optima.
1 |
fn |
objective function that should be maximized. Should not return |
lower |
lower bound. |
upper |
upper bound. |
control |
control parameters for the algorithm. See "Details". |
... |
extra arguments are passed to |
The control
argument is a list that can supply any of the following components:
swarm
swarm size. Defaults to 50
.
iter
number of iterations. Defaults to 200
.
w
inertia weight. Defaults to 0.729843788
.
c1
acceleration factor. Defaults to 2.05
.
c2
acceleration factor. Defaults to 2.05
.
local
logical; local search should be performed? Defaults to TRUE
vectorize_local
logical; vectorization for local search? Defaults to TRUE
.
seed
random seed.
hybrid
logical; if true, before quiting the algorithm, an L-BFGS-B
search with the provided position as initial guess is done to improve the accuracy of the results.
Defaults to TRUE
. Note that no attempt is done to control the maximal number of
function evaluations within the local search step (this can be done separately through hybrid.control
)
contr_hybrid
List with any additional control parameters to pass on to stats{optim}
when using L-BFGS-B
for the local search. Defaults to NULL
.
fn
is maximized.
This function is efficient when the purpose is finding all global maxima.
Please use ncde
to find all local maxima.
fn
must not return any NaN
.
The only stopping rule is the number of iterations.
a list contains:
pbest
a matrix; position of the particles.
pbestval
a vector; corresponding fitness value of each particle.
nfeval
number of function evaluations.
maxima
position of particles after using L-BFGS-B
. It should be local maxima. If control$ == FALSE
, then it is NA
.
maximaval
fitness values of maxima
.
Qu, B. Y., Liang, J. J., & Suganthan, P. N. (2012). Niching particle swarm optimization with local search for multi-modal optimization. Information Sciences, 197, 131-143.
Li, X. (2007, July). A multimodal particle swarm optimizer based on fitness Euclidean-distance ratio. In Proceedings of the 9th annual conference on Genetic and evolutionary computation (pp. 78-85). ACM.
Based on MATLAB code that can be found in Suganthan's home page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ####################################################################################
## Two-Peak Trap: global maximum on x = 20 and local maximum on x = 0
two_peak <- function(x)
y <- (160/15) * (15 - x) * (x < 15) + 40 * (x - 15) * (x >= 15)
ferpsols(two_peak, 0, 20, control = list(seed = 66, swarm = 50))
# without local search
ferpsols(two_peak, 0, 20, control = list(seed = 66, swarm = 50))
# without refining and local search
ferpsols(two_peak, 0, 20, control = list(seed = 66, swarm = 50, hybrid = FALSE))
## Not run:
####################################################################################
# Decreasing Maxima: one global on x = 0.1 and four local maxima
dmaxima <- function(x)
y <- exp(-2 * log(2) * ((x - 0.1)/0.8)^2) * (sin(5 * pi * x))^6
res <- ferpsols(dmaxima, 0, 1, control = list(seed = 66, swarm = 100))
unique(round(res$maxima, 5)) ## ferpsols can not find the local maxima
## plot
x <- seq(0, 1, length.out = 400)
plot(x, dmaxima(x), type = "l")
####################################################################################
# Himmelblau's function: four global optima on
# x = c(-2.80512, 3.13131), c(3.00000, 2.00000), c(-3.77931, -3.28319) and c(3.58443, -1.84813)
Himmelblau <- function(x){
y <- - (x[1]^2 + x[2] - 11)^2 - (x[1] + x[2]^2 - 7)^2
return(y)
}
res <- ferpsols(Himmelblau, c(-6, -6), c(6, 6), control = list(seed = 66, swarm = 50))
unique(round(res$maxima, 5))
Himmelblau_plot <- function(x, y)
Himmelblau(x = c(x, y))
Himmelblau_plot <- Vectorize(Himmelblau_plot)
x <- y <- seq(-6, 6, length.out = 100)
persp(x, y, z = outer(X = x, Y = y, FUN = Himmelblau_plot))
####################################################################################
# Six-Hump Camel Back: two global and two local maxima
Six_Hump <- function(x){
factor1 <- (4 - 2.1 * (x[1]^2) + (x[1]^4)/3) * (x[1]^2) + x[1] * x[2]
factor2 <- (-4 + 4 * (x[2]^2)) * (x[2]^2)
y <- -4 * (factor1 + factor2)
return(y)
}
res <- ferpsols(Six_Hump, c(-1.9, -1.1), c(1.9, 1.1), control = list(seed = 66, swarm = 200))
unique(round(res$maxima, 5)) ## can not find the local maxima
####################################################################################
## 2D Inverted Shubert function :
# The global minima: 18 global minima f(x*) = -186.7309.
# the local maxima: sevral
Shubert <- function(x){
j <- 1:5
out <- -(sum(j * cos((j + 1) * x[1] + j)) * sum(j * cos((j + 1) * x[2] + j)))
return(out)
}
res <- ferpsols(Shubert, rep(-10, 2), rep(10, 2), control = list(seed = 66, swarm = 200))
unique(round(res$maxima, 5)) ## only the global maxima are found
## plotting
Shubert_plot <- function(x, y)
Shubert(x = c(x, y))
Shubert_plot <- Vectorize(Shubert_plot)
y <- x <- seq(-10, 10, length.out = 40)
persp(x, y, z = outer(X = x, Y = y, FUN =Shubert_plot))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.