Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

CH 3510: Optimization Techniques

CH 6640: Optimization Techniques I


Autumn 2016-17

Instructor: Dr. Kishalay Mitra


Department of Chemical Engineering
Indian Institute of Technology Hyderabad

(kishalay@iith.ac.in)

Indian Institute of Technology Hyderabad

Genetic Algorithms

Logic
Initialization: Started with a number
of solutions (Population) instead of a
single solution
Fitness: Computation of function
values for each of them
Selection: Select better solutions
from the population (Parents)
Crossover, Mutation: Creating new
solutions from parent solutions
(Children)
Continue this process till some
termination criteria it met (say
maximum number of iterations)

F(x)

Local Basin

Global Basin
X

GA Example
Max sin( x )

String DV
01 001
10 100
00 001
11 010

String
01
10
10
11

001
100
100
010

9
20
1
26

f(x)

0.912
2.027
0.101
2.685

0.791
0.898
0.101
0.485

f(x)/favg Copies Mating Pool


1.39
1.58
0.18
0.58

favg 0.569
String DV
x
01
10
10
11

000
101
010
100

8
21
18
28

01
10
10
11

001
100
100
010

f(x)

0.811
2.128
1.824
2.838

favg

01001
x

1
2
0
1

0 x

0.725
0.849
0.968
0.299
0.710
01001 24 0 23 1 22 0 21 0 20 1

Max sin(x )
0x

x max x min
DecodeValue
2L 1
3.14 0
x 0 5
9 0.912
2 1
x x min

Genetic Algorithms - Example

Max sin(x )
0x

01001 24 0 23 1 22 0 21 0 20 1

x max x min
x x min
DV
2L 1
3.14 0
x 0 5
9 0.912
2 1

Genetic Algorithms User Inputs


User choices (inputbinary.txt)
No of binary variables (Nb)
Population size (Npop)
No of generations (Ngen)
Crossover probability (pc)
Mutation probability (pm)
Length of individual strings (Lsubs)
Upper and lower bounds for variable 1
Upper and lower bounds for variable 2
Outputs (generationstat.txt)
No of binary variables
Population size
No of generations
Crossover probability
Mutation probability
Length of individual strings
Upper and lower bounds for variable 1
Upper and lower bounds for variable 2
Maximum, Minimum & Average value of
fitness in the population
Count on crossover, mutation

Requirements
Program should be modular (different
functions for initialization, fitness
evaluation, selection, crossover, mutation)
Plot evolution of population with time
Submission: Sep 20, 2016

Outputs (finalvariable.txt)
Values of variables (binary form & real
value) and objective functions of the last
generation
Outputs (allvariable.txt)
Values of variables (binary form & real
value) and objective functions of all
generations

You might also like