Flexible general-purpose toolbox implementing genetic algorithms (GAs) for stochastic optimisation. Binary, real-valued, and permutation representations are available to optimize a fitness function, i.e. a function provided by users depending on their objective function. Several genetic operators are available and can be combined to explore the best settings for the current task. Furthermore, users can define new genetic operators and easily evaluate their performances. Local search using general-purpose optimisation algorithms can be applied stochastically to exploit interesting regions. GAs can be run sequentially or in parallel, using an explicit master-slave parallelisation or a coarse-grain islands approach.
An R package for stochastic optimisation using Genetic Algorithms.
The GA package provides a flexible general-purpose set of tools for implementing genetic algorithms search in both the continuous and discrete case, whether constrained or not. Users can easily define their own objective function depending on the problem at hand. Several genetic operators are available and can be combined to explore the best settings for the current task. Furthermore, users can define new genetic operators and easily evaluate their performances. Local search using general-purpose optimisation algorithms can be applied stochastically to exploit interesting regions. GAs can be run sequentially or in parallel, using an explicit master-slave parallelisation or a coarse-grain islands approach.
You can install the released version of GA from CRAN:
or the development version from GitHub:
# install.packages("devtools")devtools::install_github("luca-scr/GA", build_vignettes = TRUE)
Usage of the main functions and several examples are included in the papers shown in the references section below.
For an intro see the vignette A quick tour of GA, which is available as
The vignette is also available in the Get Started section on the GitHub web page of the package at http://luca-scr.github.io/GA/.
Scrucca, L. (2013) GA: A Package for Genetic Algorithms in R. Journal of Statistical Software, 53(4), 1-37. https://www.jstatsoft.org/article/view/v053i0
Scrucca, L. (2017) On some extensions to GA package: hybrid optimisation, parallelisation and islands evolution. The R Journal, 9(1), 187–206. https://journal.r-project.org/archive/2017/RJ-2017-008
de()implementing Differential Evolution based on the description in Simon (2013) Evolutionary Optimization Algorithms.
gails()when suggestions are provided.
summary()function calls are shortened.
gaControl()to control if the C++ implementation of genetic operators should be used. By default is set to TRUE.
upper. The old nomenclature is still accepted but deprecated.
stopParallel()function to stop a cluster if
parallel = TRUE, including
registerDoSEQ()to avoid problems if foreach loop is used after.
parallelargument in the
min> 1. Thanks to Romero Barata.
README.Rmdthat is shown in GitHub and CRAN.
optim()for local search.
gaMonitor()to clear the previous output before printing the info about the current iteration. Old version is available in
gaMonitor2(). Same behaviour for
ga_pmutation()function to allow GAs having variable mutation probability.
inst/docwith corresponding index.html.
.printShortMatrix()is a function to print part of rows/columns of a matrix
print.summary.ga()accept arguments to be passed to
.printShortMatrix(). This allow to shorten the printed output in case of large dimensions for the matrices containing the suggestions and the final solutions.
plot.ga()now shadowed the area between the max and the median of fitness values at each iteration. Changed to pch from 17 to 1 for means.
gaSummary()is embedded in the code, so it cannot be defined by the user.
ga_pmutation()for computing variable mutation probability.
ga()to allow for pmutation to be a function. This enables the use of variable mutation rate.
NAMESPACEand used as S4 method.
gaSummary(), but it may be defined by the user.
NAMESPACEand used as S4 method.
ga()is set to NULL.