Old Years Computations

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

Evolutionary Computation

Chao Lan
Outline
Introduction

Genetic Algorithm

Evolutionary Algorithm

Genetic Programming
Hard Search Problems
“When a problem is computationally too
hard to solve using an exact and complete
algorithm, it is common in computer
science to explore the use of heuristics in
order to find approximate solutions to the
problem, or to converge faster towards
some solutions.”
Search Problem: Another Perspective
We want to select a configuration most fitted for the problem.
Nature Selects Most Fitted through Evolution
More Fitted Survives and Reproduces!
A Schematic Diagram of Natural Selection
Population

Evaluate Fitness of Each Individual

Select Fitted Individuals


(Eliminate Unfitted Individuals)

Crossover/Mutation
Evolutionary Computation
Population
How to represent individual?

Evaluate Fitness of Each Individual How to evaluate fitness?

Select Fitted Individuals How to do crossover?


(Eliminate Unfitted Individuals)
How to do mutation?

Crossover/Mutation
Reference Book
Outline
Introduction

Genetic Algorithm

Evolutionary Strategy

Genetic Programming
Genetic Algorithm
Overview

GA Algorithm

Schema Theorem

Application
Introduction
GAs are “a class of stochastic search algorithms based on biological evolution”.
Major Steps of GA
1. encode problem variable into chromosome

2. define fitness function

3. generate initial population (of size N)

4. select a pair of chromosomes

5. apply crossover & mutation to generate offsprings

6. repeat 4-5 to get a new population (of size N)

7. replace old population with new population

8. repeat 4-7 until converge


Read [AIGIS] Figure 7.2 for a complete diagram of genetic algorithm.
Genetic Algorithm
Overview

GA Algorithm

Schema Theorem

Application
Example Task
Find an integer x ∈ [0,15] that maximizes f(x) = 15x - x^2.
Task: max f(x) = 15x - x^2, x ∈ [0,15].

1. design chromosome
- encode each individual uniquely as a fixed-length binary string
Task: max f(x) = 15x - x^2, x ∈ [0,15].

1. design chromosome
- encode each individual uniquely as a fixed-length binary string
Task: max f(x) = 15x - x^2, x ∈ [0,15].

2. design fitness function (based on decoded variable).


Task: max f(x) = 15x - x^2, x ∈ [0,15].

2. design fitness function (based on decoded variable).


Task: max f(x) = 15x - x^2, x ∈ [0,15].

3. generate initial population randomly (after choosing a population size N).


Task: max f(x) = 15x - x^2, x ∈ [0,15].

4. select a pair of individuals with probabilities proportion to fitness.


- an individual with higher fitness has higher chance of being selected
Task: max f(x) = 15x - x^2, x ∈ [0,15].

4. select a pair of individuals with probabilities proportion to fitness.


- an individual with higher fitness has higher chance of being selected
- Q: how to implement selection?
Task: max f(x) = 15x - x^2, x ∈ [0,15].

4. select a pair of individuals with probabilities proportion to fitness.


- an individual with higher fitness has higher chance of being selected
- Roulette wheel selection technique (one spun to select one chromosome)
Task: max f(x) = 15x - x^2, x ∈ [0,15].

5. apply crossover on each selected pair of chromosomes with probability.


- randomly select a breakpoint to do crossover
Task: max f(x) = 15x - x^2, x ∈ [0,15].

5. apply crossover on each selected pair of chromosomes with probability.


- randomly select a breakpoint to do crossover
- occur with a probability (e.g., 70%), otherwise do cloning

Thus there are two sources of randomness during crossover.


Task: max f(x) = 15x - x^2, x ∈ [0,15].

6. apply mutation on each offspring (after crossover) with probability.


- each element can mutate its value with probability
Task: max f(x) = 15x - x^2, x ∈ [0,15].

6. apply mutation on each offspring (after crossover) with probability.


- each element can mutate its value with probability
- mutation often occurs with very small probability (e.g., 0.1%-1%)

More often mutation hurts average fitness other than improves it.
Task: max f(x) = 15x - x^2, x ∈ [0,15].

