Summary method for class ga-class.

# S4 method for class '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

Luca Scrucca

See also

Examples

f <- function(x)  abs(x)+cos(x)
GA <- ga(type = "real-valued", 
         fitness = function(x) -f(x), 
         lower = -20, upper = 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
#> lower -20
#> upper  20
#> 
#> GA results: 
#> Iterations             = 67 
#> Fitness function value = -1.000156 
#> Solution = 
#>                 x1
#> [1,] -0.0001563269
str(out)
#> List of 11
#>  $ type       : chr "real-valued"
#>  $ popSize    : num 50
#>  $ maxiter    : num 100
#>  $ elitism    : int 2
#>  $ pcrossover : num 0.8
#>  $ pmutation  : num 0.1
#>  $ domain     : num [1:2, 1] -20 20
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:2] "lower" "upper"
#>   .. ..$ : chr "x1"
#>  $ suggestions: NULL
#>  $ iter       : int 67
#>  $ fitness    : num -1
#>  $ solution   : num [1, 1] -0.000156
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : NULL
#>   .. ..$ : chr "x1"
#>  - attr(*, "class")= chr "summary.ga"