## S4 method for signature 'ga'
summary(object, ...)
## S3 method for class 'summary.ga'
print(x, digits = getOption("digits"), ...)
Arguments
object
an object of class ga-class.
x
an object of class summary.ga.
digits
number of significant digits.
...
further arguments passed to or from other methods.
Value
The summary function returns an object of class summary.ga which can be printed by the corresponding print method. The function also returns invisibly a list with the information from the genetic algorithm search.
Author(s)
Luca Scrucca
See Also
ga
Examples
f <- function(x) abs(x)+cos(x)
GA <- ga(type = "real-valued",
fitness = function(x) -f(x),
min = -20, max = 20, run = 50)
out <- summary(GA)
print(out)
str(out)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GA)
Loading required package: foreach
Loading required package: iterators
Package 'GA' version 3.0.2
Type 'citation("GA")' for citing this R package in publications.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GA/summary.ga-method.Rd_%03d_medium.png", width=480, height=480)
> ### Name: summary.ga-method
> ### Title: Summary for Genetic Algorithms
> ### Aliases: summary,ga-method summary.ga print.summary.ga
> ### Keywords: optimize
>
> ### ** Examples
>
> f <- function(x) abs(x)+cos(x)
> GA <- ga(type = "real-valued",
+ fitness = function(x) -f(x),
+ min = -20, max = 20, run = 50)
> out <- summary(GA)
> print(out)
+-----------------------------------+
| Genetic Algorithm |
+-----------------------------------+
GA settings:
Type = real-valued
Population size = 50
Number of generations = 100
Elitism = 2
Crossover probability = 0.8
Mutation probability = 0.1
Search domain =
x1
Min -20
Max 20
GA results:
Iterations = 96
Fitness function value = -1.000018
Solution =
x1
[1,] -1.816799e-05
> str(out)
List of 11
$ type : chr "real-valued"
$ popSize : num 50
$ maxiter : num 100
$ elitism : num 2
$ pcrossover : num 0.8
$ pmutation : num 0.1
$ domain : num [1:2, 1] -20 20
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:2] "Min" "Max"
.. ..$ : chr "x1"
$ suggestions: NULL
$ iter : int 96
$ fitness : num -1
$ solution : num [1, 1] -1.82e-05
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr "x1"
- attr(*, "class")= chr "summary.ga"
>
>
>
>
>
> dev.off()
null device
1
>