genopt {BurStMisc}R Documentation

Genetic Optimization

Description

Approximately minimizes the value of a function using a simple heuristic optimizer that uses a combination of genetic and simulated annealing optimization.

Usage

  genopt(fun, population, lower = -Inf, upper = Inf,
         scale = dcontrol["eps"], add.args = NULL,
         control = genopt.control(...), ...)

Arguments

fun

function that returns a numerical value.

population

a matrix or a list.

If a matrix, then the rows correspond to the parameters and the columns are different parameter vectors.

If a list, then it should have a component named "population" and optionally a component named "objective" – in particular, it can be the result of a call to genopt. If the "objective" component exists, then it is assumed to be the function values of the population and the function will not be evaluated on the members of the population.

lower

vector giving the lower bound for parameter values. This is replicated to be as long as the number of parameters.

upper

vector giving the upper bound for parameter values. This is replicated to be as long as the number of parameters.

scale

vector of scales to use when doing local search with a solution. This is replicated to be as long as the number of parameters.

add.args

list of additional arguments to fun.

control

an object like the output of genopt.control containing control parameters for the optimization.

...

arguments for genopt.control if the control argument is not given explicitly.

Details

There is a summary method for class genopt which shows the call, a summary of the set of objectives found, and the best solution (set of parameters).

Value

a list of class genopt with the following components:

population

a matrix of the same size as the input population matrix, but generally with different values in it.

objective

a vector with length equal to the number of columns of population containing the function value for the corresponding parameter vector in population.

funevals

the number of function evaluations performed. If population is given as a list that contains a "funevals" component, then that number is added to the number of evaluations done in the current call.

random.seed

the random seed at the start of the call – given so that you can reproduce the computations.

call

an image of the call that created this object.

References

The original version of this function appeared in "S Poetry".

See Also

genopt.control, summary.genopt.

Examples

  # two parameters, population size 5
  go1 <- genopt(function(x, other) sum(x, other),
                population=matrix(rexp(10), nrow=2, ncol=5),
                lower=0, add.arg=list(other=3), trace=FALSE)
  summary(go1)

  go2 <- genopt(function(x, other) sum(x, other), population=go1,
                lower=0, add.arg=list(other=3), trace=FALSE)


[Package BurStMisc version 1.1 Index]