genetic algorithms d nagesh kumar, iisc water resources planning and management: m9l2 advanced...

33
Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Upload: amberlynn-chambers

Post on 18-Jan-2018

229 views

Category:

Documents


1 download

DESCRIPTION

Introduction D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 3  Real world optimization problems mostly involve complexities like discrete- continuous or mixed variables, multiple conflicting objectives, non-linearity, discontinuity and non-convex region  Global optimum cannot be found in a reasonable time due to the large search space  For such problems, existing linear or nonlinear methods may not be efficient  Various stochastic search methods like  simulated annealing,  evolutionary algorithms (EA),  hill climbing can be used in such situations

TRANSCRIPT

Page 1: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Genetic Algorithms

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L2

Advanced Topics

Page 2: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Objectives

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L22

To introduce the concept of genetic algorithms (GA)

To explain the basic steps in a simple GA Parent Selection

Cross over

Mutation

To introduce Multiobjective GA’s (MOGA)

To apply MOGA in reservoir operation

Page 3: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Introduction

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L23

Real world optimization problems mostly involve complexities like discrete-

continuous or mixed variables, multiple conflicting objectives, non-linearity,

discontinuity and non-convex region

Global optimum cannot be found in a reasonable time due to the large search space

For such problems, existing linear or nonlinear methods may not be efficient

Various stochastic search methods like

simulated annealing,

evolutionary algorithms (EA),

hill climbing can be used in such situations

Page 4: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Introduction

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L24

Among these techniques, the special advantage of EA’s are

Can be applied to any combination of complexities (multi-objective, non-

linearity etc) and also

Can be combined with any existing local search or other methods

Various techniques which make use of EA approach

Genetic Algorithms (GA), Evolutionary Programming, Evolution Strategy,

Learning Classifier System etc.

EA techniques operate mainly on a population search basis.

Page 5: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Basic Concept of EA

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L25

EAs start from a population of possible solutions (called individuals) and move

towards the optimal one by applying the principle of Darwinian evolution theory i.e.,

survival of the fittest

Objects forming possible solution sets to the original problem is called phenotype

The encoding (representation) or the individuals in the EA is called genotype

The mapping of phenotype to genotype differs in each EA technique

In GA, variables are represented as strings of numbers (normally binary)

Let the number of design variables be n

Let each design variable is given by a string of length ‘l

Then the design vector will have a total string length ‘nl’

Page 6: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Basic Concept of EA…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L26

For example, if the string length be 4 for each design variable and there are 3 design

variables,

Then the chromosome length is 12 as shown

An individual consists of a genotype and a fitness function

Fitness Function: Represents the quality of the solution

Forms the basis for selecting the individuals and thereby facilitates

improvements

17,4 321 xandxx

Page 7: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Basic Concept of EA…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L27

i = 0

Initialize population P0

Evaluate initial population

while ( ! termination condition)

{

i = i+1

Perform competitive selection

Create population Pi from Pi-1 by recombination and mutation

Evaluate population Pi

}

Pseudo code for a simple EA

Page 8: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Basic Concept of EA…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L28

Flowchart indicating the steps of a simple genetic

algorithm

Generate Initial Population

Start

Encode Generated Population

Evaluate Fitness Functions

Meets Optimization Criteria?

Best Individuals

Yes

Stop

Selection (select parents)

Mutation (mutate offsprings)

Crossover (selected parents)

No

REGENERATION

Page 9: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Basic Concept of EA…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L29

Initial population is randomly generated

Individuals with better fitness functions from generation ‘i' are taken to generate

individuals of ‘i+1’th generation

New population (offspring) is created by applying recombination and mutation to

the selected individuals (parents)

Finally, the new population is evaluated and the process is repeated

The termination condition may be a desired fitness function, maximum number of

generations etc

Page 10: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L210

Individuals are distinguished based on their fitness function value

According to Darwin's evolution theory the best ones should survive and

create new offspring for the next generation

Different methods are available to select the best chromosomes

Roulette wheel selection,

Rank selection,

Boltzman selection,

Tournament selection,

Steady state selection

Page 11: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection : Roulette wheel selection

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L211

Each individual is selected with a probability proportional to its fitness value

In other words, an individual is selected depending on the percentage contribution to

the total population fitness

Thus, weak solutions are eliminated and strong solutions survive to form the next

