summary.ga-method.Rd
Summary method for class ga-class
.
an object of class ga-class
.
an object of class summary.ga
.
number of significant digits.
further arguments passed to or from other methods.
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.
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 = 74
#> Fitness function value = -1.000033
#> Solution =
#> x1
#> [1,] 3.307789e-05
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 74
#> $ fitness : num -1
#> $ solution : num [1, 1] 3.31e-05
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : NULL
#> .. ..$ : chr "x1"
#> - attr(*, "class")= chr "summary.ga"