133
C. Patvardhan, Dayalbagh Educational Institute 1 Evolutionary Algorithms for Optimization

Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 1

Evolutionary Algorithms for

Optimization

Page 2: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 2

Given F(z), z X

where X is a set of n-tuples in Rn

Find x X such that for all y X, y ≠ x, F(y) ≤ F(x)

Subject to Constraints C1, C2, …, Cn which are conditions that the

optimum x must satisfy. Could be equality or inequality constraints.

Function F is called the Objective function

Optimization

Page 3: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 3

Why Optimize?• The inherent human desire to optimize is

cerebrated in the famous Dante quotation:All that is superfluous displeases God and Nature All that displeases God and Nature is evil.

• In engineering, optimal projects are considered beautiful and rational, and the far-from-optimal ones are called ugly and meaningless.

• {Of course, profits are beautiful!}

• Obviously, every engineer tries to create the best project and he/she relies on optimization methods to achieve the goal.

Page 4: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 4

• The general principle by Maupertuis proclaims:If there occur some changes in nature, the amount of action necessary for this change must be as small as possible.

• This principle proclaims that the nature always finds the "best" way to reach a goal.

• It leads to an interesting inverse optimization problem: Find the essence of optimality of a natural "project."

Nature as Optimizer

Page 5: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 5

Essence of Optimization• The essence of an optimization problem is:

Catching a black cat in a dark room in minimal time. (A constrained optimization problem corresponds to a room full of furniture.)

• A light, even dim, is needed.

• Optimization methods explore assumptions about the character of response of the goal function to varying parameters and suggest the best way to change them.

• The variety of a priori assumptions corresponds to the variety of optimization methods. This variety explains why there is no silver bullet in optimization theory.

Page 6: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 6

Typical Algebraic approach

• Differentiate F(z) where F(z) is the function whose

optima are to be determined.

• Equate to zero and solve to get z1, z2 etc.

• Sign of F’’(z) at these points indicates whether these

are maxima or minima.

Page 7: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 7

Descent Methods

• Basic Idea

– Start at a point in feasible space.

– Use direction suggested by gradient to move to a better

point.

– Continue till no more improvement is possible.

• Solution depends on the initial point chosen.

• Idea is quite general.

• Used to solve several problems.

Page 8: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 8

Local and Global Optima

Local Minima

Global Minima

0

F(z)

Z

Page 9: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 9

Combinatorial Optimization (CO)

• Combinatorics is a branch of mathematics concerned

with the study of arrangement and selection of discrete

objects.

• Important class of problems in CO have finite discrete

state space.

• Combinatorial optimization is concerned with the

determination of an optimal arrangement or order.

Page 10: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 10

Some definitions

• An instance of a CO problem is a pair (Ω, Cost),

where Ω is a finite set of feasible solutions to the

problem and

Cost : Ω -> R.

• A feasible solution S of an instance of a CO problem

(Ω, Cost) is also called a state (S Ω). The set of

feasible solutions Ω is called the state space.

• Let S1 and S2 be two solutions to the CO problem. Then

S1 is judged better than or equal to S2 if Cost (S1) <

Cost(S2).

Page 11: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 11

Some more definitions

• A neighborhood N(S) of solution S is the set of solutions

obtained by performing a simple move m M, where M

is the set of simple moves that are allowed on S.

• Sˆ Ω is a local minimum with respect N(S) if Sˆ has a

lower cost than any of its neighboring solutions.

• S* is global minimum iff

Cost(S*) ≤ Cost(S) for all S Ω.

The objective of solving CO problem is to identify such an

S*.

Page 12: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C Patvardhan, Dayalbagh Educational Institute 12

Solution to CO problems• A solution to a CO problem requires design of a suitable

algorithm which when applied to an instance of the

problem provides S*.

• Algorithmic solutions to CO problems involve an

extremely large number of steps and are impossible to

execute by hand.

• Solution possible due to the power of modern computers.

• CO problems are found in science, engineering, OR,

economics etc.

Page 13: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 13

Classes of Search Techniques

Finonacci Newton

Direct methods Indirect methods

Calculus-based techniques

Evolutionary strategies

Centralized Distributed

Parallel

Steady-state Generational

Sequential

Genetic algorithms

Evolutionary algorithms Simulated annealing

Guided random search techniques

Dynamic programming

Enumerative techniques

Search techniques

Page 14: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 14

Evolutionary Algorithms (EA)

Based on the evolutionary principle of natural selection.

Used when the search space is too large for effective search throughout the space.

Typically, only a satisficing solution rather than an optimal solution is obtained.

The simplest form of an EA is the Simple Genetic Algorithm that uses binary strings to represent the search space.

