Sunteți pe pagina 1din 55

Genetic Algorithms in Optimization

Satyajeet S. Bhonsale
Roll Number : 20090405 Under the Guidance of : Dr. V. S. Sathe

Department of Chemical Engineering


Dr. Babasaheb Ambedkar Technological University, Lonere.
May 17, 2012

Genetic Algorithms in Optimization

1/46

Satyajeet Bhonsale, Dr. B. A. T. University

Outline
1. What are Genetic Algorithms?
1.1 Its Applications..

2. Optimization
2.1 Traditional Methods of Optimization

3. 4. 5. 6. 7. 8. 9.

Dierence between GAs and Traditional Algorithms A Simple Genetic Algorithm Pseudo-Code Encoding of Parameters Fitness Genetic Operators Case Study 1 Optimization of CSTRs in series Case Study 2 Tuning of A PID Controller

Genetic Algorithms in Optimization

2/46

Satyajeet Bhonsale, Dr. B. A. T. University

What are Genetic Algorithms?

search algorithms based on the mechanics of natural selection search heuristic that mimic the process of natural evolution inspired by Darwins theory of Survival of the Fittest

Genetic Algorithms in Optimization

3/46

Satyajeet Bhonsale, Dr. B. A. T. University

What are Genetic Algorithms?


Its Applications..

It has a wide range of application Robotics Signal Processing Automatic Programing Economics Optimization etc.

Genetic Algorithms in Optimization

4/46

Satyajeet Bhonsale, Dr. B. A. T. University

Optimization
a process that nds the best solution for a problem An Optimization Problem revolves around three parameters 1. Objective Function 2. Unknown Variables 3. Constraints

Genetic Algorithms in Optimization

5/46

Satyajeet Bhonsale, Dr. B. A. T. University

Optimization
a process that nds the best solution for a problem An Optimization Problem revolves around three parameters 1. Objective Function 2. Unknown Variables 3. Constraints Thus optimization problem dened as Finding values of the variables that minimize or maximize the objective function, while satisfying the constraints

Genetic Algorithms in Optimization

5/46

Satyajeet Bhonsale, Dr. B. A. T. University

Traditional Methods

Four traditional methods used Analytical Methods Calculus Based Methods Enumerative Methods Random Methods

Genetic Algorithms in Optimization

6/46

Satyajeet Bhonsale, Dr. B. A. T. University

Traditional Methods Analytical

Given y = f (x), nd derivative wrt. x, equate to zero and solve for x work perfectly, but only for simple analytical functions

Genetic Algorithms in Optimization

7/46

Satyajeet Bhonsale, Dr. B. A. T. University

Traditional Methods Calculus Based

move in direction of the local gradient climb the hill in steepest possible direction are local in scope require the existence of derivative

Genetic Algorithms in Optimization

8/46

Satyajeet Bhonsale, Dr. B. A. T. University

Traditional Methods Enumerative & Random

work within a discreet search space Enumerative algorithms test every point in the space in order Random algorithms test every point in the space randomly lack eciency, as practical search spaces are too large

Genetic Algorithms in Optimization

9/46

Satyajeet Bhonsale, Dr. B. A. T. University

Dierence between GAs & Traditional Algorithms

GAs work with coding of parameter set, not parameters GAs search from a population of points, not single point Use payo information, no auxiliary knowledge required Use probabilistic transition rules, not deterministic

Genetic Algorithms in Optimization

10/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population
select pairs to mate from best ranked individuals

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population
select pairs to mate from best ranked individuals crossover pairs to produce new osprings

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population
select pairs to mate from best ranked individuals crossover pairs to produce new osprings mutate the ospring at locus

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population
select pairs to mate from best ranked individuals crossover pairs to produce new osprings mutate the ospring at locus replenish population

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

A Simple Genetic Algorithm Pseudo-Code


1. Generate initial population 2. Evaluate tness of each chromosome 3. Create new population
select pairs to mate from best ranked individuals crossover pairs to produce new osprings mutate the ospring at locus replenish population

4. Check for termination criteria


if criteria not met, goto 2 else, terminate

Genetic Algorithms in Optimization

11/46

Satyajeet Bhonsale, Dr. B. A. T. University

Encoding of Parameters

The potential solutions have to be encoded so that a computer can process them. Types of encodings : Binary Encoding Value Encoding Permutation Encoding Tree Encoding

Genetic Algorithms in Optimization

12/46

Satyajeet Bhonsale, Dr. B. A. T. University

Encoding of Parameters
Binary Encodings

Most commonly used because of its simplicity Every chromosome is a string of bits: 1s and 0s A n-bit chromosome can represent integers from 0 to 2n1 , a total on 2n integers any bit string represents a point in search space according to a mapping rule xi = xiL + xiU xiL decoded value(si ) 2n 1

Genetic Algorithms in Optimization

13/46

Satyajeet Bhonsale, Dr. B. A. T. University

Encoding of Parameters
Binary Encodings

The binary string is decoded as

l1 i i=0 2 si

The accuracy that can be achieved by a 4-bit string is only 1/16 If length is increased by one, accuracy increases exponentially to 1/32 The approximate accuracy is
xiU xiL 2n

