117
BY VAMSIDHAR TANKALA & SHREY MODI DEPARTMENT OF CIVIL ENGINEERING Evolutionary Algorithms and Civil Engineering

Evolutionary Algorithms and their Applications in Civil Engineering - 1

Embed Size (px)

Citation preview

Page 1: Evolutionary Algorithms and their Applications in Civil Engineering - 1

B Y

V A M S I D H A R T A N K A L A

&

S H R E Y M O D I

D E P A R T M E N T O F C I V I L E N G I N E E R I N G

Evolutionary Algorithms and Civil Engineering

Page 2: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Consider the following problem

2 2 2 2

1 2 3 4 1 2 3 4( , , , )f x x x x x x x x

Minimize the function :

Page 3: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Various methods

Mathematical differentiation , and other plotting techniques.

A computer program based on these techniques can be easily formulated.

What are the issues to be considered ?

- Computational time

- Complexity of the problem – Increase the parameters and observe the computational time

- Smoothness of the function , if not rugged techniques work efficiently

Page 4: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Need for Evolutionary Techniques

Vagaries faced by the traditional techniques

Rugged landscape of the problem

Presence of many discontinuities

Simulation of the real world applications where mathematical formulations are not available :

“BLACK-BOX APPROACHES”

One example : Dynamic traffic simulation.

Page 5: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Need for evolutionary procedures

“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 6: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Brief introduction to GA’s

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

Provide efficient, effective techniques for optimization and machine learning applications

Widely-used today in business, scientific and engineering circles

Page 7: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Genetic Algorithm

Outline of the steps involved in GA Encoding

Initialization

Reproduction

Selection

Termination Criteria

Page 8: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Deb’s example

Consider a simple can design problem

A cylindrical can considered to have only twoparameters – the diameter d and height h.

Considering that the can needs to have a volume ofatleast 300 ml and the objective of the design is tominimize the cost of the can material

Page 9: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Objective function

2

2

1

min max

min max

( , ) ( )2

( , ) 300,4

df d h c dh

d hg d h

d d d

h h h

Minimize

Subject to

Variable bounds

Page 10: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Representing a solution

(d,h)=(8,10) cm

(chromosome) = 01000 01010h

d

Page 11: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Fitness Calculation

2( ) 0.065[ (8) (8)(10)]

23.

F s

Fitness – assigning a “goodness” measure

Page 12: Evolutionary Algorithms and their Applications in Civil Engineering - 1

A Sample random generation

23 30 11

2437

9

Cost -30

Cost-40

Page 13: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Selection Operator

Identify good(usually above-average) solutions in apopulation.

Make multiple copies of good solutions.

Eliminate bad solutions from the population so thatmultiple copies of good solutions can be placed inthe population.

Page 14: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Common Selection methods

Tournament Selection

Proportionate selection

Ranking selection

Page 15: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Tournament selection

Mating Pool23

30

11+30

24

37

9+40

24

37

11+30

23

9+40

30

23

24

37

24

23

30

Page 16: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Other Selection Operators

Ranking Selection

Stochastic Remainder roulette wheel selection

Proportionate selection

Page 17: Evolutionary Algorithms and their Applications in Civil Engineering - 1

What happens in mating pool??

Crossover Operation

Mutation Operation

Page 18: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Crossover operator

(8,10) 01000 01010 01010 00110 (10,6)

(14,6) 01110 00110 01100 01010 (12,10)

23

37

22

39

Page 19: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Mutation Operator

(10,6) 01010 00110 01000 00110 (8,6)22 16

Page 20: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Overall understanding of GA‟s

Page 21: Evolutionary Algorithms and their Applications in Civil Engineering - 1

21

How to encode a solution of the problem into chromosome ?

Types of Encoding Binary coding

Difficult to apply directly

Not a natural coding

Real number coding

Mainly for constrained optimization problems

Integer coding

For combinatorial optimization problems

Ex. Quadratic Assignment Problems

Step 1: Encoding Problem

1 0 0 1 1 1 0 1

2.3352 5.3252 6.2895 4.1525

3 5 1 2 4 8 7 6

Page 22: Evolutionary Algorithms and their Applications in Civil Engineering - 1

22

Step 1: Encoding Problem (Cont.)

Coding Space and Solution Space

Coding SpaceGenetic Operations Solution Space

Evaluation and Selection

