Professional Documents
Culture Documents
Metaheuristic Optimization
Dr. Mohamad Hafis Izran Bin Ishak
Department of Control & Mechatronics (CMED)
Faculty of Electrical Engineering
Universiti Teknologi Malaysia.
• Purpose
– The course will give an overview of, and
introduction to, modern heuristic optimization
methods that are suitable for solving practical
optimization problems.
1
Formulation of
Abstract Problem
Solve the
Abstract
Problem
Real-World Problem
Motivation: Operations
Research (OR)
• WW-II British military
• Scientists and engineers from several fields
• Analysis and Decision Support
– Placement of Radar Stations
– Guidance of convoys
– Bombing raids
– Anti-submarine campaigns
– Laying of mines
– Operational Analysis/Operations Research
2
Today: OR/Management
Science
• Scientific approach to decision making
regarding deciding on how a system is to be
designed and operated, usually under
conditions with limited resources
– (Winston: Operations Research Applications and
Algorithms)
Operations Research
• Quantitative methods for decision support
• Several disciplines
– Mathematical modeling
– Optimization
– Probability theory
– Game theory
– Queuing theory
– Simulation
• Discrete optimization problems (DOP) are central
3
Example: Choice of Projects
Example:Vehicle Routing
• You are running a transportation company with your own
car
• You have a set of pickup and delivery jobs around town to
do tomorrow
• What sequence of stops should you choose to finish the
jobs as early as possible?
• Operative decision
– Optimization problem
– The Travelling Salesman Problem (TSP)
4
Exampel Optimization Problem:
TSP – Travelling Salesman Problem
1 2 3 4 5 6 7
0 18 17 23 23 23 23
1
2 0 88 23 8 17 32
2 3 2
17 33 0 23 7 43 23
3
1 4 4 33 73 4 0 9 23 19
5 9 65 6 65 0 54 23
5
7 25 99 2 15 23 0 13
6
6 83 40 23 43 77 23 0
7
Feasible Solution: 1 2 7 3 4 5 6 1 with value: 184
Heuristic Algorithms
• Heuristic algorithms do not guarantee to
find the optimal solution, however:
• Heuristic algorithms do not even
necessarily have a bound on how bad they
can perform
– That is, they can return a solution that is
arbitrarily bad compared to the optimal
solution
• However, in practice, heuristic algorithms
(heuristics for short) have proven successful
• Most of this course will focus on this type
of heuristic solution method
Dr. Hafis SKEM4173 innovative • entrepreneurial • global 10
5
What is a heuristic?
6
Chapter Outline
8.1
Genetic Algorithm
7
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
8
Classes of Search Techniques
Search techniques
Direct methods Indirect methods Evolutionary algorithms Simulated annealing Dynamic programming
Parallel Sequential
Components of a GA
9
Simple Genetic Algorithm
{
initialize population;
evaluate population;
while TerminationCriteriaNotSatisfied
{
select parents for reproduction;
perform recombination and mutation;
evaluate population;
}
}
children
reproduction modification
modified
parents children
population evaluation
evaluated children
deleted
members
discard
10
Population
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 ...
Reproduction
children
reproduction
parents
population
11
Chromosome Modification
children
modification
modified children
12
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
Evaluation
modified
evaluated children
children
evaluation
13
Deletion
population
discarded members
discard
• Generational GA:
entire populations replaced with each iteration
• Steady-state GA:
a few members replaced each generation
An Abstract Example
14
A Simple Example
A Simple Example
15
Representation
CityList1 (3 5 7 2 1 6 4 8)
CityList2 (2 5 7 6 8 1 3 4)
Crossover
Child (5 8 7 2 1 6 3 4)
16
Mutation
* *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
17
Solution i (Distance = 941)
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
60
60 0
40 0 10 20 30 40 50 60 70 80 90 100
42 x
50
99
18
Solution k(Distance = 652)
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
19
Overview of Performance
T S P 3 0 - O ve r v i e w o f P e rfo rm a n c e
1800
1600
1400
1200
e
c 1000
n
ta
s
i 800
D
600
400
200
0 B es t
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
W o rs t
G e n e r a tio ns ( 10 0 0 )
A ve ra ge
20
Issues for GA Practitioners
21
Benefits of Genetic 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
When to Use a GA
• 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
22
Some GA Application Types
Domain Application Types
Control gas pipeline, pole balancing, missile evasion, pursuit
Conclusions
23
8.2
Particle Swarm
Optimization
Introduction
• Concept first introduced by Kennedy and Eberhart (1995)
• Original idea was to develop a realistic visual simulation of
bird flock behaviour
• Simulation was then modified to include a point in the
environment that attracted the virtual bird agents
• Potential for optimisation applications then became apparent
• Combines self-experiences with social experiences
24
The natural metaphor
• A flock of birds (or school of fish, etc.) searching for food
• Their objective is to efficiently find the best source of food
• Nature-based theory underlying PSO:
The advantage of sharing information within a
group outweighs the disadvantage of having
to share the reward
25
Introduction to the PSO: Origins
• In 1986, Craig Reynolds described this process in 3 simple
behaviors:
26
Introduction to the PSO: Concept
• Collection of flying particles (swarm) - Changing solutions
27
Terminology
Swarm intelligence
• Millonas’ five basic principles of swarm intelligence:
Proximity: agents can perform basic space and time calculations
Quality: agents can respond to environmental conditions
Diverse response: population can exhibit a wide range of behaviour
Stability: behaviour of population does not necessarily change every
time the environment does
Adaptability: behaviour of population must be able to change when
necessary to adapt to environment
28
Cooperation example
29
The basic idea II
Initialization. Positions
and velocities
30
What a particle does
Neighbourhoods
geographical
social
31
Neighbourhoods
Global
1
Particle 1’s 3-
2
neighbourhood 8
7 3
Virtual circle 4
6
5
32
Particles adjust their positions according to a
‘Psychosocial compromise’ between what an
individual is comfortable with, and what society
reckons
My best
perf.
pi
Here I The best
am! x pg perf. of my
neighbours
Pseudocode
http://www.swarmintelligence.org/tutorials.
php
Equation (a)
v[] = c0 *v[]
+ c1 * rand() * (pbest[] - present[])
+ c2 * rand() * (gbest[] - present[])
(in the original method, c0=1, but many
researchers now play with this parameter)
Equation (b)
present[] = present[] + v[]
33
Pseudocode
http://www.swarmintelligence.org/tutorials.
php
For each particle
Initialize particle
END
Do
For each particle
Calculate fitness value
If the fitness value is better than its peronal best
set current value as the new pBest
End
Choose the particle with the best fitness value of all as gBest
For each particle
Calculate particle velocity according equation (a)
Update particle position according equation (b)
End
While maximum iterations or minimum error criteria is not attained
Pseudocode
http://www.swarmintelligence.org/tutorials.
php
Particles' velocities on each dimension are
clamped to a maximum velocity Vmax. If
the sum of accelerations would cause the
velocity on that dimension to exceed
Vmax, which is a parameter specified by
the user. Then the velocity on that
dimension is limited to Vmax.
34
Parameters
35
Parameters
• Number of particles
(10—50) are reported as usually sufficient.
• C1 (importance of personal best)
• C2 (importance of neighbourhood best)
• Usually C1+C2 = 4. No good reason other than
empiricism
• Vmax – too low, too slow; too high, too unstable.
Rosenbrock
36
... and some typical results
Optimum=0, dimension=30
37
Adaptive swarm size
I try to generate a
I'm the best new particle
but there has been not enough
improvement
Adaptive coefficients
rand(0…b)(p-x)
av
The better I The better is my best
am, the more I neighbour, the more
follow my own I tend to go towards
way him
38
End of Syllabus
Good luck
39