6. apply mutation on each offspring (after crossover) with probability.


- each element can mutate its value with probability
- mutation often occurs with very small probability (e.g., 0.1%-1%)
- Q: why mutate at all?

More often mutation hurts average fitness other than improves it.
Summary of the Example
1. design chromosome

2. define fitness function

3. generate initial population

4. select a pair of chromosomes

5. apply crossover & mutation

6. repeat 4-5 to get a new population

7. replace old population with new one

8. repeat 4-7 until converge


Q: what if we have multiple variables?
Applying GA on Multiple Variables
Task: find x, y ∈ [-3, 3] that maximize
Applying GA on Multiple Variables
Task: find x, y ∈ [-3, 3] that maximize

We can encode each variable separately, concatenate their chromosomes into a


long chromosome, and then apply standard GA on the long chromosome.
Simulation Results
Applying GA on Multiple Variables
Task: find integers x, y ∈ [-3,Q1:
3] that
how maximize
to evaluate fitness?

We can encode each variable separately, concatenate their chromosomes into a


long chromosome, and then apply standard GA on the long chromosome.
Applying GA on Multiple Variables
Task: find integers x, y ∈ [-3,Q1:
3] that
how maximize
to evaluate fitness?

We can encode each variable separately, concatenate their chromosomes into a


Q2: would separate GA be better than concatenated GA?
long chromosome, and then apply standard GA on the long chromosome.
Q: how do we know if converged result is good
(e.g., not local optimum)?
Performance Evaluation Techniques
To examine robustness of result
- increase mutation probability
- increase population size

Pm = 0.001 Pm = 0.01
Performance Evaluation Techniques
To examine robustness of result
- increase mutation probability
- increase population size

Plot performance graph


- best + average
- easier to use than surface
Performance Graph
Performance Graph

Q: why fluctuating?
Performance Graph
We can reduce damage of mutation by increasing population size.

population = 60 population = 6
Genetic Algorithm
Overview

GA Algorithm

Application

Schema Theorem
Task: Power System Maintenance
Find a sequence of outages of power units over a given period of time such that
the security of a power system is maximized.
Net Reserve
net reserve = total installed generating capacity of the system
- power loss (due to a scheduled outage)
- maximum load forecast during the maintenance period

Net reserve should be non-negative at any time interval.


Net Reserve
net reserve = total installed generating capacity of the system
- power loss (due to a scheduled outage)
- maximum load forecast during the maintenance period

Net reserve should be non-negative at any time interval (maximized in total).


Problem Setting
Maintain 7 power units over 4 time intervals. Total capacity is 150.
Forecasted loads over 4 intervals are 80, 90, 65 and 70, respectively.

The power unit is megawatt (MW).


Major Steps of GA
1. encode problem variable into chromosome

2. define fitness function

3. generate initial population (of size N)

4. select a pair of chromosomes

5. apply crossover & mutation to generate offsprings

6. repeat 4-5 to get a new population (of size N)

7. replace old population with new population

8. repeat 4-7 until converge


Read [AIGIS] Figure 7.2 for a complete diagram of genetic algorithm.
Chromosome Design
Chromosome Design
Chromosome Design
Fitness Function Design
Fitness Function Design
Fitness Function Design
Crossover Design
Crossover Design
Mutation Design
Mutation Design
Mutation Design
Simulation Result
Simulation Result
Genetic Algorithm
Overview

GA Algorithm

Application

Schema Theorem
Concepts
A schema is a set of bit strings of ones, zeros and asterisks,
where each asterisk can assume either value 1 or 0.

An instance of a schema is an instantiation of all its asterisks.

We can describe behavior of GA in terms of increase or


decrease in the number of a given schema.
- e.g., a fitted schema has more instances in future
Schema Theorem
Basically, the Schema Theorem says a more fitted schema has higher chance of
surviving in the next generation.
Schema Theorem
Basically, the Schema Theorem says a more fitted schema has higher chance of
surviving in the next generation.

1. Offspring Selection Lemma


- fitted schema is more likely to have offspring

2. Crossover Survival Lemma


- shorter schema is more likely to survive

3. Mutation Survival Lemma