generation Consider a population containing four strings shown

Candidate Fitness value Percentage of total fitness

1011 0110 1101 1001 109 28.09

0101 0011 1110 1101 76 19.59

0001 0001 1111 1011 50 12.89

1011 1111 1011 1100 153 39.43

Total 388 100

Page 12: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection : Roulette wheel selection…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L212

Each string is formed by concatenating four substrings representing variables a, b, c

and d. Length of each string is taken as four bits

First column represents the possible solution in binary form

Second column gives the fitness values of the decoded strings

Third column gives the percentage contribution of each string to the total fitness of

the population

Thus, the probability of selection of candidate 1, as a parent of the next generation is

28.09%

Probabilities of other candidates 2, 3, 4 are 19.59, 12.89 and 39.43 respectively

These probabilities are represented on a pie chart

Then four numbers are randomly generated between 1 and 100

Page 13: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection : Roulette wheel selection…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L213

The likeliness of these numbers falling in the region of candidate 2 might be once, whereas for candidate 4 it might be twice and candidate 1 more than once and for candidate 3 it may not fall at all

Thus, the strings are chosen to form the parents of the next generation

The main disadvantage of this method is when the fitnesses differ very much

For example, if the best chromosome fitness is 90% of the entire roulette wheel then the other chromosomes will have very few chances to be selected

Page 14: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection: Rank Selection

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L214

Population is ranked first

Every chromosome will be allotted with one fitness corresponding to this ranking

The worst will have fitness 1, second worst 2 etc. and the best will have fitness N

(number of chromosomes in population)

By doing this, all the chromosomes have a chance to be selected

But this method can lead to slower convergence, because the best chromosomes

may not differ much from the others

Page 15: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Parent Selection

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L215

Through selection new individuals cannot get introduced into the

population

Selection cannot find new points in the search space

New individuals are generated by genetically-inspired operators known are

crossover and mutation.

Page 16: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Crossover

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L216

Crossover can be of either one-point or two-point scheme

One point crossover: Selected pair of strings is cut at some random position and their

segments are swapped to form new pair of strings

Consider two 8-bit strings given by '10011101' and '10101011'

Choose a random crossover point after 3 bits from left

100 | 11101

101 | 01011

Segments are swapped and the resulting strings are

10001011

10111101

Page 17: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Crossover…

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L217

Two point crossover: There will be two break points in the strings that are randomly

chosen

At the break-point the segments of the two strings are swapped so that new set of

strings are formed

If two crossover points are selected as

100 | 11 | 101

101 | 01 | 011

After swapping both the extreme segments, the resulting strings formed are

10001101

10111011

Page 18: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Mutation

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L218

Mutation is applied to each child individually after crossover

Randomly alters each gene with a small probability (generally not greater than 0.01)

Injects a new genetic character into the chromosome by changing at random a bit in

a string depending on the probability of mutation

Example: 10111011 is mutated as

10111111

Sixth bit '0' is changed to '1‘

In mutation process, bits are changed from '1' to '0' or '0' to '1' at the randomly

chosen position of randomly selected strings

Page 19: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Real-coded GAs

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L219

GAs work with a coding of variables i.e., with a discrete search space

GAs have also been developed to work directly with continuous variables

In these cases, binary strings are not used

Instead, the variables are directly used

After the creation of population of random variables, a reproduction

operator can be used to select good strings in the population.

Page 20: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Areas of Application in Water Resources

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L220

Water distribution systems

Hydrological modeling

Watershed Management

Groundwater modeling

Reservoir Operation

Page 21: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Advantages and Disadvantages of EA

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L221

Advantages EA can be efficiently used for highly complex problems with multi-objectivity, non-

linearity etc Provides not only a single best solution, but the 2nd best, 3rd best and so on as

required. Gives quick approximate solutions Can incorporate with other local search algorithms

Disadvantages Optimal solution cannot be ensured on using EA methods Convergence of EA techniques are problem oriented Sensitivity analysis should be carried out to find out the range in which the model is

efficient Implementation requires good programming skill

Page 22: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Multi-objective Evolutionary Algorithms

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L222

Genetic algorithms are efficient in solving multiobjective problems Considerations in Multi-Objective Evolutionary Algorithms (MOEAs) implementation

are

1. Preserve non-dominated points – elitism

2. Progress towards points on Pareto front