Page 15: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 15

Evolution

Concept and Terminology

Page 16: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 16

Darwin’s Theory of Evolution

•During reproduction, traits found in parents are passed on to their offspring.

•Variations (mutations) are present naturally in all species producing new traits.

•A process called natural selection, ‘selects’ individuals best adapted to the environment.

•Over long periods of time, variations can accumulate and produce new species.

Page 17: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 17

Natural Selection

• The fittest survive longest.

• Characteristics, encoded in genes are transmitted to offspring and tend to propagate into new generations.

• In sexual reproduction, the chromosomes of offsprings are a mix of their parents.

• An offspring’s characteristics are partially inherited from parents and partly the result of new genes created during the reproduction process.

Page 18: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 18

Genetics An individual is “coded” by the sequence of DNA coding for genes, which are arranged in chromosomes.

Each cell typically has the same complement of pairs of chromosomes, which are inherited from the two parents.

This mixing of DNA from two individuals is called Recombination.

Sometimes during the process of copying chromosomes, errors occur - these are called Mutations.

Page 19: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 19

Evolutionary Algorithms

Evolutionary Algorithms are based on biological metaphors

– Potential solutions to a problem are encoded as a sequence of genes.

––A transformation from genes to solution is defined, along with a “fitness function” which assigns a numerical value to each potential solution -its fitness

––The algorithm maintains a population of potential solutions.

–Iteratively fitter members of the population are selected to be used as parents, and new individuals are generated by recombination and mutation, then incorporated into the population, replacing other members

Page 20: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 20

Different types of EAs

• Historically different flavours of EAs have been associated with different representations– Binary strings : Genetic Algorithms– Real-valued vectors : Evolution Strategies– Finite state Machines: Evolutionary Programming– LISP trees: Genetic Programming

• These differences are largely irrelevant, best strategy – choose representation to suit problem– choose variation operators to suit

representation

• Selection operators only use fitness and so are independent of representation

Page 21: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 21

EAs and Global Optimisation

• Global Optimisation: search for finding best solution x* out of some fixed set S

• Deterministic approaches

– e.g. box decomposition (branch and bound etc)

– Guarantee to find x* , but may run in super-polynomial time

• Heuristic Approaches (generate and test)

– rules for deciding which x S to generate next

– no guarantees that best solutions found are globally optimal

Page 22: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 22

EAs and Neighbourhood Search

• Many heuristics impose a neighbourhood structure on S

• Such heuristics may guarantee that best point found is locally optimal e.g. Hill-Climbers:

– But problems often exhibit many local optima

– Often very quick to identify good solutions

• EAs are distinguished by:

– Use of population,

– Use of multiple, stochastic search operators

– Especially variation operators with arity >1

– Stochastic selection

Page 23: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 23

Genetic Algorithms

Basic Idea

Page 24: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 24

Genetic Algorithms : Motivation

• “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions you might not otherwise find in a lifetime.”

- Salvatore Mangano

• Computer Design, May 1995

Page 25: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 25

The Genetic Algorithm

• Directed search algorithms based on the mechanics of biological evolution

• Developed by John Holland, University of Michigan (1970’s)

– To understand the adaptive processes of natural systems

– To design artificial systems software that retains the robustness of natural systems

Page 26: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 26

The Genetic Algorithm

• Provides efficient, effective techniques for optimization and machine learning applications

• Widely-used today in business, scientific and engineering circles

Page 27: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 27

Components of a GA

• A problem to solve, and ...

• Encoding technique (gene, chromosome)

• Initialization procedure (creation)

• Evaluation function (environment)

• Selection of parents (reproduction)

• Genetic operators (mutation, recombination)

• Parameter settings (practice and art)

Page 28: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 28

Simple Genetic Algorithm

{

– initialize population;

– evaluate population;

– while TerminationCriteriaNotSatisfied

– {• select parents for reproduction;

• perform recombination and mutation;

• evaluate population;

– }}

Page 29: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 29

Illustrative Example

Simple Genetic Algorithm

Page 30: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 30

A simple GA example

•Problem: Find the value of x which maximizes the function

f(x)=x2

on the integer range for x [0..31].

•Method–1) Use 5 bits to represent a solution

–2) Choose a population of 4 individuals (small by GA standards), values chosen at random.

Page 31: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 31

•Sample population–01101, 11000, 01000, 10011

•Fitness values–169, 576, 64, 361 Av. 293•

Reproduction (Roulette wheel)–14.4%, 49.2%, 5.5%, 30.9%

•Selection for Crossover–01101 and 11000

