0% found this document useful (0 votes)
4 views

Genetic Algorithms 2018

The document provides an overview of genetic algorithms (GAs), which are probabilistic search algorithms that utilize principles of natural selection to optimize solutions through operations like selection, crossover, and mutation. It explains the process of generating an initial population, evaluating fitness, and iteratively evolving solutions. Additionally, the document discusses the Traveling Salesman Problem (TSP) as an example of a complex optimization problem that GAs can address.

Uploaded by

parkashpaudel94
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Genetic Algorithms 2018

The document provides an overview of genetic algorithms (GAs), which are probabilistic search algorithms that utilize principles of natural selection to optimize solutions through operations like selection, crossover, and mutation. It explains the process of generating an initial population, evaluating fitness, and iteratively evolving solutions. Additionally, the document discusses the Traveling Salesman Problem (TSP) as an example of a complex optimization problem that GAs can address.

Uploaded by

parkashpaudel94
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Genetic algorithm (GA)

Dr. Bibhudatta Sahoo


Communication & Computing Group
D
Department off CSE,
CSE NIT Rourkela
R kl
Email: [email protected], 9937324437, 2462358
Books

2
Definition of the genetic algorithm (GA)
y The genetic algorithm is a probabalistic search
algorithm that iteratively transforms a set (called a
population) of mathematical objects (typically fixed-
length binary character strings),
strings) each with an
associated fitness value, into a new population of
offspring objects using the Darwinian principle of
natural selection and using operations that are
patterned after naturally occurring genetic
operations, such as crossover (sexual recombination)
and mutation.
mutation
3
A genetic algorithm search characteristic ay (Goldberg)

y Genetic algorithms manipulate bit strings or chromosomes


encoding useful information about the problem, but they
d nott manipulate
do i l t the
th information
i f ti as suchh (no
( decoding
d di or
interpretation).
y Genetic algorithms use the evaluation of a chromosome,
chromosome as
returned by the fitness function, to guide the search. They
do not use anyy other information about the fitness function
or the application domain.
y The search is run in p parallel from a ppopulation
p of
chromosomes.
y The transition from one chromosome to another in the
search space is done stochastically.
4
How does a Genetic Algorithm work?
• Genetic Algorithms Implement Optimization Strategies By
Simulatingg Evolution Of Species
p Through
g Natural Selection.
• A genetic algorithm is generally stated with a randomly
generated population of individual or chromosome or string.
• This randomly generated population known as initial
population and individuals are potential solution of the
problem under study.
study
• Three genetic operators namely selection, crossover, and
mutation applied
pp to these individuals.
• A selection method is used to select the individuals according to
their fitness values. [ mating pool]

5
Classes of Search Techniques
S
Search
hTTechniques
h i

Calculus Base Guided random search Enumerative


Techniques Techniques Techniques

Fibonacci Sort DFS Dynamic BFS


Programming

Tabu Search Hill Climbing Simulated Evolutionary


Annealing Algorithms

Genetic Genetic
og a
Programmingg Algorithms
go t s

6
Genetic algorithm
y A genetic algorithm maintains a population of candidate
solutions for the pproblem at hand,, and makes it evolve byy
iteratively applying a set of stochastic operators
p
Stochastic operators
y Selection replicates the most successful solutions found in a
population at a rate proportional to their relative quality
y Recombination decomposes two distinct solutions and
then randomly mixes their parts to form novel solutions
y Mutation randomly perturbs a candidate solution

7
The Metaphor
Genetic Algorithm Nature

Optimization problem Environment

Feasible solutions Individuals living in that


environment
Solutions quality (fitness Individual’s degree of
function)) p
adaptation to its
surrounding
environment

8
The Metaphor (cont)

Genetic Algorithm Nature

A set of feasible solutions A population of organisms


(species)
Stochastic operators Selection, recombination
and mutation in nature’s
nature s
evolutionary process
Iteratively applying a set Evolution of populations to
of stochastic operators on suit their environment
a set of feasible solutions

9
10
11
Flowchart of GA
• all individuals in
population evaluated by
fitness function
• individuals allowed to
reproduce (selection),
crossover, mutate

12
How does a Genetic Algorithm work?
• The selected individuals reproduce to create the next
generation.
• The crossover operator recombines the individuals
selected for reproduction with a pre-specified
probabilit of crossover.
probability crosso er
• The mutation operator induces changes in the
chromosomes (individuals) by complementing each bit of
an individual with a pre-specified probability of
mutation.
• Binary representation is common in genetic algorithm and
potential solutions are represented in the form of binary
string.
string
13
14
Generating Initial population
y Population
l size is chosen
h (1-10 individuals/parameter
d d l
optimized for most applications)
y Parameters to be optimized
p are encoded.
y After we choose a population size and encoding method, we
must choose a maximum range for each parameter.
y Ranges for parameters should be determined based on what
would be physically reasonable (if you’re interested in solving a
physical problem).
y Generate initial population of individuals (chromosomes)
y The initial population can be generated by randomizing the
genes for each chromosome of the initial population
y You can set the parameters for a few individuals if you want.
This might speed up the process.

15
Simple Genetic Algorithm
1. produce
d an initiall population
l off individuals
d d l
2. evaluate the fitness of all individuals
3. while termination condition not met do
4. select fitter individuals for reproduction
p
5. recombine between individuals
6
6. mutate
t t iindividuals
di id l
7. evaluate the fitness of the modified individuals
8. generate a new population
9. End while

16
Simple Genetic algorithm

17 Prof. B. D. Sahoo, Department of


CSE, NIT Rourkela, 2008
Simple Genetic algorithm

Prof. B. D. Sahoo, Department of CSE, NIT Rourkela,


18 2008
19
TSP: Statement of the problem

20
TSP: Statement of the problem
y The traveling salesman problem involves a salesman who must make a
tour of a number of cities using the shortest path available and visit
each cityy exactlyy once and onlyy once and return to the original
g startingg
point.
y For each number of cities n ,the number of paths which must be
explored
l d is n!, causing thish problem
bl to grow exponentially ll rather
h than
h
as a polynomial.
y This problem is known to be NP NP-hard,
hard, and cannot be solved exactly in
polynomial time.
y The exact algorithms are designed to find the optimal solution to the
TSP, that is, the tour of minimal length. They are computationally
expensive because they must (implicitly) consider all solutions in order
to identifyy the optimum.
p
21 Prof. B. D. Sahoo, Department of
CSE, NIT Rourkela, 2008
Example: TSP solutions

22 Prof. B. D. Sahoo, Department of


CSE, NIT Rourkela, 2008
Example: TSP solutions

23 Prof. B. D. Sahoo, Department of


CSE, NIT Rourkela, 2008
Integer linear programming ((ILP
ILP)) formulation of the TSP

24 Prof. B. D. Sahoo, Department of


CSE, NIT Rourkela, 2008
Thanks for Your Attention!

25
Exercises
27

You might also like