Description Usage Arguments Details Value Author(s) References See Also Examples

General-purpose genetic optimization environment for mixed-type (real and integer) and binary variables.

1 |

`evalFun` |
objective (fitness) function |

`evalArgs` |
a list of named parameters to the objective function |

`evalVector` |
logical indicating if a member should be supplied as a vector to the objective function |

`bounds` |
a two-column matrix or data frame of the lower and upper bounds of the variables |

`numVar` |
a vector naming or indexing the numeric (real and integer) variables |

`intVar` |
a vector naming or indexing the integer (ordinal and nominal) variables |

`popSize` |
the population size |

`maxGen` |
the number of generations (epochs) |

`xoverOps` |
a list of crossover operator specifications |

`mutationOps` |
a list of mutation operator specifications |

`selectionOp` |
a selection operator specification |

`verbose` |
option to show progress information |

`trace` |
option to collect population statistics |

This function maximizes a supplied evaluation function using a population of solutions which are transformed by genetic operators and are sampled by their fitness values.

The following crossover operators are available:

`simpleXover`

Selects a cut point with uniform probability and exchanges the values of the following parent variables.

`nomXover`

The values of the nominal parent variables are exchanged.

`arithXover`

Computes a random linear interpolation of the (numeric) parent variables.

`heuristicXover`

Computes a random linear extrapolation of the (numeric) parent variables in the direction of the better parent.

`retry=3`

specifies the number of trials.

The following mutation operators are available:

`uniformMutation`

Selects a variable with equal probability and sets it to a random linear interpolation of its bounds.

`nonUniformMutation`

Selects a (numeric) variable with equal probability and sets it to a random linear interpolation of that variable and one of its bounds. the latter are chosen with equal probability.

`multiNonUniformMutation`

Similar as above except that all (numeric) variables are selected.

`boundaryMutation`

Selects a (numeric) variable with equal probability and set it to one of its bounds.

`binaryMutation`

Flips the value of a binary variable with probability

`p=0.005`

.

The following select operators are available:

`normGeomSelect`

Maps the order of the fitness values to a geometrically declining selection density function with parameter

`p=0.08`

.`rouletteSelect`

Uses the relative fitness values as selection density function.

`tournSelect`

Selects the best among

`n=2`

members drawn with replacement from the population.

An element of the list specifying the crossover or mutation operators is a list with an identifier string, the number of times the operator is to be applied or a probability, and further operator-specific parameters (see above). The number of times a probabilistic operator is applied is drawn from the binomial distribution. The specification of selection operators is similar: identifier plus operator-specific parameters. (see above).

Note that functions that are passed in for operators have their environment set to the environment of the optimizer, so that they can use its internal variables. Use with caution!

The arguments specifying the type of variables can be either a vectors
of identifier strings, or positional indexes. In the first case the
row names must be set on `bounds`

for referencing. By default all
variables are numeric.

The operators enforce the integer constraint by rounding. A variable that
is referenced by `intVar`

but not by `numVar`

is treated as
nominal, i.e. as integer but excluded from the application of operators
that assume a variable is ordered. In the case nominal variables are used
inclusion of the `nomXover`

operator may be considered for balancing
the operator mix.

The evaluation function is protected from the optimization environment,
i.e. it is evaluated in the environment where it was defined. Parameters of
this function can be passed in via `evalArgs`

. This may be useful in
(heuristic) approaches that try to decompose a problem.

By default a population member is passed into the evaluation function
by separate arguments, i.e.~one for each chromosome (see the example).
With the `evalVector`

option this behavior can be altered such
that the member is passed in as a vector in the first position.

A list with the following elements:

`bestFit` |
the fitness value of the best solution. |

`bestVar` |
the variable values of the best solution. |

`bestPop` |
a data.frame containing the best solutions found so far. |

`fitTrace` |
a data.frame containing fitness statistics for each generation (maximum, average, and standard deviation of the fitness). |

Christian Buchta

C.R. Houck, J.A. Joines, and M.G. Kay. (1995) A Genetic Algorithm for Function Optimization: A Matlab Implementation.

package `genalg`

for genetic optimization with float chromosomes.

1 2 3 4 5 6 7 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.