Learn R Programming

xegaPopulation (version 1.0.0.12)

terminateAbsoluteError: Terminates, if the absolute deviation from the global optimum is small.

Description

terminateAbsoluteError() returns TRUE if the value of the current solution is in the interval from (globalOptimum - eps) to (globalOptimum + eps).

Usage

terminateAbsoluteError(solution, lF)

Value

Boolean.

Arguments

solution

A named list with at least the following elements: $name, $fitness, $value, $numberOfSolutions, $genotype, $phenotype, $phenotypeValue.

lF

Local function configuration. It must contain

  • lF$penv$globalOptimum() which returns the global optimum.

  • lF$TerminationEps() which specifies the the maximal allowed deviation of the current best solution from the global optimum.

Details

Useful for benchmark functions with known global optima.

See Also

Other Termination Condition: terminateGEQ(), terminateLEQ(), terminatePAC(), terminateRelativeError(), terminateRelativeErrorZero(), terminatedFalse()

Examples

Run this code
    parm<-function(x){function() {return(x)}}
    olst<-list(); olst$value<-10
    penv<-list(); penv$globalOptimum<-parm(olst)
    lF<-list(); lF$penv<-penv; lF$TerminationEps<-parm(1.2);lF$Max<-parm(1.0)
    solution<-list(); solution$genotype<-list(); solution$genotype$fit<-8.0
    terminateAbsoluteError(solution, lF)
    solution<-list(); solution$genotype<-list(); solution$genotype$fit<-8.9
    terminateAbsoluteError(solution, lF)

Run the code above in your browser using DataLab