You are on page 1of 35

Genetic Algorithms

27/01/15

Introduction to Genetic
Algorithms
A

class of probabilistic optimization


algorithms
Inspired by the biological evolution process
Uses concepts of Natural Selection and
Genetic Inheritance (Darwin 1859)
Originally developed by John Holland
(1975)
Particularly well suited for hard problems
where little is known about the underlying
search space
Widely-used in business, science and
2

Applications of GA
Parameter

and System
Identification
Control
Robotics
Pattern Recognition
Speech Recognition
Engineering Designs
Planning and Scheduling
Classifier System
3

Simple Genetic Algorithm


produce an initial population of individuals
evaluate the fitness of all individuals
while termination condition not met do
select fitter individuals for reproduction
recombine between individuals
mutate individuals
evaluate the fitness of the modified
individuals
generate a new population
End while

Algorithm continues..
It

is an iterative optimization
procedure.
GA works with no. of solutions in
each iteration, known as
population.
Let, f(x) is a function of
maximization type, where
x(i)min x(i) x(i)max
& i= 1,2,3,,N
Or i has various dimensions.
5

GA: Flowchart for working


principle

Representation
All

x(i)s are string structure


coded.
Strings could be real, binary,
alphabetical etc.

Representation
Here

the formula for accuracy is


given by:

Fitness

function
for max. prob. F(x) = f(x)
&
for min. prob. F(x) = {1/1+f(x)}

Reproduction
It

selects good set of strings and


found the mating pool.
Probability of selection of string
in mating pool is directly
proportional to fitness of string
where, N is the population size.

Crossover & Mutation


After

applying reproduction with


all included steps, crossover &
mutation are applied on the
string.
And then the average fitness of
finally mutated string is compared
with string in last iteration.
If F2 > F1, then the solution is
considered to improved.
Likewise problem is solved for
user defined no. of iterations.

10

Worked out example


Here

a virtual problem is
considered. The tables for cost,
flow and relationship are
developed.
Cost matrix I, indicates the cost
matrix in the time period I. Here
the dynamics of the problem is
considered for two periods only.
The shifting cost per department
is considered as Rs.
50/department. It is explained as

11

It

is observed that in the second


final layout C, G and J, H
departments are changed.
So the total department shifting
cost is Rs. 50 X 4 = Rs. 200.
So, the total cost = total layout
cost + total department shifting
cost.

12

13

14

15

Result
First

of all, the results are


obtained for only Cost I and Flow
I, and are displayed in table 7.
Then the same problem is
considered along with relationship
matrix I. Its results are displayed
in table 8.
Then the same problem is
considered in dynamic conditions
along with Cost II, Flow II, and
relationship II.

16

17

18

19

Conclusion to the problem


In

this paper a virtual problem is


solved in both static and dynamic
conditions.
The results are displayed & the
problem becomes multi objective,
the optimum layout changes.
Since
we are using Genetic
Algorithm, it is observed that the
results for above problem are
varying, as GA gives near to the
global optima answers but not the

20

Application of algorithm
on a research problem

Solving the Vehicle


Routing Problem with
Genetic Algorithms

21

The Problem
The

Vehicle Routing Problem was


first introduced by Dantzig and
Ramser in 1959.
Fisher describes the problem in a
word as to find the efficient use
of a fleet of vehicles that must
make a number of stops to pick up
and/or deliver passengers or
products.
The term customer will be used to
denote the stops to pick up and/or

22

The

problem can be considered as


a combination of the two wellknown optimisation problems; the
Bin Packing Problem (BPP) and the
Travelling Salesman Problem (TSP).
The BPP is described in the
following way: Given a finite set of
numbers (the item sizes) and a
constant K, specifying the capacity
of the bin, what is the minimum
number of bins Needed.
Naturally, all items have to be
23

Solution to VRP shown by


graph
(0 denotes to depot & 110 are customers)

24

The Model
The

most general version of VRP


is the capacitated Vehicle Routing
Problem, which will be referred to
as just VRP from now on.
The model for VRP has the
following parameters:
n is the number of customers,
K denotes the capacity of each
vehicle,
di
denotes the demand of
customer i (in same units as

25

Continue..
All

parameters are considered


non-negative integers.
Each customer must be assigned
to exactly one tour, because each
customer can only be served by
one vehicle.
The sum over the demands of the
customers in every tour has to be
within the limits of the vehicle
capacity.
The objective is to minimise the

26

connection between every two


nodes in the graph will be
included in A here.
Each arc (i; j) 2 A has a travel
cost cij associated to it.
It is assumed that the cost is
symmetric, i.e. cij = cji, and also
that cii = 0.
The set of uniform vehicles is V.
The vehicles have a capacity K
and all customers have a demand
di.
The only decision variable is Xvij.

27

The objective function of


the mathematical model
is:

28

Each

vehicle can only leave the


depot once.
Secondly, the number of vehicles
entering every customer k and the
depot must be equal to the number
of vehicles leaving.
An even simpler version could have
a constant number of vehicles but
here the number of vehicles can be
modified in order to obtain smallest
possible cost.
However, there is a lower bound on
the number of vehicles, which is the

29

Results & Discussion


For

different depot positions the


optimal solutions were drawn in
matlab.
All the solutions having no visible
difference as the shape of
solutions was quite similar as
shown below.

30

But

when the utilisation of the


capacity is observed the difference
becomes apparent.
In order to allow the algorithm to
obtain good solutions for problems
of similar type, different operators
could
be
used
for
different
populations.
Using Geographical Merge on the
one population and not on the other
will most likely help to obtain good
solutions, where one route only
uses a small part of the capacity.

31

Conclusion
A

sample program to dealing with


VRP with GA is made by Hildur
lafsdttir.
By this, analysis is done in matlab
with 12 small & 9 additional
problems.
The algorithm for small problems
is named SRC-GA & for others UCGA.
Along
with
simple
GA,
a
combination of Hybrid GA with
32

MATLAB code
(MATLAB DEMO)

33

References
Kalyanmoy

Deb,
Genetic
algorithms
in
search
and
optimization-the
technique
&
applications.
K.
V. Chandratre & K. N.
Nandurkar,
Applying
Genetic
Algorithm to Dynamic Layout
Problem, September 4, 2011.
slaug Sley Bjarnad, Solving the
Vehicle Routing Problem with
Genetic Algorithms, April 2004.

34

THANK
YOU

35

You might also like