EvalGeneStoch | R Documentation |
EvalGeneStoch()
evaluates a gene in
a stochastic problem environment.
EvalGeneStoch(gene, lF)
gene |
A gene. |
lF |
The local configuration of the genetic algorithm. |
In a stochastic problem environment, the expected fitness
is maximized. The computation of the expectation is
done by incrementally updating the mean.
For this, need the number of evaluations of the gene
($obs
of the gene).
In addition, we compute the incremental variance
of the expected fitness
stored in $var
.
The standard deviation is then gene$var/gene$obs
.
If the evaluation of the fitness function of the
problem environment fails, we catch the error and
return NA
for the first evaluation of the gene.
If the gene has been evaluated, we return the old gene.
A gene with the elements
$evaluated
: Boolean.
$evalFail
: Boolean.
$fit
: Mean fitness of gene.
$gene1
: Gene.
$obs
: Number of evaluations of gene.
$var
: Variance of fitness.
$sigma
: Standard deviation of fitness.
Other Evaluation Functions:
EvalGene()
,
EvalGeneDet()
,
EvalGeneR()
,
EvalGeneU()
DeJongF4<-DeJongF4Factory()
lF<-NewlFevalGenes(DeJongF4)
g1<-list(evaluated=FALSE, evalFail=FALSE, fit=0, gene1=c(1.0, -1.5))
g1
g2<-EvalGeneStoch(g1, lF)
g2
g3<-EvalGeneStoch(g2, lF)
g3
g4<-EvalGeneStoch(g3, lF)
g4
g5<-EvalGeneStoch(g4, lF)
g5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.