Genetic Algorithms in Optimization

14/46

Satyajeet Bhonsale, Dr. B. A. T. University

Fitness
it quanties the optimality of the solution objective scores are scaled to produce tness score if problem is a maximization, objective scores can be used directly for minimization problems, objective scores have to be scaled The oftenly used scaling is F (x) = 1/(1 + f (x))

Genetic Algorithms in Optimization

15/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction

determines how the individuals are chosen for mating selection is done on the basis of survival of the ttest It basically picks from the population, the above average chromosomes, and inserts its multiple copies

Genetic Algorithms in Optimization

16/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction


Selection Schemes

To maintain diversity in the population, the following selection schemes are employed Rank : Select the best value every time Roulette Wheel : Probability of selection proportional to the tness Tournament : Initial large number selected by Roulette Wheel, then the best among those selected

Genetic Algorithms in Optimization

17/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction


Roulette Wheel Selection

also known as Fitness Proportionate Selection probability of being selected is directly proportional to the tness can be thought of as a game of Roulette, with wheel biased on basis of its tness the individual with highest tness occupies largest area on the wheel

Genetic Algorithms in Optimization

18/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction


Roulette Wheel Selection

The rouletter wheel is spun n times Each time the string corresponding to the area on the wheel is selected

Genetic Algorithms in Optimization

19/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction


Roulette Wheel Selection : Mathematical Implementation

Point Fitness Probability Cumulative Probability 1 25 0.25 0.00 0.25 2 5 0.05 0.25 0.30 3 40 0.40 0.30 0.70 4 30 0.30 0.70 1.00 Total 100 1 The probbaility of selecting i-th string is pi = Fi n j=1 Fj

The cumulative probability is calculated


Genetic Algorithms in Optimization 20/46 Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Selection & Reproduction


Roulette Wheel Selection : Mathematical Implementation

Point Cumulative Probability 1 0.00 0.25 2 0.25 0.30 3 0.30 0.70 4 0.70 1.00 a random number is generated between 0 and 1 the string corresponding to the range in which the number lies is selected Thus, if the random number generated = 0.46, point number 3 is selected This is repeated n times for a population of size n
Genetic Algorithms in Optimization 21/46 Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Crossover

combines two chromosomes to produce a new chromosome the ospring may be better than the parents if not, it is taken care of during selection operation of next generations crossover occurs according to a user dened crossover probability

Genetic Algorithms in Optimization

22/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Crossover


Crossover operators are of many types one-point crossover two-point crossover uniform crossover arithmetic crossover heuristic crossover One-point crossover is the simplest and most widely used in Binary GA

Genetic Algorithms in Optimization

23/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Crossover


One - Point Crossover

selects one crossover point randomly from rst parent, everything before the point is copied from second, everything after the point is copied The crossover would look as shown below

Genetic Algorithms in Optimization

24/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Mutation

used to maintain diversity in the population mutation alter one or more gene value in a chromosome mutation occurs according to an user dened probability mutation probability is usually kept low

Genetic Algorithms in Optimization

25/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Mutation

used to maintain diversity in the population prevents premature convergence of the algorithm prevents population from stagnating in local optima

Genetic Algorithms in Optimization

26/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Mutation

Flip-bit is the most commonly used mutation operator INITIAL CHROMOSOME 11001001

Genetic Algorithms in Optimization

27/46

Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Operators Mutation

Flip-bit is the most commonly used mutation operator INITIAL CHROMOSOME 1 1 0 0 1 0 0 1 FINAL CHROMOSOME 11001101 other operators include Boundary, non-uniform, uniform, Gaussian selection of operators depends upon encoding used

Genetic Algorithms in Optimization

27/46

Satyajeet Bhonsale, Dr. B. A. T. University

Parameters to Choose

population size crossover & mutation probabilities selection scheme type of crossover & mutation operator termination criteria

Genetic Algorithms in Optimization

28/46

Satyajeet Bhonsale, Dr. B. A. T. University

Benets of GAs
concept is easy to understand supports multiobjective optimization can run in parallel Genetic Algorithms are best used when the objective function is discontinuous highly nonlinear or noisy stochastic has unrealistic or undened derivative

Genetic Algorithms in Optimization

29/46

Satyajeet Bhonsale, Dr. B. A. T. University

Performance

GAs can provide solutions for highly complex search spaces GAs can be outperformed by more eld specic algorithms
The solution given by the GA can be used as an initial guess for the algorithm

A GA is only as good as the tness function

Genetic Algorithms in Optimization

30/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 1 Optimization of CSTRs in Series

In a train of 4 CSTRs, design CSTR volumes to achieve max conversion

Genetic Algorithms in Optimization

31/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 1 Optimization of CSTRs in Series


for reaction A B, r = kAn CSTR dynamics are given by d(Vi ci ) = Fci1 Fci ri Vi , dt i = 1, . . . , 4

GAs can handle any general kinetic expression GA is used as function optimizer to solve following objective min c4 V1 , . . . , V4 Subject to, V1 + V2 + V3 + V4 = 20
Genetic Algorithms in Optimization 32/46 Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 1 Optimization of CSTRs in Series