•Crossover after bit 4 (random)–0110 0 and 1100 1

•Another selection for Crossover–11000 and 10011

•Crossover after bit 2 (random) –11 011 and 10 000

Page 32: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 32

•New population after first generation–01100, 11001, 11011, 10000

•Fitness values–144, 625, 729, 256 Av. 439

•Next generation will start with this population

•Mutation: Change one bit probabilistically e.g p_m = 0.001

–Expected probability of a mutation of one individual is 0.005.

–Expected probability of a mutation in whole family is 0.02

Page 33: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 33

•Eventually get convergence with best individual–11111 and a fitness of 961

•This problem was very easy because:–Very small search space–Only one parameter–Very smooth steep function, with no local maxima–The encoding was obvious

•We will look at each stage of a genetic algorithm in detail, considering some of the different methods and problems that can be encountered.

Page 34: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 34

Genetic Algorithms

Steps in detail

Page 35: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 35

The GA Cycle of Reproduction

reproduction

population evaluation

modification

discard

deleted

members

parents

children

modified

children

evaluated children

Page 36: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 36

Population

• Chromosomes could be:

– Bit strings (0101 ... 1100)

– Real numbers (43.2 -33.1 ... 0.0 89.2)

– Permutations of element (E11 E3 E7 ... E1 E15)

– Lists of rules (R1 R2 R3 ... R22 R23)

– Program elements (genetic programming)

– ... any data structure ...

Page 37: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 37

Representation of Search space

Coding – Binary, Integer, Real-valued, Permutation, Tree etc.

Inclusion of constraints in the coding.

Larger population size favors greater exploration of search space, lesser probability of premature convergence, higher computation costs.

Smaller population size favors faster convergence, tendency to get stuck in local minima, premature convergence, parts of search space remain unexplored.

Page 38: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 38

Reproduction

reproduction

population

parents

children

Parents are selected at random with selection chances biased in relation to chromosome evaluations.

Page 39: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 39

SelectionDetermines which individuals are chosen for mating

(recombination) and how many offspring each selected individual produces.

Fitness assignment by:

Proportional fitness assignment : Fitness assigned with respect to the relative values of the objective functions.

Rank-based fitness assignment : The population is sorted according to the objective values.

Page 40: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 40

Methods of Selection

Elitist selection

•The most fit members of each generation are guaranteed to be selected.

•Most GAs do not use pure elitism.

•Use a modified form where the single best, or a few of the best, individuals from each generation are copied into the next generation.

Page 41: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 41

Truncation selection

Individuals are sorted according to their fitness.

Only the best individuals are selected as parents.

These selected parents produce uniform at

random offspring.

Page 42: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 42

Fitness-proportionate selection

More fit individuals are more likely, but not certain, to be selected.

Several common ways of implementing this strategy.

Page 43: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 43

Roulette-wheel selection

• A form of fitness-proportionate selection.

• The chance of an individual's being selected is proportional to the amount by which its fitness is greater or less than its competitors' fitness.

• This can be represented as a game of roulette -each individual gets a slice of the wheel, but more fit ones get larger slices than less fit ones.

• The wheel is then spun, and whichever individual "owns" the section on which it lands each time is chosen.

Page 44: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 44

Roulette-wheel selection

Stochastic universal sampling

Stochastic universal sampling ensures a selection of offspring which is

closer to what is deserved than roulette wheel selection.

Page 45: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 45

Scaling selection

• As the average fitness of the population increases, the strength of the selective pressure also increases and the fitness function becomes more discriminating.

• This method can be helpful in making the best selection later on when all individuals have relatively high fitness and only small differences in fitness distinguish one from another.

Page 46: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 46

Tournament selection Tour individuals are chosen randomly from the population.

Best individual from this group is selected as parent.

This process is repeated as often as individuals to choose.

These selected parents produce uniform at random offspring.

Page 47: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 47

Rank selection

• Each individual in the population is assigned a numerical rank based on fitness.

• Selection is based on this ranking rather than absolute differences in fitness.

• It can prevent very fit individuals from gaining dominance early at the expense of less fit ones, which would reduce the population's genetic diversity and might hinder attempts to find an acceptable solution.

Page 48: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 48

Generational selection

• The offspring of the individuals selected from each generation become the entire next generation.

• No individuals are retained between generations.

Page 49: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 49

Steady-state selection

• The offspring of the individuals selected from each generation go back into the pre-existing gene pool, replacing some of the less fit members of the previous generation.

• Some individuals are retained between generations.

Page 50: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 50

Hierarchical selection

• Individuals go through multiple rounds of selection each generation.

• Lower-level evaluations are faster and less discriminating, while those that survive to higher levels are evaluated more rigorously.

