gaControl {GA} | R Documentation |
A function for setting or retrieving defaults genetic operators
Description
Default settings for genetic operators used in the GA package.
Usage
gaControl(...)
Arguments
... |
no arguments, a single character vector, or a named list with components. |
Details
If the function is called with no arguments returns the current default settings, i.e., a list with the following default components:
binary
-
-
population
="gabin_Population"
-
selection
="gabin_lrSelection"
-
crossover
="gabin_spCrossover"
-
mutation
="gabin_raMutation"
-
real-valued
-
-
population
="gareal_Population"
-
selection
="gareal_lsSelection"
-
crossover
="gareal_laCrossover"
-
mutation
="gareal_raMutation"
-
permutation
-
-
population
="gaperm_Population"
-
selection
="gaperm_lrSelection"
-
crossover
="gaperm_oxCrossover"
-
mutation
="gaperm_simMutation"
-
eps
the tolerance value used by the package functions. By default set at
sqrt(.Machine$double.eps)
.useRcpp
a logical specifying if a faster C++ implementation of genetic operators should be used (
TRUE
by default), or an R implementation.
The function may be called with a single string specifying the name of the component. In this case the function returns the current default settings.
To change the default values, a named component must be followed by a single value (in case of eps
or useRcpp
) or a list of component(s) specifying the name of the function for a genetic operator. See the Examples section.
Value
If the argument list is empty the function returns the current list of values. If the argument list is not empty, the returned list is invisible.
Note
The parameter values set via a call to this function will remain in effect for the rest of the session, affecting the subsequent behaviour of the functions for which the given parameters are relevant.
Author(s)
Luca Scrucca
See Also
Examples
# get and save defaults
defaultControl <- gaControl()
print(defaultControl)
# get current defaults only for binary search
gaControl("binary")
# set defaults for selection operator of binary search
gaControl("binary" = list(selection = "gabin_tourSelection"))
gaControl("binary")
# set defaults for selection and crossover operators of binary search
gaControl("binary" = list(selection = "ga_rwSelection",
crossover = "gabin_uCrossover"))
gaControl("binary")
# restore defaults
gaControl(defaultControl)
gaControl()