Docsity

Genetic Algorithms: A Problem-Solving Approach using Evolution and Natural Selection, Slides of Computational Physics

Partial preview of the text

Download Genetic Algorithms: A Problem-Solving Approach using Evolution and Natural Selection and more Slides Computational Physics in PDF only on Docsity!

Introduction to Genetic Algorithms

Dr. Nasir M Mirza

Computational Physics^ Computational Physics

Email: [email protected]

Basic genetic algorithms^ Step 1

:^ Represent the problem variable domain as

a chromosome of a fixed length, choose the sizeof a chromosome population

N , the crossover

probability

p and the mutation probability c^

p. m

Step 2

:^ Define a fitness function to measure the

performance, or fitness, of an individualchromosome in the problem domain. The fitnessfunction establishes the basis for selectingchromosomes that will be mated duringreproduction.

Step 6

:^ Create a pair of offspring chromosomes byapplying the genetic operators

−^ crossover

and

mutation. Step 7:

Place the created offspring chromosomes

in the new population. Step 8:

Repeat

Step 5

until the size of the new

chromosome population becomes equal to thesize of the initial population,

N.

Step 9

:^ Replace the initial (parent) chromosomepopulation with the new (offspring) population.

Step 10

:^ Go to

Step 4

, and repeat the process until the

termination criterion is satisfied.

Genetic algorithmsGenetic algorithms „^ GA represents an iterative process. Each iteration is „GA represents an iterative process. Each iteration iscalled a^ called a

generationgeneration

. A typical number of generations. A typical number of generations

for a simple GA can range from 50 to over 500. The^ for a simple GA can range from 50 to over 500. Theentire set of generations is called a^ entire set of generations is called a

runrun

„^ Because^ „Because „^ A common practice is to terminate a GA after a specified^ „A common practice is to terminate a GA after a specifiednumber of generations and then examine the best^ number of generations and then examine the bestchromosomes in the population. If no satisfactory solution is^ chromosomes in the population. If no satisfactory solution isfound, the GA is restarted.^ found, the GA is restarted.

GAsGAs

use a stochastic search method, the fitness of ause a stochastic search method, the fitness of a

population may remain stable for a number of generations^ population may remain stable for a number of generationsbefore a superior chromosome appears.^ before a superior chromosome appears.

Advantage •^ We can now simulate the processes of naturalselection and competition within our population. •^ We can have our candidate designs fight forplaces in the population of future generations(iterations).

Evolutionary Algorithms •^ Date back to the 1950’s. •^ Many researchers independently developeddifferent versions.^ •

Examples are:^ •^

Genetic Algorithms, • Evolution Strategies, • Evolutionary Programming.

Basic Terminology •^ Gene:

The fundamental physical and functional unit of

heredity.^ •^ A gene is an ordered sequence of nucleotides located in aparticular position on a particular chromosome that encodes aspecific functional product. • Chromosome:

The self-replicating genetic structures of

cells each containing the entire genome of an organism.^ •^ Its main feature is its self-replicating structure

Basic Terminology •^ Alleles:

Alternative forms of a genetic locus.

-^ Crossing Over:

The breaking during meiosis of one

maternal and one paternal chromosome, the exchangeof corresponding sections of DNA, and the rejoining ofthe chromosomes.^ •^ This process can result in an exchange of alleles betweenchromosomes. • Mutation:

A heritable change in the genetic makeup of

an organism.

5 Basic Components •^ An encoded representation of solutions to the problem.^ •^

Ex. binary encoding, real number encoding, integer encoding, datastructure encoding.

-^ A means of generating an initial population.^ •

Ex. random initialization, patterned initialization.

-^ A means of evaluating design fitness.^ •

Need a consistent means of determining which designs are “better”than others.

-^ Operators for producing and selecting new designs.^ •

Ex. selection, crossover, mutation.

-^ Values for the parameters of the algorithm.^ •

Ex. How much crossover and mutation, how big is population.

General Approach •^ General equation describing most evolutionaryalgorithms is:

]))[

] 1

[^

tx

vs

tx

Where:x[t] is the population at time

t ;

v() is/are the variation operator(s);s() is the selection operator

x[t+1] is the population at next time step

t+1.

GAs: Binary Coded Representations •^ For Example, let’s say that we are trying tooptimize the following function,^ •

f(x) = x

2

-^ for 2

≥^ x

≥^1

-^ If we were to use binary-codedrepresentations we would first need to developa mapping function form our genotyperepresentation (binary string) to ourphenotype representation (our CS). This canbe done using a mapping function:

Encoding

Individual Chromosome:

^00101 Fitness =

????? d(2,1,5,

00101

) = 1.

Individual Chromosome: f(1.16) = 1.

^00101 Fitness =

The Fitness Assignment Process for Binary Coded

Chromosomes (

ub=2, lb=1, l=

)

Binary Coded Representations:

Encoding •^ Vectors of real numbers.^ •

Useful for continuous problems. Min:^

f( x ) = x[1]

2 + x[2] –

(^3) x[3]

- 50

s.t.^

g ( x )^

≤^0 h ( x ) = 0 x ≤^ xl^

≤^ xu

Possible DesignConfigurations:

[ 13.65, -1.25, 30.98 ] [^ 0.67, 14.81, 67.15 ] [ 53.74, 12.54, -21.32 ]

Encoding Vectors of real numbers •^ Real-Coded GAs can be regarded as GAs thatoperate on the actual phenotype. •^ For Real-Coded GAs, no genotype-to-phenotype mapping is needed.