• Reduces overall computation time by using faster, less selective evaluation to weed out the majority of individuals that show little or no promise, and only subjecting those who survive this initial test to more rigorous and more computationally expensive fitness evaluation

Page 51: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 51

Comparing different Selection Schemes

Selective pressure: probability of the best individual being selected compared to the average probability of selection of all individuals.

Bias: absolute difference between an individual's normalized fitness and its expected probability of reproduction.

Spread: range of possible values for the number of offspring of an individual.

Loss of diversity: proportion of individuals of a population that is not selected during the selection phase.

Page 52: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 52

The GA Cycle of Reproduction

reproduction

population evaluation

modification

discard

deleted

members

parents

children

modified

children

evaluated children

Page 53: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 53

Recombination

Real valued recombination

o Discrete recombination

o Intermediate recombination

o Line recombination

o Extended line recombination

Binary valued recombination (crossover)

o Single-point crossover

o Multi-point crossover

o Uniform crossover

o Shuffle crossover

o Crossover with reduced surrogate

Page 54: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 54

Discrete recombination

Discrete recombination performs an exchange of variable values between the individuals.

For each variable the parent who contributes its variable to the offspring is chosen randomly with equal probability.

Discrete recombination can be used with any kind of variables (binary, real or symbols).

Page 55: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 55

Intermediate recombination

Only applicable to real variables.

The variable values of the offspring are chosen somewhere around and between the variable values of the parents.

offspring = parent 1 + Alpha (parent 2 - parent 1),

where Alpha is a scaling factor chosen uniformly at random over an interval [-d, 1 + d].

In intermediate recombination d = 0, for extended intermediate recombination d > 0.

Page 56: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 56

Single-point crossover

One crossover position k[1,2,...,Nvar-1],

Nvar: number of variables of an individual

Selected uniformly at random

Variables exchanged between the individuals about this point

Two new offspring are produced.

Page 57: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 57

Multi-point crossover

m crossover positions ki[1,2,...,Nvar-1], i=1:m, are chosen at random

Sorted in ascending order.

Variables between successive crossover points are exchanged between the two parents to produce

two new offspring.

Page 58: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 58

Crossover: Recombination

P1 (0 1 1 0 1 0 0 0) (0 1 0 0 1 0 0 0) C1

P2 (1 1 0 1 1 0 1 0) (1 1 1 1 1 0 1 0) C2

Crossover is a critical feature of genetic

algorithms:

– It greatly accelerates search early in evolution of a population

– It leads to effective combination of schemata (subsolutions on different chromosomes)

*

Page 59: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 59

The GA Cycle of Reproduction

reproduction

population evaluation

modification

discard

deleted

members

parents

children

modified

children

evaluated children

Page 60: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 60

Chromosome Modification

modificationchildren

modified children

• Modifications are stochastically triggered• Operator types are:

– Mutation– Crossover (recombination)

Page 61: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 61

MutationAfter recombination.

Offspring variables are mutated by the addition of small random values with low probability.

The probability of mutating a variable is set to be inversely proportional to the number of variables (dimensions).

The more dimensions one individual has the smaller is the mutation probability.

There are two mutation operators : Real valued mutation and Binary mutation

Page 62: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 62

Real valued mutation

The size of the mutation step is usually difficult to choose.

The optimal step size depends on the problem considered and may even vary during the optimization process.

Small steps are often successful, but sometimes bigger steps are quicker.

Binary mutation

For binary valued individuals mutation means flipping of

variable values.

Page 63: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 63

Mutation: Local Modification

• Before: (1 0 1 1 0 1 1 0)

• After: (0 1 1 0 0 1 1 0)

• Before: (1.38 -69.4 326.44 0.1)

• After: (1.38 -67.5 326.44 0.1)

• Causes movement in the search space

(local or global)

• Restores lost information to the population

Page 64: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 64

Evaluation

• The evaluator decodes a chromosome and assigns it a fitness measure

• The evaluator is the only link between a classical GA and the problem it is solving

evaluation

evaluated

children

modified

children

Page 65: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 65

Reinsertion

Global reinsertion

Pure reinsertion produce as many offspring as parents and replace all parents by the offspring

Uniform reinsertion produce less offspring than parents and replace parents uniformly at random.

Elitist reinsertion produce less offspring than parents and replace the worst parents.

Fitness-based reinsertion produce more offspring than needed for reinsertion and reinsert only the best offspring.

Page 66: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 66

Local reinsertion

Insert every offspring and replace individuals in neighborhood uniform at random.

Insert every offspring and replace weakest individuals in neighborhood.