Encoding

Decoding

Page 23: Evolutionary Algorithms and their Applications in Civil Engineering - 1

23

Step 1: Encoding Problem (Cont.)

• Critical issues with encoding

Feasibility of a chromosome

solution decoded from a chromosome lies in a feasible region of the

problem

Legality of a chromosome

chromosomes represents a solution to a problem

Uniqueness of mapping (Between Chromosomes and solution to the problem)

1 - n mapping (Undesired mapping)

n – 1 mapping (Undesired mapping)

1 – 1 mapping (Desired mapping)

One chromosome represents only one

solution to the problem

Page 24: Evolutionary Algorithms and their Applications in Civil Engineering - 1

24

Step 1: Encoding Problem (Cont.)

Coding SpaceSolution Space

infeasible one

Coding Space

Solution Space

Feasible space

Page 25: Evolutionary Algorithms and their Applications in Civil Engineering - 1

25

Step 2: Initialization

Create initial population of solutions

Randomly

Local search

Feasible Solutions

For optimization problem

Minimize: F (x1, x2, x3)

Binary encoding

1 0 1 1 0 0 1 1 1 0 0 1

x1 x2 x3

Page 26: Evolutionary Algorithms and their Applications in Civil Engineering - 1

26

Step 2: Initialization (Cont.)

Population of solutions

Fitness of solutions are evaluated (= objective function)

1 0 1 0 0 1 0 1 1 0 1 0

0 1 1 0 1 0 1 0 0 1 0 1

0 0 1 0 1 0 1 1 1 1 0 0

0 1 0 1 0 0 1 0 0 0 1 1

1 0 0 0 1 0 1 0 1 0 0 1

1 0 1 1 1 1 0 0 0 0 1 1

0 0 1 0 1 0 1 1 0 1 1 0

0 1 1 1 1 0 0 1 1 1 0 1

0 1 0 1 0 1 0 1 1 0 0 1

1 0 0 0 1 1 1 1 1 1 0 0

Solution No.1

2

3

4

5

6

7

8

9

10

13.2783

20.3749

19.8302

52.9405

25.8202

36.0282

70.9202

38.9022

29.0292

21.9292

Fitness values

Ch

rom

oso

mes

Page 27: Evolutionary Algorithms and their Applications in Civil Engineering - 1

27

Step 3: Reproduction

Crossover operation (Based on crossover probability)

Select parents from population based on crossover probability

Randomly select two points between strings to perform crossover operation

Perform crossover operations on selected strings

Known for Local search operation

Crossover Points

Parent 1

Parent 2

Offspring 1

Offspring 2

Page 28: Evolutionary Algorithms and their Applications in Civil Engineering - 1

28

Step 3: Reproduction (Cont.)

For the example of optimization problem

Let the crossover probability be 0.8

1 0 1 0 0 1 0 1 1 0 1 0

0 1 1 0 1 0 1 0 0 1 0 1

0 0 1 0 1 0 1 1 1 1 0 0

0 1 0 1 0 0 1 0 0 0 1 1

1 0 0 0 1 0 1 0 1 0 0 1

1 0 1 1 1 1 0 0 0 0 1 1

0 0 1 0 1 0 1 1 0 1 1 0

0 1 1 1 1 0 0 1 1 1 0 1

0 1 0 1 0 1 0 1 1 0 0 1

1 0 0 0 1 1 1 1 1 1 0 0

0.9502

0.2191

0.4607

0.6081

0.8128

0.9256

0.7779

0.4596

0.9817

0.7784

Random values [0,1]Chromosomes

SolutionNo.

1

2

3

4

5

6

7

8

9

10

Solution Selected

For crossover

operationNO

YES

YES

YES

NO

NO

YES

YES

NO

YES

> 0.8

< 0.8

< 0.8

< 0.8

> 0.8

> 0.8

< 0.8

< 0.8

> 0.8

< 0.8

Page 29: Evolutionary Algorithms and their Applications in Civil Engineering - 1

29

Step 3: Reproduction (Cont.)

0 1 1 0 1 0 1 0 0 1 0 1

0 0 1 0 1 0 1 1 1 1 0 0

0 1 0 1 0 0 1 0 0 0 1 1

0 0 1 0 1 0 1 1 0 1 1 0

0 1 1 1 1 0 0 1 1 1 0 1

