You are on page 1of 21

Optimization Techniques

Genetic Algorithms (GA)


and
Particle Swarm
Optimization (PSO)
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

Basically, GA borrows the idea and developing


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

Provide efficient, effective techniques for


optimization applications

Widely-used today in, scientific and


engineering areas
Genetic Algorithm
Based on Darwinian Paradigm

Reproduction Competition

Survive Selection

Intrinsically a robust search and


optimization mechanism
Conceptual Algorithm
Genetic Algorithm
Inspired by natural evolution
Population of individuals
Individual is feasible solution to problem
Each individual is characterized by a Fitness function
Higher fitness is better solution
Based on their fitness, parents are selected to
reproduce offspring for a new generation
Fitter individuals have more chance to reproduce
New generation has same size as old generation
Offspring has combination of properties of two parents
If well designed, population will converge to optimal
solution
Outline of Basic Genetic
Algorithm
1. Generate random population of n chromosomes (suitable solutions for
the problem)
2. Evaluate the fitness of each chromosome x in the population
3. Create a new population using following steps
a. Select two parent chromosomes from a population according to their
fitness
b. With a crossover probability cross over the parents to form new offspring
c. With a mutation probability mutate new offspring at each position in
chromosome.
d. Place new offspring in the new population

4. Use new generated population for a further run of the algorithm

5. If the end condition is satisfied, stop, and return the best solution in
current population
6. Go to step 2.
Phases of Genetic
Algorithm

1. Initialization
2. Evaluation
3. Genetic operation (objective is the generation
of new population from the existing population
with the examination of fitness values of
chromosomes and application of genetic
operators)
a. Reproduction
b. Crossover
c. Mutation
Initialization
Generation of initial population of
chromosomes( i.e. initial search points)
Population size and string length need to be
judiciously selected
Eg:-
Evaluation
Link between genetic algorithm and problem

Fitness function is defined

Suitability of each of the chromosome


(solutions) is determined.
Genetic operation
Objective is the generation of new
population from the existing population
with the examination of fitness values of
chromosomes and application of genetic
operators
a.Reproduction
b.Crossover
c.Mutation
Reproduction
Operator where 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 next generation
f (i )
selection Individual i will have a f (i)
i

Roulette wheel probability to be chosen


Tournament
Area is
1 2 Proportional
n to fitness
value
3

4
Crossover
Here the gene information of two selected
parents is utilized in certain fashion to
generate two children who bear some of the
useful characteristics of parents and
expected to be more fit than parents
Responsible for the global search property
of GA.
Various techniques that are used for
performing this crossover.
Single point crossover
Two point crossover (Multi point crossover)
Uniform crossover
Single Point Crossover
Randomly one position in the chromosomes is
chosen
Child 1 is head of chromosome of parent 1 with
tail of chromosome of parent 2
Child 2Randomly
is head of position
chosen 2 with tail of 1

Parents: 1010001110 0011010010

Offspring: 0101010010 0011001110


Multi Point Crossover
Mask is generated randomly
Cross over is made entire length of 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)
Uniform Crossover
Mask is generated randomly for each crossover
Cross over is made entire length of 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)
Mutation
It is random alteration of a bit value at a
particular bit position in the chromosome to
maintain the population diversity
Eg:- Mutation site: 4 (say)
Original String: 1011001
String after mutation: 1 0 1 0 0 0 1
Mutation Probability (Pm).
Generally mutation probability will be in the
range of 0.001 to 0.01.
Economic Dispatch Problem Using
GA
Encoded parameter is the normalized system incremental cost
d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12

The decoding of nm 12
nm d i 2 i
i 1

The actual system incremental cost , f,e = min + nm(max min)


Fitness Function 1
FIT

1 k
PD

n
where
P P
i 1
i D Ploss
Algorithm
1. Read generator data, P limits, B-coefficients, power demand and GA
parameters.

2. Generate initial population of chromosome

3. Set the iteration and chromosome count

4. Decode the chromosomes and calculate the actual system f,e incremental
cost

5. Calculate the generation output of all the units for each chromosome from its
f,e value and enforce Pi limits.

6. Calculate transmission losses using B-coefficient equation

7. Calculate the fitness value of the chromosome

8. Repeat the procedure from step no. 5 until chromosome count>population


size
Algorithm (cont.)
9. Sort the chromosomes and all their related data in the descending order of
fitness
10.Check if the error is less than . if yes, go to 17

11.Copy the Pe % chromosomes of old population to new population starting


from the best ones from the top

12.Perform crossover on selected parents and generate new child


chromosomes, repeat it to get required number of chromosomes

13.Add all the generated child chromosomes to new population

14.Perform mutation on all chromosomes

15.Replace old population with new population.


16.Increment iteration count. If iteration count <max. iteration, go for next
iteration , else print problem not converged in maximum number of
iterations
17.Calculate the total fuel cost and Print the result
Thank U

Genetic Algorithms 21

You might also like