3. Maintain diversity of points on Pareto Front (phenotype) and/or Pareto Optimal solutions

(genotype)

4. Provide decision maker a limited number of Pareto Front (PF) points.

Non-dominated solutions are always better than 1st-level dominated solutions, which

are always better than 2nd-level dominated solutions, etc. Within the same level of dominance, solutions which are isolated are better than

solutions that are clumped together.

Page 23: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Flow chart of Multi-objective Genetic Algorithm with Elitism

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L223

Page 24: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Multi-objective reservoir system optimization –Multi-objective reservoir system optimization –Case StudyCase Study

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L224

Bhadra Reservoir –Multipurpose reservoirLocation - Chickmangalur Dt, Karnataka state, India;

75o38’20’’ E longitude and 13o42’ N latitude

Schematic diagram of Bhadra reservoir Project

Left bank canal

Irrigated area6, 367 ha

Irrigated area 87, 512 ha

PH1PH2

PH3

Bhadra river

Reservoir

Left turbine capacity=2,000 kW

Bed turbine capacity=24,000 kW

Right turbine capacity=13,200 kW

Right bank canal

River Water Quality

Page 25: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Multi Objective Reservoir Operation Model

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L225

Subject to constraints on

System dynamics

Storage bounds

Maximum power production limits

Irrigation demands and

Water quality requirements

1. Minimize

Irrigation deficit (f1):

2. Maximize

Hydropower production (f2):

Page 26: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Multi Objective Reservoir Operation Model: Constraints

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L226

Reservoir storage continuity constraints

for all t=1, 2,…,12

)(S ,3,2,11t ttttttt OERRRIS

Storage bound constraintsSmin ≤ St ≤ Smax

Turbine capacity Limitsp R1,t H1,t ≤ E1,max

p Rr,t H2,t ≤ E2,max

p R3,t H3,t ≤ E3,max

Canal capacity limits R1,t ≤ C1,max R2,t ≤ C2,max

for all t=1, 2,…,NT

Irrigation demands D1min, t ≤ R1,t ≤ D1max, t D2min, t ≤ R2,t ≤ D2max, t

for all t=1, 2,…,NTWater Quality Requirements

R3,t ≥ MDTt

for all t=1, 2,…,12

for all t=1, 2,…,12

Page 27: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Pareto optimal solution for reservoir Pareto optimal solution for reservoir operationoperation

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L227

Improvement in Pareto optimal front over the iterations. f1 is annual squared irrigation deficit; f2 is hydropower generated MkWh

0 2 4 6 8 10 12

x 104

150

160

170

180

190

200

210

220

230

gen=50gen=200gen=500

f1

f2

Page 28: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Model Application

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L228

MOGA model is solved for three different inflow scenarios into the reservoir

Scenario 1: Mean monthly inflows – 0.5 * SD

Scenario 2: Mean monthly inflows

Scenario 3: Mean monthly inflows + 0.5 * SD

where SD is the standard deviation of monthly flows

Page 29: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Pareto optimal front

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L229

Pareto optimal front, showing the trade-off between irrigation ( f1) and hydropower ( f2) for different inflow scenarios.

f1 = sum of squared irrigation deficits, (Mm3)2; f2 = hydropower generated, (MkWh)

Page 30: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Reservoir operating policies

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L230

Reservoir operating policies for different

inflow scenarios, showing the initial

storages for different situations,

viz., equal priority case, irrigation only

priority case and hydropower only

priority case.

Page 31: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Optimal release policy

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L231

Optimal release policy obtained for equal priority case, showing releases in Mm3 for

Left bank canal (R1), Right bank canal (R2) and River bed (R3) for different inflow

scenarios.

Page 32: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

Advantages of MOEAs

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L232

MOEAs are easy to adopt and can provide efficient solutions for multi-objective

problems

MOEAs are capable of handling nonlinear objectives/ constraints, disconnected

Pareto-fronts, non-convex decision space

MOEAs can find solutions to extremely complex and high dimensional real-world

applications in reasonable computation time

MOEAs have high potential for multi-objective optimization of hydrological &

water resources problems

Page 33: Genetic Algorithms D Nagesh Kumar, IISc Water Resources Planning and Management: M9L2 Advanced Topics

D Nagesh Kumar, IIScWater Resources Planning and Management: M9L2

Thank You