1 0 0 0 1 1 1 1 1 1 0 0

SolutionSelected

2

3

4

7

8

10

0 1 1 0 1 0 1 1 0 1 0 1

0 0 1 0 1 0 1 0 1 1 0 0

0 1 0 1 0 0 1 1 0 1 1 1

0 0 1 0 1 0 1 0 0 0 1 0

0 1 0 0 1 0 0 1 1 1 0 1

1 0 1 1 1 1 1 1 1 1 0 0

Parents Selected Offspring

Crossover Points

Page 30: Evolutionary Algorithms and their Applications in Civil Engineering - 1

30

Step 3: Reproduction (Cont.)

Mutation operation (based on mutation probability pm)

each bit of every individual is modified with probability pm

main operator for global search (looking at new areas of the search space)

pm usually small {0.001,…,0.01} rule of thumb pm = 1/no. of bits in chromosome

Page 31: Evolutionary Algorithms and their Applications in Civil Engineering - 1

31

Step 3: Reproduction (Cont.)

For optimization problemMinimize: F (x1, x2, x3)

Let pm = 1/12 = 0.083

Generate Random number [0,1] for each bit

Select bits having probability less than pm

Interchange the bits with each other

0 0 1 0 1 0 1 1 0 1 0 0

0.12 0.57 0.62 0.31 0. 01 0.73 0.83 0.63 0.02 0.26 0.94 0.63

ith solution string from the population

0 0 1 0 1 0 1 1 0 1 0 0

Mutation

1 0

Page 32: Evolutionary Algorithms and their Applications in Civil Engineering - 1

32

Step 4: Selection (“Survival of the fittest”)

Directs the search towards promising regions in the search space

Basic issues involved in selection phase: Sampling space:

Parents and Offspring Regular sampling space:

all offspring + few parent = pop_size

Crossover operation

Mutation operation

Population(pop_size)

Offspring produced

Page 33: Evolutionary Algorithms and their Applications in Civil Engineering - 1

33

Step 4: Selection (“Survival of the fittest”) (Cont.)

Basic issues involved in selection phase:

Sampling space: Enlarged sampling space: All offspring + All parent

Crossover operation

Mutation operation

Population(pop_size)

Offspring produced

Page 34: Evolutionary Algorithms and their Applications in Civil Engineering - 1

34

Step 4: Selection (“Survival of the fittest”) (Cont.)

Sampling Mechanism: How to select chromosomes from sampling space

Basic approaches Stochastic Samplings

Roulette Wheel selection:

To determine survival probability proportional to the fitness value

randomly generate a number between [0,1] and select the individual

Selection probability for kth individual

1

_k

pop sizek

jj

fp

f

Based on pk, cumulative probability is calculated, and roulette wheel is

constructed

Zone of kth

individual

fk is the fitness value of kth individual

Page 35: Evolutionary Algorithms and their Applications in Civil Engineering - 1

35

Step 4: Selection (“Survival of the fittest”) (Cont.)

Deterministic Samplings:

select best pop_size individuals from the parents and offspring

No duplication of the individuals

Mixed Samplings:both random and deterministic samplings are done

Step 5: Termination Criteria

Repeating the above steps until the termination criteria is not satisfied

Termination criteria maximum number of generations

no improvement in fitness values for fixed generation

Page 36: Evolutionary Algorithms and their Applications in Civil Engineering - 1

36

Summary of Genetic Algorithms

Begin

{initialize population;

evaluate population;

while (TerminationCriteriaNotSatisfied)

{

select parents for reproduction;

perform Crossover and mutation;

evaluate population;

}

}

Page 37: Evolutionary Algorithms and their Applications in Civil Engineering - 1

37

Issues for GA Practitioners

Choosing basic implementation issues:

Encoding

Population size, Mutation rate, Crossover rate …..

Selection, Deletion policies

Types of Crossover, Mutation operators

Termination Criteria

Performance, scalability

Solution is only as good as the evaluation function (often hardest part)

Page 38: Evolutionary Algorithms and their Applications in Civil Engineering - 1

38

Benefits of Genetic 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 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 39: Evolutionary Algorithms and their Applications in Civil Engineering - 1

39

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

Page 40: Evolutionary Algorithms and their Applications in Civil Engineering - 1

40

Some GA Application Types

Domain Application Types

Control gas pipeline, pole balancing, missile evasion, pursuit

