Learn R Programming

xegaPopulation (version 1.0.0.12)

AcceptMetropolis: Metropolis Acceptance Rule.

Description

Change the gene by a genetic operator pipeline. Always accept a new gene with a fitness improvement. For maximizing fitness accept genes with lower fitness with probability (runif(1)<exp(-(fitness-newfitness)*beta/Temperature) and reduce temperature with a cooling schedule. Used: Temperature<-alpha*Temperature with alpha<1.

Usage

AcceptMetropolis(OperatorPipeline, gene, lF)

Value

The new gene if it has at least equal performance as the old gene else the old gene.

Arguments

OperatorPipeline

Genetic operator pipeline.

gene

Gene.

lF

Local configuration.

Details

The temperature is updated at the end of each generation in the main loop of the genetic algorithm.

References

Kirkpatrick, S., Gelatt, C. D. J, and Vecchi, M. P. (1983): Optimization by Simulated Annealing. Science, 220(4598): 671-680. <doi:10.1126/science.220.4598.671>

Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., Teller, E. (1953): Equation of state calculations by fast computing machines. Journal of Chemical Physics, 21(6):1087 – 1092. <doi:10.1063/1.1699114>

See Also

Other Acceptance Rule: AcceptBest(), AcceptIVMetropolis(), AcceptNewGene()

Examples

Run this code
parm<-function(x){function() {return(x)}}
lFxegaGaGene$Beta<-parm(1)
lFxegaGaGene$TempK<-parm(10)
OPpipe1<-function(g, lF){InitGene(lF)}
g1<-lFxegaGaGene$EvalGene(InitGene(lFxegaGaGene), lFxegaGaGene)
g2<-AcceptMetropolis(OPpipe1, g1, lFxegaGaGene)

Run the code above in your browser using DataLab