Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.rbga

R Based Genetic Algorithm Plot Function


Description

Plots features of the genetic algorithm optimization run. The default plot shows the minimal and mean evaluation value, indicating how far the GA has progressed.

The "hist" plot shows for binary chromosome the gene selection frequency, i.e. the times one gene in the chromosome was selected in the current population. In case of floats chromosomes, it will make histograms for each variable to indicate the selected values in the population.

The "vars" plot the evaluation function versus the variable value. This is useful to look at correlations between the variable and the evaluation values.

Usage

## S3 method for class 'rbga'
plot(x, type="default", breaks=10, ...)

Arguments

x

a rbga object.

type

one of "hist", "vars" or "default".

breaks

the number of breaks in a histogram.

...

options directly passed to the plot function.

Examples

evaluate <- function(string=c()) {
    returnVal = 1 / sum(string);
    returnVal
}

rbga.results = rbga.bin(size=10, mutationChance=0.01, zeroToOneRatio=0.5,
    evalFunc=evaluate)

plot(rbga.results)
plot(rbga.results, type="hist")

genalg

R Based Genetic Algorithm

v0.2.0
GPL-2
Authors
Egon Willighagen and Michel Ballings
Initial release
2015-03-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.