Design semiconductor layout, aircraft design, keyboard configuration,

communication networks

Scheduling manufacturing, facility scheduling, resource allocation

Robotics trajectory planning

Machine Learning designing neural networks, improving classification algorithms, 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 41: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Sample Applications in Civil Engineering

Transportation Engineering

Brief discussion of following areas:

- Dynamic traffic simulation.

- Aggregate blending .

- Back calculation of Pavement Layer Modulii.

Numerous applications in Structural engineering ,environmental, geotechnical and water resourcesengineering.

Research articles are available in superfluityconcerning applications of GA in civil engineering

Page 42: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Colony Optimization

Page 43: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Inspiration

Ants are practically blind but they still manage to find their way to the food. How do they do it?

These observations inspired a new type of algorithm called ant algorithms (or ant systems).

Result of research on computational intelligence approaches to combinatorial optimization.

The algorithm is modeled after the natural behavior of ants.

Page 44: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural behavior of ant

Ant search for their food

Nest Food

Page 45: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural behavior of ant

An obstacle has blocked the path of ants

Nest Food

Obstacle

Page 46: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural behavior of ant

What to do? Every ant flips a coin and choose a path

Nest Food

Obstacle

Page 47: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural behavior of ant

Finally, after some time shorter path reinforced

Nest Food

Obstacle

Page 48: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural Ants

Almost Blind.

Incapable of achieving complex task alone.

Rely on the phenomena of swarm intelligence for survival.

Capable of establishing shortest-route paths from their colony to feeding

sources and back.

Use stigmergic communication via pheromone trails.

Page 49: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Natural Ants

Follow existing pheromone trails with high probability.

What emerges is a form of autocatalytic behavior: the more ants follow a

trail, the more attractive that trail becomes for being followed.

The probability of a path choice increases with the number of times the

same path was chosen before.

Page 50: Evolutionary Algorithms and their Applications in Civil Engineering - 1

What isStigmergy?

Page 51: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Stigmergic

A term coined by French biologist Pierre-Paul Grasse, is interaction

through the environment.

Two individuals interact indirectly when one of them modifies the

environment and the other responds to the new environment at a later

time. This is stigmergy.

Page 52: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Stigmergy

Ants uses stigmergy. But how?

PHEROMONES

Page 53: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Pheromones

Whatis

Pheromone?

These are chemical substances dropped by

us in our path.

Page 54: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Colony Optimization

Page 55: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Basic Requirements

Since the ant algorithms are based on shortest path finding methodology utilized by the ants in search for their food, thus their implementation requires:

The problem to be solved must either be in graphical format or could be expressed in graphical form.

Must be finite (i.e. must have a start and end).

Page 56: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Algorithms

Ant systems are a population based approach. In this respect it is similar to genetic algorithms.

Each ant is a simple agent with the following characteristics:

It probabilistically chooses the node to visit with certain probability.

Uses a tabu list to avoid revisit to the node.

After the completion of tour it lays pheromone trail on each visited edge.

Page 57: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Is Termination Criteria met?

Flowchart of Ant algorithms

Find SolutionsUpdate

Pheromone

Probabilistically find New solutions based On pheromone values

Evaluate Solutions

Evaluate Solutions

STOP

Update Pheromone

Yes No

Initialize Ants

Page 58: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Is Termination Criteria met?

Initialization

Find SolutionsUpdate

Pheromone

Probabilistically find New solutions based On pheromone values

Evaluate Solutions

Evaluate Solutions

STOP

Update Pheromone

Yes No

Initialize Ants

Page 59: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Initialization

Initially ants are randomly placed on the nodes.

Each edge is initialized with small amount of

pheromones.

Each edge‟s Visibility, a heuristic value equal to

the inverse of distance between the edge, is

initialized.

Initialize Ants

Page 60: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Is Termination Criteria met?

Find Solutions

Initialize Ants Find Solutions

Update Pheromone

Probabilistically find New solutions based On pheromone values

Evaluate Solutions

Evaluate Solutions

STOP

Update Pheromone

Yes No

Page 61: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Find Solutions

Each ant probabilistically select the next node to visit with certain probability given by:

Find Solutions

nodes allowed