- low-order schema is more likely to survive
Notations
mP is # instances in population P.

mH(i) is # instances in schema H.

fP(i) is mean fitness of instances in P.

fH(i) is mean fitness of instances in H.

fx(i) is fitness of instance x.

* all i’s means at generation i.


Offspring Selection Lemma
mP is # instances in population P. Claim 1: expected number of instances
in H passed down to generation i+1 is
mH(i) is # instances in schema H.
MH(i+1) = mH(i) fH(i) / fP(i)
fP(i) is mean fitness of instances in P.

fH(i) is mean fitness of instances in H.

fx(i) is fitness of instance x.

* all i’s means at generation i.

By “pass down”, we mean an instance is selected to generate offspring (without considering any crossover or mutation).
Offspring Selection Lemma
mP is # instances in population P. Claim 1: expected number of instances
in H passed down to generation i+1 is
mH(i) is # instances in schema H.
MH(i+1) = mH(i) fH(i) / fP(i)
fP(i) is mean fitness of instances in P.
Interpretation
fH(i) is mean fitness of instances in H. If H has higher fitness than the population, its
size is expected to increase in next round.
fx(i) is fitness of instance x.

* all i’s means at generation i.


Offspring Selection Lemma
mP is # instances in population P. Claim 1: expected number of instances
in H passed down to generation i+1 is
mH(i) is # instances in schema H.
MH(i+1) = mH(i) fH(i) / fP(i)
fP(i) is mean fitness of instances in P.
Interpretation
fH(i) is mean fitness of instances in H. If H has higher fitness than the population, its
size is expected to increase in next round.
fx(i) is fitness of instance x.
Proof
* all i’s means at generation i. …...
Notations
pc is probability of crossover.

L is length of schema H.

Ld is defining length of schema H.


- distance between outermost defined bits
Crossover Survival Lemma
pc is probability of crossover. Claim 2: schema H can survive after
single-point crossover with a probability
L is length of schema H. lower bounded by

Ld is defining length of schema H. PH,c = 1 - pc Ld / (L-1)


- distance between outermost defined bits
Crossover Survival Lemma
pc is probability of crossover. Claim 2: schema H can survive after
single-point crossover with a probability
L is length of schema H. lower bounded by

Ld is defining length of schema H. PH,c = 1 - pc Ld / (L-1)


- distance between outermost defined bits
Interpretation
Shorter schema is more likely to survive.
Crossover Survival Lemma
pc is probability of crossover. Claim 2: schema H can survive after
single-point crossover with a probability
L is length of schema H. lower bounded by

Ld is defining length of schema H. PH,c = 1 - pc Ld / (L-1)


- distance between outermost defined bits
Interpretation
Shorter schema is more likely to survive.

Proof
…...
Notations
pm is probability of mutation.

n is order of a schema
- number of non-asterisks in schema
Mutation Survival Lemma
pm is probability of mutation. Claim 3: schema H can survive after
mutation with probability
n is order of a schema
PH,m = (1 - pm)^n
- number of non-asterisks in schema
Mutation Survival Lemma
pm is probability of mutation. Claim 3: schema H can survive after
mutation with probability
n is order of a schema
PH,m = (1 - pm)^n
- number of non-asterisks in schema

Interpretation
Low-order schema is more likely to survive.
Mutation Survival Lemma
pm is probability of mutation. Claim 3: schema H can survive after
mutation with probability
n is order of a schema
PH,m = (1 - pm)^n
- number of non-asterisks in schema

Interpretation
Low-order schema is more likely to survive.

Proof
…...
Putting All Together
Basically, the Schema Theorem says a more fitted schema has higher chance of
surviving in the next generation.

1. Offspring Selection Lemma Schema Theorem


- MH(i+1) = mH(i) fH(i) / fP(i) The expected number of instances in H
at generation i+1 is lower bounded by
2. Crossover Survival Lemma
E[mH(i+1)] = MH(i+1) ⋅ PH,m ⋅ PH,c
- PH,c = 1 - pc Ld / (L-1)

3. Mutation Survival Lemma


- PH,m = (1 - pm)^n

You might also like