simpleEA | R Documentation |
Simple Evolutionary Algorithm for Minimization.
simpleEA(fn, lower, upper, N = 100, ..., con = 0.1, new = 0.05,
tol = 1e-10, eps = 1e-07, scl = 1/2, confined = FALSE, log = FALSE)
fn |
the objective function to be minimized. |
lower |
vector of lower bounds for all coordinates. |
upper |
vector of upper bounds for all coordinates. |
N |
number of children per parent. |
... |
additional parameters to be passed to the function. |
con |
percentage of individuals concentrating to the best parents. |
new |
percentage of new individuals not focussed on existing parents. |
tol |
tolerance; if in the last three loops no better individuals were found up to this tolerance, stop. |
eps |
grid size bound to be reached. |
scl |
scaling factor for shrinking the grid. |
confined |
logical; shall the set of individuals be strictly respect the boundary? Default: FALSE. |
log |
logical, should best solution found be printed per step. |
Evolutionary search to minimize a function: For each point in the current generation, n random points are introduced and the n best results of each generation (and its parents) are used to form the next generation.
The scale shrinks the generation of new points as the algorithm proceeds. It is possible for some children to lie outside the given rectangle, and therefore the final result may lie outside the unit rectangle well. (TO DO: Make this an option.)
List with the following components:
par |
numeric vector representing the minimum found. |
val |
function value at the minimum found. |
fun.calls |
number of function calls made. |
rel.scl |
last scaling factor indicating grid size in last step. |
rel.tol |
relative tolerance within the last three minima found. |
Original Mathematica Version by Stan Wagon in the SIAM textbook. Translated to R by Hans W Borchers.
HwB <hwborchers@googlemail.com>
Stan Wagon. “Think Globally, Act Locally". Chapter 4 In: F. Bornemann, D. Laurie, S. Wagon, and J. Waldvogel (Eds.). The SIAM 100-Digit Challenge. Society of Industrial and Applied Mathematics, 2004.
DEoptim
in the ‘DEoptim’ package.
simpleEA(fnTrefethen, lower=c(-1,-1), upper=c(1,1), log=FALSE)
# $par
# [1] -0.02440310 0.21061243 # this is the true global optimum!
# $val
# [1] -3.306869
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.