1)(

1)(

)(

j ij

ij

ij

ij

i

dt

dt

tP j

Quantity of pheromoneon edge i-j.

Distance between edge i-j

α,β constants

Identified Using Tabu List

Probability of transition from node i to j

Cycle Number

Page 62: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Tabu List

It is used by the ant to avoid revisit to any node.

It stores the node to be visited by the ant.

Page 63: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Pheromone Update

After each ant complete their tour, pheromone count

on each edge is updated using:

Update Pheromone

),(

)()1()1(

jiedgeusedthatColonyk k

ijijL

Qtt

Evaporation rate

Pheromone laid by each ant that uses

edge (i,j)

Quantity of pheromoneon edge i-j during cycle t+1.

Total distance traveledby ant k during its tour

Page 64: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Termination

The termination criteria commonly used are:

Designated Maximum number of cycles.

Specified CPU time limit.

Maximum number of cycles between two improvements of the global best solution.

Page 65: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Control Parameters

Number of ants

Pheromone Weight ()

Visibility Weight (β)

Pheromone persistence ( )

Number of cycles

Page 66: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Algorithms - Applications

Travelling Salesman Problem (TSP)

Facility Layout Problem - which can be shown to be a Quadratic Assignment Problem (QAP)

Vehicle Routing

Stock Cutting (at Nottingham)

Page 67: Evolutionary Algorithms and their Applications in Civil Engineering - 1

ANT COLONY APPLICATION TO

TRAVELING SALESMAN PROBLEM – AN EXAMPLE

ILLUSTRATION

Page 68: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Colony Algorithms and TSP

Ant Colony Optimization was initially designed for Traveling Salesman Problem.

At the start of the algorithm one ant is placed in each city.

Assuming that the TSP is being represented as a fully connected graph, each edge has an intensity of trail on it. This represents the pheromone trail laid by the ants.

Page 69: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Colony Algorithms and TSP

The distance to the next town, is known as the

visibility, nij, and is defined as 1/dij, where, dij, is

the distance between cities i and j.

When an ant decides which town to move to

next, it does so with a probability that is based

on the visibility for that city and the amount of

trail intensity on the connecting edge.

Page 70: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Ant Colony Algorithms and TSP

At each cycle pheromone evaporation takes

place.

The evaporation rate,1- p, is a value between 0

and 1.

In order to stop ants visiting the same city in the

same tour a data structure, Tabu, is maintained.

Page 71: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results on TSP with 10 cities

Page 72: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results on TSP with 10 cities

Page 73: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results on TSP with 10 cities

Page 74: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results on TSP with 10 cities

Optimal Solution

Page 75: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Variants

Best and Worst Ant System

The best ant receives reward while the worst ant is punished. If the search stucks at a local optimum, restart is employed.

Maximum and Minimum Ant System

An upper and lower bound are exposed on the pheromone levels.

Search starts using the max.

Rank Based Ant System

The ants are sorted wrt. the fitnesses of each tour they find. Their pheromone levels are adjusted accordingly

Elitist Ant System

The best tour found at each step receives an extra pheromone.

Page 76: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Concluding remarks on Ant algorithms

Ant algorithms are inspired by real ant colony.

Probability of ant following certain route is a function Pheromone intensity

Visibility

Evaporation

Ant algorithms are very suitable for problems having graphical structures.

Page 77: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Particle Swarm Optimization

Page 78: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Inspiration

It was inspired from the swarms in nature such as birds, fish, etc.

PSO algorithm has been originally developed toimitate the motion of flock of birds.

Particle Swarm Optimization (PSO) applies conceptof social interaction for problem solving

Page 79: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Particle Swarm Algorithms

It was developed in 1995 by James Kennedy and Russ Eberhart.

PSO is a robust stochastic optimization technique based on the movement and intelligence of swarms.

In PSO, a swarm of n individuals communicate either directly or indirectly with one another search directions (gradients).

It has been applied successfully to a wide variety of search and optimizationproblems

Page 80: Evolutionary Algorithms and their Applications in Civil Engineering - 1

PSO Formulation

The algorithm uses a set of particles flying over a search space to locate a global optimum.

A particle encodes a candidate solution to a problem at hand.

During an iteration of PSO, each particle updates its position according to its previous experience and the experience of its neighbors.

Page 81: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Fundamentals of PSO

A particle (individual) is composed of:

Three vectors: The x-vector records the current position (location) of the particle in the

search space,

The p-vector (pbest) records the location of the best solution found so far

by the particle, and

The v-vector contains a gradient (direction) for which particle will travel in

if undisturbed

Page 82: Evolutionary Algorithms and their Applications in Civil Engineering - 1

PSO: Generic Algorithm Schema

Initialize swarm with random position (x0)

and velocity vectors (v0)

Evaluate Fitness

For Each Particle

If

fitness(xt)> fitness (gbest)

gbest=xt

If

fitness(xt)> fitness (pbest)

pbest=xt

Update velocity

Update Position

xt+1= xt+1 + vt+1

1 2

3

0 1

0 1

t t t

t

v W v c rand( , ) ( pbest x )

c rand( , ) ( gbest x )]

