You are on page 1of 21

Genetic Algorithms (GA)

and
Particle Swarm
Optimization (PSO)
Suresh K. Damodaran
GEC !hrissur
Optimization !echni"ues
The Genetic Algorithms
(GA)

Modeled and developed by John Holland at


University of Michigan in 1975

Direct random search algorithm based


mechanics of biological evolution

asically! "# borro$s the idea and developing


mechanism from genetic evolution and natural
selection
!he Genetic Algorithm (cont.)

%rovide efficient! effective techni&ues for


optimi'ation applications

(idely)used today in! scientific and


engineering areas
Genetic Algorithm
Genetic Algorithm

ased on Dar$inian %aradigm

*ntrinsically a robust search and


optimi'ation mechanism
Reproduction
Competition
Selection Survive
Conceptual Algorithm
Conceptual Algorithm
Genetic Algorithm

*nspired by natural evolution

%opulation of individuals

*ndividual is feasible solution to problem

+ach individual is characteri'ed by a ,itness function

Higher fitness is better solution

ased on their fitness! parents are selected to


reproduce offspring for a ne$ generation

,itter individuals have more chance to reproduce

-e$ generation has same si'e as old generation

.ffspring has combination of properties of t$o parents

*f $ell designed! population $ill converge to optimal


solution
Outline of Basic Genetic
Algorithm
1/ "enerate random population of n chromosomes 0suitable solutions for
the problem1
2/ +valuate the fitness of each chromosome x in the population
3/ 4reate a ne$ population using follo$ing steps
a/ 5elect t$o parent chromosomes from a population according to their
fitness
b/ (ith a crossover probability cross over the parents to form ne$ offspring
c/ (ith a mutation probability mutate ne$ offspring at each position in
chromosome/
d/ %lace ne$ offspring in the ne$ population
6/ Use ne$ generated population for a further run of the algorithm
5/ *f the end condition is satisfied! stop! and return the best solution in
current population
7/ "o to step 2/
Phases of Genetic
Algorithm
1/ *nitiali'ation
2/ +valuation
3/ "enetic operation 0ob8ective is the generation
of ne$ population from the e9isting population
$ith the e9amination of fitness values of
chromosomes and application of genetic
operators1
a/ :eproduction
b/ 4rossover
c/ Mutation
#nitialization

"eneration of initial population of


chromosomes0 i/e/ initial search points1

%opulation si'e and string length need to be


8udiciously selected

+g;)
E$aluation

<in= bet$een genetic algorithm and problem

Fitness function is defined

5uitability of each of the chromosome


0solutions1 is determined/
Genetic operation

.b8ective is the generation of ne$


population from the e9isting population
$ith the e9amination of fitness values of
chromosomes and application of genetic
operators
a/:eproduction
b/4rossover
c/Mutation
%eproduction

.perator $here by an old chromosome is


copied into a mating pool according to its
fitness value to produce offspring

Highly fit chromosomes receive more copies in


the ne9t generation

selection

:oulette $heel

>ournament
Area is
Proportional
to fitness
value
2
1
n
3
*ndividual i $ill have a
probability to be chosen

i
i f
i f
) (
) (
4
Crosso$er

Here the gene information of t$o selected


parents is utili'ed in certain fashion to
generate t$o children $ho bear some of the
useful characteristics of parents and
e9pected to be more fit than parents

:esponsible for the global search property


of "#/

?arious techni&ues that are used for


performing this crossover/

5ingle point crossover

>$o point crossover 0Multi point crossover1

Uniform crossover
Single Point Crosso$er
&
%andoml' one position in the chromosomes is
chosen
&
Child ( is head o) chromosome o) parent ( with
tail o) chromosome o) parent *
&
Child * is head o) * with tail o) (
Parents: 1010001110 0011010010
Offspring: 0101010010 0011001110
Randomly chosen position
+ulti Point Crosso$er
&
+as, is generated randoml'
&
Cross o$er is made entire length o) string
Parent1: 1 1 0 0 1 0 1 1
Parent2: 0 1 0 0 0 1 0 0
Mask: 0 0 1 0 1 1 0 1
Offspring1: 1 1 0 0 0 1 1 0
Offspring2: 0 1 0 0 1 0 0 1
(if mask=0, Chld1=Par1 and Chld2=Par2)
(if mask=1, Chld1=Par2 and Chld2=Par1)
-ni)orm Crosso$er
&
+as, is generated randoml' )or each crosso$er
&
Cross o$er is made entire length o) string
Parent1: 1 1 0 0 1 0 1 1
Parent2: 0 1 0 0 0 1 0 0
Mask: 0 0 1 0 1 1 0 1
Offspring1: 1 1 0 0 0 1 1 0
Offspring2: 0 1 0 0 1 0 0 1
(if mask=0, Chld1=Par1 and Chld2=Par2)
(if mask=1, Chld1=Par2 and Chld2=Par1)
+utation

*t is random alteration of a bit value at a


particular bit position in the chromosome to
maintain the population diversity

+g;) Mutation site; 6 0say1


.riginal 5tring; 1 @ 1 1 @ @ 1
5tring after mutation; 1 @ 1 @ @ @ 1

Mutation %robability 0%m1/

"enerally mutation probability $ill be in the


range of @/@@1 to @/@1/
Economic Dispatch Problem Using
GA
+ncoded parameter is the normali'ed system incremental cost
>he decoding of
nm
The actual system incremental cost !
f,e
=
min
+
nm
(
max

min
)
Fitness Function
where
d( d* d. d/ d0 d1 d2 d3 d4 d(5 d(( d(*
( )
12
1
2
i
nm i
i
d

=
=

1
1
D
FIT
k
P

=

+


1
n
i D loss
i
P P P
=
=

Algorithm
1/ :ead generator data! % limits! )coefficients! po$er demand and "#
parameters/
2. Generate initial oulation of chromosome
!. "et the iteration an# chromosome count
$. %eco#e the chromosomes an# calculate the actual system
f,e
incremental
cost
&. 'alculate the (eneration outut of all the units for each chromosome from its

f,e
)alue an# enforce *
i
limits.
7/ 4alculate transmission losses using )coefficient e&uation
7/ 4alculate the fitness value of the chromosome
A/ :epeat the procedure from step no/ 5 until chromosome countBpopulation
si'e
Algorithm (cont.)
9/ 5ort the chromosomes and all their related data in the descending order
of fitness
1@/4hec= if the error is less than C/ if yes! go to 17
11/4opy the %e D chromosomes of old population to ne$ population starting
from the best ones from the top
12/%erform crossover on selected parents and generate ne$ child
chromosomes! repeat it to get re&uired number of chromosomes
13/#dd all the generated child chromosomes to ne$ population
16/%erform mutation on all chromosomes
15/:eplace old population $ith ne$ population/
17/*ncrement iteration count/ *f iteration count Ema9/ iteration! go for ne9t
iteration ! else print Fproblem not converged in ma9imum number of
iterationsG
17/4alculate the total fuel cost and %rint the result
Genetic Algorithms Genetic Algorithms *( *(
!han, -
!han, -

You might also like