Insert offspring fitter than parent and replace it.

Page 67: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 67

Deletion

population

discard

discarded members

• Generational GA:entire populations replaced with each iteration

• Steady-state GA:a few members replaced each generation

Page 68: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 68

Examples

Page 69: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 69

An Abstract Example

Distribution of Individuals in Generation 0

Distribution of Individuals in Generation N

Page 70: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 70

A Simple Example

“The Gene is by far the most sophisticated program around.”

- Bill Gates, Business Week, June 27, 1994

Page 71: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 71

8-Queens Problem

Page 72: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 72

Place 8 queens on an 8x8 chessboard insuch a way that they cannot check each other

Example: the 8 queens problem

Page 73: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 73

EA for Eight Queens Problem

Design an EA for the Eight Queens Problem.

Representation

Initialization

Operators

Fitness Function

Termination Criteria

Convergence Issues ……

Page 74: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 74

A simple implementation

• Each square numbered from 1 to 64

• Binary string of 64 integers, 1 indicates a queen in that position, 0 indicates absence.

• Initialization randomly with eight 1’s in each string.

• Crossover?

• Fitness Function?

• Would this approach be successful?

• Efficient?

Page 75: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 75

The 8 queens problem: representation

1 23 45 6 7 8

Genotype:

a permutation of

the numbers 1 - 8

Phenotype:

a board configuration

Obvious mapping

Page 76: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 76

• Penalty of one queen:

the number of queens she can check.

• Penalty of a configuration: the sum of the penalties of all queens.

• Note: penalty is to be minimized

• Fitness of a configuration: inverse penalty to be maximized

8 Queens Problem: Fitness evaluation

Page 77: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 77

The 8 queens problem: Mutation

Small variation in one permutation, e.g.:• swapping values of two randomly chosen positions,

1 23 45 6 7 8 1 23 4 567 8

Page 78: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 78

The 8 queens problem: Recombination

Combining two permutations into two new permutations:• choose random crossover point• copy first parts into children• create second part by inserting values from other parent:

• in the order they appear there • beginning after crossover point• skipping values already in child

8 7 6 42 531

1 3 5 24 678

8 7 6 45 123

1 3 5 62 874

Page 79: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 79

• Parent selection:

– Pick 5 parents and take best two to undergo crossover

• Survivor selection (replacement)

– When inserting a new child into the population, choose an existing member to replace by:

– sorting the whole population by decreasing fitness

– enumerating this list from high to low

– replacing the first with a fitness lower than the given child

The 8 queens problem: Selection

Page 80: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 80

8 Queens Problem: summary

Note that is is only one possible

set of choices of operators and parameters

Page 81: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 81

Discussion

Page 82: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 82

EAs v/s Traditional Optimization Methods

Search a population of points in parallel, not a singlepoint.

Do not require derivative information or other auxiliaryknowledge; only the objective function andcorresponding fitness levels influence the directions ofsearch.

Use probabilistic transition rules.

Generally more straightforward to apply.

Can provide a number of potential solutions to a givenproblem. The final choice is left to the user.

Page 83: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 83

When to Use a EA

• Alternate solutions are too slow or overly complicated

• Need an exploratory tool to examine new approaches

• Problem is similar to one that has already been successfully solved by using a GA

• Want to hybridize with an existing solution

• Benefits of the GA technology meet key problem requirements

Page 84: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 84

Reported Applications

• Lockheed Martin

• Glaxo Smith Kline

• LBS Capital Management

• First Quadrant

• Texas Instruments

• U.S. West

• John Deere & Co.

• Volvo

• Ascent Technology

• Boeing

• British Petroleum

• Ford Motor Company

• Unilever

Page 85: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 85

Some EA Application Types

Domain Application Types

Control gas pipeline, pole balancing, missile evasion, pursuit

Design semiconductor layout, aircraft design, keyboardconfiguration, communication networks

Scheduling manufacturing, facility scheduling, resource allocation

Robotics trajectory planning

Machine Learning designing neural networks, improving classificationalgorithms, classifier systems

Signal Processing filter design

Game Playing poker, checkers, prisoner’s dilemma

Combinatorial

Optimization

set covering, travelling salesman, routing, bin packing,graph colouring and partitioning

Page 86: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 86

Benefits of Evolutionary Algorithms• Concept is easy to understand

• Modular, separate from application

• Supports multi-objective optimization

• Good for “noisy” environments

• Always an answer; answer gets better with time

• Inherently parallel; easily distributed

Page 87: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 87

Benefits of Evolutionary Algorithms (cont.)

• Many ways to speed up and improve a GA-based application as knowledge about problem domain is gained.