Next Particle

gbest = output

End

If

Terminate

true

Start

gbest= Global Best Position

pbest= Self Best Positionfalse

c1 and c2= Acceleration Coefficients

W = Inertial Weight

Page 83: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Algorithm Implementation

The basic concept of PSO lies in accelerating each particle toward the best position found by it so far (pbest) and the global best position (gbest) obtained so far by any particle, with a random weighted acceleration at each time step.

This is done by simply adding the v-vector to the x-vector to get another x-vector (Xi = Xi + Vi).

Once the particle computes the new Xi it then evaluates its new location. If x-fitness is better than p-fitness, then pbest = Xi and p-fitness = x-fitness.

Page 84: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Psychosocial compromise

xgbest

pbest

v

t 1 t 1 t 2 tv W v c rand(0, 1) (pbest x ) c rand(0, 1) (gbest x )]

Particle’s

Current position

Particle’s best position so

far

Global best

position attained

gbest = Global Best Position

pbest= Self Best Position

c1 and c2 = Acceleration Coefficients

W = Inertial Weight

Page 85: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Initial parameters

Swarm size

Position of particles.

Velocity of particles.

Maximum number of iterations.

Page 86: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Control Parameters

Swarm size

Inertial Weight W

Acceleration Coefficients c1 and c2

Number of iterations

Page 87: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Inertia Weight W

A large inertia weight (w) facilitates a global search while a small inertia weight facilitates a local search.

Larger W Greater Global Search Ability

Smaller W Greater Local Search Ability

Page 88: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Acceleration Coefficients

Determines the inclination of search.

C1 larger

than C2

Greater Local Search Ability

C2 larger

than C1

Greater Global Search Ability

Page 89: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Comparison with Evolutionary Algorithms (EAs)

Unlike EAs, in PSO there is no selection operator.

PSO does not implement survival of the fittest strategy and all individuals are kept as members of the population throughout the course.

Page 90: Evolutionary Algorithms and their Applications in Civil Engineering - 1

PSO implementation on TSP

Page 91: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Encoding Schema

Generally PSO is applied over problems involving real variables.

However, through the use of proper encoding schema it can be applied to solve hard combinatorial optimization problems like Traveling Salesman Problem, Knapsack Problem, Node Coloring, Sequencing and Scheduling.

Page 92: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Encoding Schema

For TSP, each particle’s position is coded in the form of a one dimensional string whose dimensions equals the number of cities that are to be visited.

The particles are randomly initialized with rank vectors or priority numbers.

5 9 2 4 6 3

String representation for TSP with 6

cities

Priority Numbers

Page 93: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Decoding

5 9 2 4 6 3Encoded

String

Smallest Priority Number

1

Least priority is assigned the first

city

DecodedString

Page 94: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Decoding

5 9 N 4 6 3Encoded

String

1 2Decoded

String

Representing that it has been decoded

Smallest Priority Number

Least priority is assigned the next

city

Repeated till all cities are assigned

Page 95: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Decoding

5 9 2 4 6 3Encoded

String

4 6 1 3 5 2Finally

DecodedString

After Decoding

Page 96: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Solution Strategy by Particle Swarm Algorithm

Randomly initialize the particle‟s position (ranks) and velocity. Decode the particles and evaluate objective. Store the initial position in particle‟s memory. Modify velocity using cognitive and social components and update

position. Decode the particles „position and evaluate objective. If the position of particle is better than the position stored in

memory, update memory. Update the global best if a better particle is obtained. Repeat the process till required no. of iterations are complete. The particle with best position is the output.

Page 97: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results of PSO on TSP with 10 Nodes

Page 98: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results of PSO on TSP with 10 Nodes

