Learn R Programming

gaoptim (version 1.1)

plot.GAReal: Genetic Algorithm plot

Description

A quick way to visualize the GA results.

Usage

"plot" (x, xlab = "Generation", ylab = "Fitness", main = "GA optimization", bestcol = "steelblue", meancol = "tomato", lwd = 2, legend.pos = c("bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right", "center"), ...)

Arguments

x
An object of class GAReal.
xlab
The label for the x-axis.
ylab
The label for the y-axis.
main
The plot title.
bestcol
The color for the best fitness evolution line
meancol
The color for the mean fitness evolution line
lwd
The line width.
legend.pos
The legend position, as a character vector.
...
Other parameters (will be ignored).

Examples

Run this code
ga = GAReal(function(x) sum(x), rep(0, 5), rep(10, 5))
ga$evolve(200)
plot(ga)

Run the code above in your browser using DataLab