summary.ga-method: Summary for Genetic Algorithms

Description Usage Arguments Value Author(s) See Also Examples

Description

Summary method for class ga-class.

Usage

1
2
3
4
5
## 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

1
2
3
4
5
6
7
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)
str(out)

Example output

Loading required package: foreach
Loading required package: iterators
Package 'GA' version 3.2
Type 'citation("GA")' for citing this R package in publications.

Attaching package: 'GA'

The following object is masked from 'package:utils':

    de

-- 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             = 100 
Fitness function value = -1.000052 
Solution = 
               x1
[1,] 5.226376e-05
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] "lower" "upper"
  .. ..$ : chr "x1"
 $ suggestions: NULL
 $ iter       : int 100
 $ fitness    : num -1
 $ solution   : num [1, 1] 5.23e-05
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr "x1"
 - attr(*, "class")= chr "summary.ga"

GA documentation built on May 2, 2019, 9:57 a.m.