• Easy to exploit previous or alternate solutions.

• Flexible building blocks for hybrid applications.

• Substantial history and range of use

Page 88: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 88

Difficulties in implementing EAs

Successful operation depends on “Good Implementation” details.

May exhibit premature convergence.

Search may be slow.

Function being optimized may be “GA Hard”.

Page 89: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 89

Issues for EA Practitioners

• Representation of search space.

• Population size.

• Variety of operators.

• Convergence issues.

• Stopping criteria.

• Handling constraints in GA.

• Including Domain knowledge and other hybrid methods.

Page 90: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 90

Convergence Issues Enable convergence while sufficient diversity is maintained in

the population .

Prevention of wandering.

Prevention of premature convergence.

Number of iterations.

Stopping criterion: Quality of solution, Number of generations, No. of moves accepted.

Page 91: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 91

Typical behavior of an EA

Early phase:

quasi-random population distribution

Mid-phase:

population arranged around/on hills

Late phase:

population concentrated on high hills

Phases in optimizing on a 1-dimensional fitness landscape

Page 92: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 92

Typical run: progression of fitness

Typical run of an EA shows so-called “anytime behavior”

Best

fitn

ess in p

opula

tion

Time (number of generations)

Page 93: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 93

Be

st fitn

ess in

po

pu

latio

n

Time (number of generations)

Progress in 1st half

Progress in 2nd half

Are long runs beneficial?

• Answer:

- it depends how much you want the last bit of progress- it may be better to do more shorter runs

Page 94: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 94

T: time needed to reach level F after random initialization

TTime (number of generations)

Be

st fitn

ess in

po

pu

latio

n

F: fitness after smart initializationF

Is it worth expending effort on smart initialization?

• Answer : it depends:

- possibly, if good solutions/methods exist.- care is needed

Page 95: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 95

Evolutionary Algorithms in Context

• There are many views on the use of EAs as robust problem solving tools

• For most problems a problem-specific tool may:

– perform better than a generic search algorithm on most instances,

– have limited utility,

– not do well on all instances

• Goal is to provide robust tools that provide:

– evenly good performance

– over a range of problems and instances

Page 96: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 96

Scale of “all” problems

Perf

orm

ance o

f m

eth

od

s o

n p

roble

ms

Random search

Special, problem tailored method

Evolutionary algorithm

EAs as problem solvers: Goldberg’s 1989 view

Page 97: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 97

EAs and domain knowledge

• Trend in the 90’s:

adding problem specific knowledge to EAs

(special variation operators, repair, etc)

• Result: EA performance curve “deformation”:

– better on problems of the given type

– worse on problems different from given type

– amount of added knowledge is variable

• Recent theory suggests the search for an “all-purpose” algorithm may be fruitless

Page 98: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 98Scale of “all” problems

P

Michalewicz’s 1996 viewP

erf

orm

ance o

f m

eth

ods o

n p

roble

ms

EA 1

EA 4

EA 3EA 2

Page 99: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 99

Some observations• Tendency to converge towards local solutions rather

than global solutions. • Operating on dynamic data sets is difficult. • Opinion divided over the importance of crossover

verses mutation. – Some argue that crossover is the most important,

while mutation is only necessary to ensure that potential solutions are not lost.

– Others argue that crossover in a largely uniform population only serves to propagate innovations originally found by mutation, and in a non-uniform population crossover is nearly always equivalent to a very large mutation (which is likely to be catastrophic).

• EAs are not good at finding optimal solutions, but can rapidly locate good solutions, even for difficult search spaces.

Page 100: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 100

GA Hard Problems

• Specially designed to stretch GAs

• Characteristics of GA Hard problems

– Multimodality

– Deception

– Multimodal Deception

Page 101: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 101

Handling Constraints in

Evolutionary Optimization

Tricky!

Page 102: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 102

•Many problems require that the solution satisfies certain constraints e.g.

–TSP - no city should be visited more than once.–Timetabling -people can’t be in two places at once.–Job Shop Scheduling -only 1 task at a time per machine–Parameter optimization ( often X >0 ...)

•In general m constraints fall into two types:

•inequalities: g_i(x) < 0, 1…i…q•equalities h_i(x) = 0, q+1 … i…m

Constrained Optimization

Page 103: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 103

•Can define problem as finding the value of x such

that function f(x) is optimized, where the representation is such that x lies in search space S.

•In general S will be split into two disjoint sets of spaces:

–F (the feasible regions) –U (the unfeasible regions).

•The spaces in F may or may not be connected (implications for EAs?).

Feasible & Unfeasible Regions

Page 104: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 104

Handling Constraints

