terminateRelativeErrorZero {xegaPopulation}R Documentation

Terminates if relative deviation from optimum is small. Works at 0.

Description

terminateRelativeErrorZero() returns TRUE if the value of the current solution is in the interval from (globalOptimum - (globalOptimum*eps)) to (globalOptimum + (globalOptimum*eps)). If globalOptimum is zero, test interval (0-eps) to (0+eps).

Usage

terminateRelativeErrorZero(solution, lF)

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 fraction of the global optimum used for computing the upper and lower bounds for the interval in which the best current solution must be for terminating the algorithm.

Details

Useful for benchmark functions with known global optima. Note that for a global optimum of 0 this function terminates if the current optimum is between 0-terminationEps and 0+terminationEps.

Value

Boolean.

See Also

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

Examples

    parm<-function(x){function() {return(x)}}
    olst<-list(); olst$value<-0
    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<-0.5
    terminateRelativeErrorZero(solution, lF)
    solution<-list(); solution$genotype<-list();  solution$genotype$fit<-9.6
    terminateRelativeErrorZero(solution, lF)

[Package xegaPopulation version 1.0.0.7 Index]