Page 99: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results of PSO on TSP with 10 Nodes

Page 100: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Results of PSO on TSP with 10 Nodes

PSO took relatively large time to evolve

the optimal solution

Page 101: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Concluding remarks on “Particle Swarm”

Fast convergence thus time requirement is less.

Global as well as Local search component.

Dependence on parameter tuning is less.

More effective on problems involving real values.

Chances of early convergence due to high convergence speed.

Page 102: Evolutionary Algorithms and their Applications in Civil Engineering - 1

ARTIFICIAL IMMUNE SYSTEM

Page 103: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune Systems

A way to study the response of immune system,

when a non-self Antigen pattern is recognized

by Antibody

AIS are adaptive systems inspired by theoretical immunology and observed immune functions, principles and models, which are applied to complex problem domains (de Castro and Timmis)

A recently developed evolutionary technique inspired by theory of Immunology

Page 104: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Biological Immune SystemEfficiency of the acquired response depends upon the ability

of antibodies to recognize the antigens, depends upon

1016 Antigens for less than 100

antibody genes

Self/Non-self Discriminatio

n

Ability to remember previous

infections

o Generalization

o Screening

o Memory

Page 105: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System

History of Artificial Immune System

Initially developed from the theory of “immunology”

in mid 1980’s

In 1990, first use of immune algorithm to solve

optimization problem

In mid 1990: Application to Computer Security

In mid 1990: Machine Learning

Page 106: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System Artificial Immune System: An Optimization View

Objective FunctionsConstraints

Feasible Solutions

Entire SolutionBuilding Blocks

Page 107: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune Systems

Basic Elements

Immune Systems: To protect the body from the foreign matters

Antigen: Any foreign disease causing elements

Antibody: Utilized to identify, bind and eliminate antigens

Page 108: Evolutionary Algorithms and their Applications in Civil Engineering - 1

General Framework for AIS- The AIS Cycle

Selection

Evaluation

Population

Initialization

Cloning &

Hypermutation

Page 109: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System AIS: A Generic Framework

Application Domain

Representation

Affinity Measures

Immune Algorithm

Page 110: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Flow of the Algorithm

Population P

of individuals

Clone Pool of

the population

Hypermutation

of each clone

Probabilistically select P

best individual

Repository of

good solution

When search gets stagnated good solutions are sent to

the current population

Page 111: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System Artificial Immune System: An Assessment

AdvantagesGeneral Purpose AIS tools

Easily Extensible

Potential for distribution

DisadvantagesParameter Sensitive

Computationally Expensive

Page 112: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System Distinctive Features & Their Applications:

Features Applications

Learning & Adaptation Security

Immunological Memory Pattern Recognition

Self/Non-self Classification Heuristic Optimization

Self Organizing Modeling & Agents Application

Localization & Circulation Clustering

Autonomous/Decentralized Concept Learning & Recommender System

Page 113: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Artificial Immune System

AIS: Potential Area of optimization Fault & Anomaly Detection

Data Mining (Machine Learning, patter recognition)

Agent Based systems

Autonomous Control

Information Security System

Scheduling

Page 114: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Dynamic traffic simulation

CALIBARTION OF MESOSCOPIC TRAFFIC SIMULATION USING POPULATION BASED EVOLUTIONARY ALGORITHMS

- methodology to calibrate dynamic trafficsimulation models with real data acquired fromtraffic counts and travel time measurementsacquired from GPS devices

Page 115: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Brief outlook

To use a tool called METROPOLIS

No Mathematical function involved, hence a need forsimulation arises – simulation of the real worldconditions.

A simulation of real time traffic will be processed inthe model and it gives different indicators as output.One of the indicator is the travel time along thedefined paths in a network

Initially ,tested on toy networks (network containingsmall networks)

Page 116: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Computational Details

Programmed in the following way :

- A GUI platform developed in java which works like a compiler for optimization

- The main features of the compiler are :

* Any EA can be embedded

* Any problem can be optimized

ALGORITHM PROBLEMOPTIMISATION

PLATFORM

Page 117: Evolutionary Algorithms and their Applications in Civil Engineering - 1

Overall framework

RANDOMLY GENERATE

TRAFFIC VARIABLES

PLATFORM

NODE-1

NODE-2

NODE-3

NODE-4

FITNESS

CALCULATEFITNESS

RESULTS