GeneticAlgorithm

GeneticAlgorithm - A Simple Genetic Algorithm L A T E X...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A Simple Genetic Algorithm L A T E X file: ga-nb-all Daniel A. Graham <daniel.graham@duke.edu>, June 30, 2005 For the objective function to be maximized, take a quadratic with one local and one global maximum in the interval [0,31] In: objective = (x- 14 ) 2; In: Plot [ objective , { x, , 31 } ] ; 5 10 15 20 25 30 50 100 150 200 250 Call the binary form of the objective function " Fitness " : In: Fitness [ a_ ] := ( a[[ 1 ]] 2 4 + a[[ 2 ]] 2 3 + a[[ 3 ]] 2 2 + a[[ 4 ]] 2 + a[[ 5 ]]- 14 ) 2 Check the values of Fitness at 00000 (0), 01110 (14) and 11111 (31): In: { Fitness [ { , , , , } ], Fitness [ { , 1 , 1 , 1 , } ], Fitness [ { 1 , 1 , 1 , 1 , 1 } ] } Out: { 196 , , 289 } The initial population Given n, randomly determine an initial population of 2n 5-digit binary strings: In: InitPop [ n_ ] :=Table Random [ Integer ], { i, 1 , 2 n } , j, 1 , 5 Reproduction Reproduction must take an initial population, determine the fitness of each member, select a new population from the initial randomly with probabilities proportional to fitness, randomly select pairs...
View Full Document

This document was uploaded on 10/20/2011.

Page1 / 3

GeneticAlgorithm - A Simple Genetic Algorithm L A T E X...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online