If search space is highly constrained most of the offsprings may be infeasible.

Generate and Test rejects infeasible solutions after testing them – penalty functions used often.

Wastage of computational effort.

Alternatively, build in the constraints into the coding. Only feasible solutions are generated. No wastage of computational effort.

Page 105: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 105

–Should infeasible individuals (n) be penalized ?

•i.e. eval_u(n) = eval_f(n) + penalty(n)•if so how is the function penalty() devised ?

–Should “decoders” be used, where all individuals are interpreted as feasible ?

–Should infeasible individuals be repaired ?

–Should the initialization and generation operators be used which only produce feasible solutions ?

Considerations

Page 106: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 106

•Assuming a minimization problem, the general

form, will be :min f(x) such that x ε A, x ε Bwhere the constraints x ε A are easy to satisfy and those x ε B are harder.

•This can be reformulated as:

min f (x + p(d (x, B) ) whered(x, B) is a distance function of x from B, andp(.) is a penalty function s.t. p(0) =0

Penalty Functions

Page 107: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 107

•Distance metrics might include:

•number of violated constraints•sum of constraint violations ( linear or exponential)•distance to feasible region

•Penalty function must balance exploration of infeasible region, with not wasting time.

Issues with penalty functions

Page 108: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 108

Some variants:

1.Fixed penalty for all infeasible solutions

2.Add a penalty C for each violated constraint

•These two are generally inferior to using some distance metric from feasible region

3. Penalty Functions based on cost of repair.

Static Penalty Functions

Page 109: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 109

•Attempt to solve problem of setting the values of

C_i by hand.

•Idea is to progressively penalize infeasible solutions as time progresses

•Still need to fine tune penalties to problem–too lenient => infeasible solutions in final pop.–too harsh => converge to sub-optimal solution

Dynamic Penalty Functions

Page 110: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 110

• Revise penalties based on performance of best

over last few generations.

• Penalty involves estimating “near feasible threshold” over time

• Change bias as constraints satisfied

Adaptive Penalty Functions

Page 111: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 111

•Methods of dealing with CSP’s where genome gives

instructions to decoder on how to build feasible solution.

•Decoder maps from a representation space R into the feasible regions F of the solution space S

•for every solution s in F there must be at least one representation d in R•every d in R must map to one solution s in S•every s in S must map to the same number of representations in R: need not be 1:1

Decoders

Page 112: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 112

•Sort items by profit/weight

•Decoder reads string from left to right and interprets a ‘1’ as “take this item if possible”

e.g. 11011000100100….. is interpreted as take items 1,2,5,6,10 …

•Redundancy arises at right hand end of string.

•Can use normal crossover and mutation operators with guarantee of feasible solutions

Decoder Example: Knapsack Problem

Page 113: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 113

•Representation: alleles in position i can have values

in the range [1, n -i+1] e.g. 1:1-9, 8:1,2

•Decoder views Cities as ordered list, starting at

position 1 with C = (1,2,3,4,5,6,7,8,9)

•In position i put the d_i th element of C and then

remove that element from C

e.g. 124385967 is represented by [112141311]

•Can use normal crossover and (relatively) normal

mutation operators

Decoder Example: TSP

Page 114: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 114

•Method of solving CSP’s where an algorithm is used

to “repair” infeasible solutions, i.e:

eval_u (x) = eval_f(y)

where y is repaired version of x

•Major issue of whether to replace x with y

–Some authors suggest P(replacement) ~ 5-15%

•For some problems repair algorithm may be very time

consuming.

Repair Algorithms

Page 115: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 115

•In Knapsack problem with overfull knapsack,

algorithm selects and removes items until weight

constraint is met.

•Choice of item to replace could be:

–random/ probabilistic

–leftmost/rightmost deterministic

–one with worst p/w ratio deterministic“greedy”

–using p.d.f. according to p/w ratio probabilistic

Example Repair Algorithms: Discrete

Page 116: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 116

Food for thought

Some philosophical (?) discussion

Page 117: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 117

Philosophical Issues

The real-world demonstration of the power of

evolution that GAs represent has proven surprising

and disconcerting to creationists, who have always

claimed that intelligent design, not random

variation and selection, could have produced the

information content and complexity of living things.

– Tornado blowing through a junkyard producing a 747 !

Page 118: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 118

Philosophical Issues (2)• No Free Lunch Theorem

– Any evolutionary algorithm is no better than blind search when viewed over all possible problems.

• There is something “oddly compelling and almost magical” about the way GAs can find solutions that are unlike anything designed by human beings… All the specified complexity we get out an EA has first to be put into its construction and into the information that guides the algorithm. EAs, therefore, do not generate or create specified complexity, but merely harness existing specified complexity - No Free Lunch: Why specified Complexity cannot be purchased without intelligence (W. Dembski)

Page 119: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 119

More objections (1)

– Some traits in living beings are qualitative, whereas GAs are always quantitative.

– GAs select for one trait at a time, whereas living things are multidimensional. In living things with hundreds of traits, selection has to operate on all traits that affect survival.

Page 120: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 120

More objections (2)

• GAs do not allow the possibility of extinction or error catastrophe.

• GAs neglect the fact that an allele that contirbutes less to an organism’s fitness takes a correspondingly longer time to get fixated in the population.

• GAs employ unrealistically high rates of mutation and reproduction.

Page 121: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 121

More objections (3)

• GAs have preordained goals that are predetermined at the outset

• With a particular GA, we need to ask how much of the ‘information’ generated by the program is actually specified in the program, rather than being generated de novo.

Page 122: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 122

Rebuttal

• “GAs do not capture the essential aspects of evolution as found in nature”

– Who cares!

– Actually each of the objections can be taken up and arguments that show that the objection are not valid can be presented.

• GAs do not work.

– No, they do!

Page 123: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 123

Rebuttal (2)

• True EAs simply do not find their way back to solutions already discovered by other methods.

• They are presented with problems for which optimal solutions are not known in advance, and are asked to discover solution on their own.

• If EAs could not discover their own solutions, who would use them?

• Widespread scientific and commercial interest shows that there is some substance to them.

Page 124: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 124

Finally …

• Evolution is a problem solving strategy rich with practical applications.

• Its power we are only beginning to understand and exploit; it is already around us and shaping our technology and improving our lives.

• Evolution works!

• “Tis strange but true; for truth is always strange, stranger than fiction” (Lord Byran).

Page 125: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 125

Main cause of concern in EAs

Long computational times.

Ensure that the search reaches all the regions of the search space.

When search reaches a particular region ensure that you do not miss any good solution in that region.

Meanwhile, try to keep computation requirements within reasonable limits.

Page 126: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 126

Exploration vs Exploitation

• Exploration takes the search to new regions in the search space. – Search operators are supposed to do this i.e. Mutation and

recombination take search to new regions.

• Exploitation intends to ensure that no good solution in the region visited is missed. – Selection is supposed to do this.

– All selection mechanisms consider actual representation as irrelevant. Consider only fitness values.

• Important to keep balance. One is typically at the expense of the other.

Page 127: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 127

Exploration vs Exploitation (2)

• Several issues still unresolved and there are several “best” ways of doing things reported in the literature !

• And if you do not like any of them, you can wait for the next “best” way of doing things to be published.

Page 128: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 128

Speeding up EAs

Page 129: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 129

Inclusion of domain knowledge EA quickly finds promising regions; difficulty in finding

exact optimum.

Integration of descent methods speeds-up convergence.

Domain knowledge not necessarily related to gradient.

Basic question : Given a chromosome and a fitness function can I find a neighboring chromosome with better fitness value than the first one?

If yes, it can be used.

Page 130: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 130

Knowledge-based TechniquesGoldberg:

"In other words, the operators of human innovative thought are, at least at times, directed by knowledge.

By contrast, in their purest form, genetic algorithms are blind search procedures: they exploit only the coding and the objective function value to determine plausible trials in the next generation.

This is both a blessing and a curse.

On the one hand, their indifference toward problem-specific information in large part gives genetic algorithms their broad competence, a procedure that works well without knowledge peculiar to a specific problem has a better chance of transferring to another domain.

Page 131: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 131

Quote cont.

–On the other hand, not using all the knowledge

available in a particular problem puts genetic algorithms at a competitive disadvantage with methods that do make use of that information."

–We now look at some of the ways of augmenting GAs with domain knowledge.

Page 132: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 132

Hybrid Schemes

–Construct hybrid that exploits the global perspective of the GA the local, focused perspective of the domain-specific technique.

–For example, use the GA to find hills and gradient-based techniques to climb them.

In this way, the GA is used to optimize the search for promising areas of the search space and the hill climber is used to optimize the search locally in the discovered areas.

Page 133: Evolutionary Algorithms for Optimization - ERNETpkalra/siv895/EA.pdfEvolutionary Algorithms (EA) Based on the evolutionary principle of natural selection. Used when the search space

C. Patvardhan, Dayalbagh Educational Institute 133

Hybrid Schemes (2)

EA and Descent methods

EA and Simulated Annealing.

EA and Tabu Search.

Integration of EA and Neural Networks : wide variety.

EA and Fuzzy Systems