Parameter values and Nomenclature

SYMBOL F Vi , i = 1, . . . , 4 ci , i = 1, . . . , 4 c0 ri , i = 1, . . . , 4 n k

MEANING feedrate volume of i th reactor concentration of A in i th reactor concentration of A in feed rate of dissapearance of A in i th reactor reaction order reaction constant

VALUE 71m3 /hr variable variable 20kmol/m3 = kcin 2.5 0.00625 {m3 /kmol}1.5 s 1
Satyajeet Bhonsale, Dr. B. A. T. University

Genetic Algorithms in Optimization

33/46

Case Study 1 Optimization of CSTRs in Series


Results of the case study

Variable c4 V1 V2 V3 V4

This Study 0.3962kmol/m3 2.234m3 3.698m3 6.163m3 7.905m3

Edgar and Himmelbau (1988) 0.3961kmol/m3 2.242m3 3.884m3 5.849m3 8.025m3

Taken from Practical Handbook of Genetic Algorithms: Volume 3 - Applications

Genetic Algorithms in Optimization

34/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 2 Tuning of a PID Controller Parameters


Concentration Control System:

Genetic Algorithms in Optimization

35/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 2 Tuning of a PID Controller Parameters


Process Block Diagram is given by

Genetic Algorithms in Optimization

36/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 2 Tuning of a PID Controller Parameters


The Process Transfer Function is given by Gp (s) = Objective Functions

1 1 + 3 (5s + 1)(s + 1) (s + 1)3

IISE =
0

e 2 dt |e(t)|dt
0

IIAE = IITAE =
0

t|e(t)|dt 1 n
n

IMSE =
Genetic Algorithms in Optimization

e(t)2
t=1
Satyajeet Bhonsale, Dr. B. A. T. University

37/46

Case Study 2 Tuning of a PID Controller Parameters


Fitness Evaluation Fitness Value = GA Parameters used Parameter Selection Scheme Population Size Mutation Probability Crossover Probability PID Range (Variable Bounds) Value Roulette Wheel 80 0.001 1 0 40 1 performance index

Genetic Algorithms in Optimization

38/46

Satyajeet Bhonsale, Dr. B. A. T. University

Case Study 2 Tuning of a PID Controller Parameters

Results of ISE as Objective Function

Genetic Algorithms in Optimization

39/46

Satyajeet Bhonsale, Dr. B. A. T. University

Conclusion

GA though randomized, eciently utilize the historical information to converge quickly. With proper objective function, can be applied to most Chemical Engineering problems B.Tech Project
Would try to apply GA to a conventional Chemical Engineering problem the results would veried using a traditional method the results would also be validated experimentaly

Genetic Algorithms in Optimization

40/46

Satyajeet Bhonsale, Dr. B. A. T. University

For Further Reading I


Deb Kalyanmoy Optimization for Engineering Design: Algorithms and Examples. Pretince-Hall India, 1996. Goldberg D. E. Genetic Algorithms in Search, Optimization, and Machine Learning. Addison Wesley Longman (Singapore) Pte. Ltd., 1991. Deb Kalyanmoy An Introduction to Genetic Algorithms Sadhana Academy Proceedings in Engineering Sciences, Volume 24: 293 315, 1999.
Genetic Algorithms in Optimization 41/46 Satyajeet Bhonsale, Dr. B. A. T. University

THANK YOU

Genetic Algorithms in Optimization

42/46

Satyajeet Bhonsale, Dr. B. A. T. University

Performance Criteria for Controller Tuning


Integral of the Square Error Used if large errors are to be suppressed. Errors are squared; thus contribute more to the value of integral Integral of the Absolute Error Used for suppression of small errors. If small errors are squared, they become smaller. Integral of Time Weighted Absolute Error Used to supress errors that persist for long times. Presence of t amplies the eect of even small errors.

Genetic Algorithms in Optimization

43/46

Satyajeet Bhonsale, Dr. B. A. T. University

Local and Global Optima

local optima is the optimal point only in a particular neighbourhood or locality there may be a point better than the local optima global optima is the optimal point in the entire search space there is no point in the entire search space that is better than the global optima
Genetic Algorithms in Optimization 44/46 Satyajeet Bhonsale, Dr. B. A. T. University

Types of Encodings

Value Encoding any value pertaining to the problem e.g. CHROMOSOME 1: 1.09 2.88 4.12 6.22 CHROMOSOME 2: (BACK) (LEFT) (LEFT) (RIGHT) Permutation Encoding used in ordering problems e.g. CHROMOSOME 1: 1 3 2 8 5 6 4 7 CHROMOSOME 2: 8 2 5 1 6 4 3 7

Genetic Algorithms in Optimization

45/46

Satyajeet Bhonsale, Dr. B. A. T. University

Two Point Crossover

bit information between the two crossover points is exchanged

Genetic Algorithms in Optimization

46/46

Satyajeet Bhonsale, Dr. B. A. T. University

S-ar putea să vă placă și