galogistic_monitor: Monitor the process of the genetic algorithm by printing a...

Usage Arguments Examples

View source: R/galogistic_monitor.R

Usage

1

Arguments

obj

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (obj) 
{
    minEval = min(obj$evaluations)
    filter = obj$evaluations == minEval
    bestObjectCount = sum(rep(1, obj$popSize)[filter])
    if (bestObjectCount > 1) {
        bestSolution = obj$population[filter, ][1, ]
    }
    else {
        bestSolution = obj$population[filter, ]
    }
    outputBest = paste(obj$iter, " #selected=", sum(bestSolution), 
        " Best (Error=", minEval, "): ", sep = "")
    selected = as.logical(bestSolution)
    out.col = which(names(data) == output)
    selected = paste(names(data[, -out.col][, selected]), collapse = ", ")
    outputBest = paste(outputBest, selected, "\n")
    cat(outputBest)
  }

wrbrooks/galogistic documentation built on May 4, 2019, 11:58 a.m.