ME F320
ENGINEERING OPTIMIZATION
BITS Pilani Genetic Algorithm
Hyderabad Campus
History
Genetic Algorithm is developed by John Holland, his colleagues, and
students at the Univ. of Michigan.
Variables xi’s are first coded in some string structures.
The operation of GAs begins with a population of random strings
representing design or decision variables.
Thereafter, each string is evaluated to find the fitness value.
The population is then operated by three main operators—
reproduction, crossover, and mutation—to create a new population of
points.
2 BITS Pilani, Hyderabad Campus
Working Principles
Accuracy
If four bits are used to code each variable in a two-variable function
optimization problem, the strings (0000 0000) and (1111 1111) would
represent the points
(x1(L), x2(L))T & (x1(U), x2(U))T respectively.
Any other eight-bit string can be found to represent a point in the
search space according to a linear mapping rule:
3 BITS Pilani, Hyderabad Campus
Working Principles
Fitness function
For maximization problems, the fitness function can be considered to
be the same as the objective function or F(x) = f(x).
For minimization problems, the fitness function is an equivalent
maximization problem chosen such that the optimum point remains
unchanged.
F(x) = 1/(1 + f(x))
Reproduction selects good strings in a population and forms a mating
pool.
4 BITS Pilani, Hyderabad Campus
Working Principles
Crossover
In most crossover operators, two strings are picked from the mating
pool at random and some portions of the strings are exchanged between
the strings.
Parent Children
Strings Strings
When a crossover probability of pc is used, only 100pc percent strings
in the population are used in the crossover operation and 100(1 − pc)
percent of the population remains as they are in the current population.
5 BITS Pilani, Hyderabad Campus
Working Principles
Mutation
The mutation operator changes 1 to 0 and vice versa with a small
mutation probability, pm.
The bit-wise mutation is performed bit by bit by flipping a coin with
a probability pm. If at any bit the outcome is true then the bit is altered;
otherwise the bit is kept unchanged.
6 BITS Pilani, Hyderabad Campus
Encoding
String
Substring 2 Substring 1 x2 x1 f(x) F(x)
1110010000 1100100000
0001001101 0011100111
Step 2: The first substring (1100100000) decodes to a value equal to
(29 + 28 + 25) = 800. The corresponding parameter value is equal to
0 + (6 − 0) × 800/1023 = 4.692
- The second substring (1110010000) decodes to a value equal to (29 +
28 + 27 + 24) or 912. The corresponding parameter value is equal to
0 + (6−0)×912/1023 = 5.349.
7 BITS Pilani, Hyderabad Campus
Fitness
String
Substring 2 Substring 1 x2 x1 f(x) F(x)
1110010000 1100100000 5.349 4.692 959.680
0001001101 0011100111
…
- It is found that the function value at this point is equal to
f(x(1)) = 959.680.
- Fitness function value at this point F(x) = 1/(1 + f(x))
= 1/(1 + 959.680) = 0.001
8 BITS Pilani, Hyderabad Campus
Expected Count
String
Substring 2 Substring 1 x2 x1 f(x) F(x) F(x)/ F
1110010000 1100100000 5.349 4.692 959.680 0.001 0.067
0001001101 0011100111 0.452 1.355 105.520 0.009 0.600
0011100101 0011111000 1.343 1.455 70.868 0.014 0.933
0010100100 1010101010 0.962 4.000 39.849 0.024 1.600
0000111101 0110011101 0.358 2.422 42.598 0.023 1.533
0011100010 1011000011 1.325 4.147 57.753 0.017 1.133
9 BITS Pilani, Hyderabad Campus
Selection Probability
Step 3: Since t = 0 < tmax = 30, we proceed to Step 4.
Step 4: we select good strings in the population to form the mating
pool.
Expected count = F(x)/ F ,
where the average fitness is
Probability of selecting the i-th string is
10 BITS Pilani, Hyderabad Campus
Random Selection
String Cumu Selected
lative
Substring 2 Substring 1 F(x)/ F pi Rand* String
1110010000 1100100000 0.067 0.011 0.011 0.087 2
0001001101 0011100111 0.600 0.102 0.113 0.673 5
0011100101 0011111000 0.933 0.159 0.272 0.416 4
0010100100 1010101010 1.600 0.273 0.545 0.108 2
0000111101 0110011101 1.533 0.262 0.807 0.356 4
0011100010 1011000011 1.133 0.193 1.000 0.886 6
*https://www.homestructions.com/random-number/
11 BITS Pilani, Hyderabad Campus
Crossover
Step 5: At this step, the strings in the mating pool are used in the
crossover operation.
No of strings will be involved in crossover = 0.8 × 6 = 4.8 ≈ 5.
12 BITS Pilani, Hyderabad Campus
Crossover
Parent Strings Children Strings
Substring 2 Substring 1 Select Locus Substring 2 Substring 1
0001001101 0011100111 1-5 7 0001001100 1010101010
0000111101 0110011101 1-3 6 0001000100 1010101010
0010100100 1010101010 3-4 13 0010100100 1011100111
0001001101 0011100111 5-1 9 0001001101 0011100111
0010100100 1010101010 3-5 11 0010100100 1010101010
0011100010 1011000011 6-2 6 0011100010 1011000011
*https://www.homestructions.com/random-number/
13 BITS Pilani, Hyderabad Campus
Mutation
Step 6: The next step is to perform mutation on strings in the
intermediate population.
Mutation probability is 0.05, so 0.05 × (6 ×20) = 6 bits will be
flipped.
14 BITS Pilani, Hyderabad Campus
Mutation
Children Strings Children Strings
Substring 2 Substring 1 Loci Substring 2 Substring 1
0001001100 1010101010 31 0001001100 1010101000
0001000100 1010101010 45 0001000100 0011101010
0010100100 1011100111 19 1010000100 1011100111
0001001101 0011100111 34 0001001101 0011100101
0010100100 1010101010 41 0010100100 1010101010
0011100010 1011000011 79 0011100010 1011000011
*https://www.homestructions.com/random-number/
15 BITS Pilani, Hyderabad Campus
Children Population
Step 7: The resulting population becomes the new population.
We now evaluate each string as before by first identifying the
substrings for each variable and mapping the decoded values of the
substrings in the chosen intervals.
This completes one iteration of genetic algorithms.
We increment the generation counter to t = 1 and proceed to Step 3 for
the next iteration.
16 BITS Pilani, Hyderabad Campus
Children Strings
Children Strings
Substring 2 Substring 1 x2 x1 f(x)
0001001100 1010101000
0001000100 0011101010
1010000100 1011100111
0001001101 0011100101
0010100100 1010101010
0011100010 1011000011
*https://www.homestructions.com/random-number/
17 BITS Pilani, Hyderabad Campus
Evaluation of Children Strings
To show the improvement in solution the average fitness of the new
population should be greater than the initial population (average fitness
in the initial population was 0.0147). [Minimization problem is
converted to maximization while calculating fitness F from the function
value f ]
Also, the best point in this population will have a fitness better than
that in the initial population (0.024).
This process continues until the maximum allowable generation is
reached or some other termination criterion is met.
18 BITS Pilani, Hyderabad Campus
Example
Using Genetic Algorithm maximize x2 over x = {0,1,..., 31} with initial x values
of 13, 24, 8, 16.
Calculate
i. The fitness of the initial population,
ii. Expected count,
iii. Probability of selection.
iv. Use fitness proportionate selection for generating mating pool.
v. Use crossover at locus 3 between highest and second highest fit strings. Use
crossover at locus 1 between the highest and third highest fit strings.
vi. Is the overall fitness improved?
BITS Pilani, Hyderabad Campus
Example
# Strings f(x) = x2 p = f/Σf f/f Actual count*
s1 01101 169 0.16 0.64 1
s2 11000 576 0.54 2.17 2
s3 01000 64 0.06 0.24 0 * Rounded
value of
s4 10000 256 0.24 0.96 1
expected count
iii. Probability of selection p = f/Σf
ii. Expected count = f/(Σf/n) = f / f where n = 4
v. Crossover between s2- s4, and s2-s1
vi. Compare average fitness between parents generation and children generation.
BITS Pilani, Hyderabad Campus
GAs for Constrained Optimization
Although different methods to handle constraints have been suggested,
penalty function methods have been mostly used (Deb, 1991; Goldberg,
1983).
In a constrained minimization problem, the objective function f(x) is
replaced by the penalized function:
where uj and vk are penalty coefficients, which are usually kept
constant throughout GA simulation.
Deb, K. (1991). Optimal design of a welded beam structure via genetic algorithms. AIAA Journal, 29(11), 2013–2015.
Goldberg, D. E. (1989). Genetic Algorithms in Search, Optimization, and Machine Learning. Reading, Mass.: Addison-
Wesley.
21 BITS Pilani, Hyderabad Campus
Other GA Operators
There exist a number of variations to GA operators. In most cases, the
variants are developed to suit particular applications.
It has been discussed earlier that the roulette-wheel selection operator
has inherent noise in selecting good individuals.
Although this noise can be somewhat reduced by using stochastic
remainder selection.
22 BITS Pilani, Hyderabad Campus
Other GA Operators
There are two other difficulties with these selection operators.
- If a population contains an exceptionally good individual early on in
the simulation, the expected number of copies in the mating pool (Fi/ F )
may be so large that the individual occupies most of the mating pool.
This reduces the diversity in the mating pool and causes GAs to
prematurely converge to a wrong solution.
- On the other hand, the whole population usually contains equally
good points later in the simulation. This may cause each individual to
have a copy in the mating pool, thereby making a direction-less search.
23 BITS Pilani, Hyderabad Campus
Contour Map
https://www.youtube.com/watch?v=CE1B7tdGCw0
24 BITS Pilani, Hyderabad Campus
Natural Selection
1. directional selection: a single extreme
phenotype favoured.
2. stabilizing selection: intermediate
favoured over extremes.
3. disruptive selection: extremes
favoured over intermediate.
[X-axis: phenotypic trait,
Y-axis: number of organisms,
Group A: original population,
Group B: after selection]
25 BITS Pilani, Hyderabad Campus
Search Algorithm
Traditional search algorithms randomly
sample (e.g., random walk is a random process
that describes a path that consists of a succession
of random steps on some mathematical space) or
heuristically sample (e.g., gradient descent) the
search space one solution at a time in the hopes
of finding the optimal solution.
Antony Gormley's Quantum Cloud sculpture in London was designed by a
computer using a random walk algorithm, Wikipedia
26 BITS Pilani, Hyderabad Campus
Encoding Individuals
An individual is a single solution.
The phenotype, which is the expressive of the chromosome in the
terms of the model.
The chromosome, which is the raw ‘genetic’ information (genotype)
that the GA deals.
A chromosome is
subdivided into genes.
27 BITS Pilani, Hyderabad Campus
Example
We can encode a rule as a binary string, where each bit represents
whether a value is accepted.
Make Tires Handlebars Water bottle
B C N G K T S C Y N
Make (Bridgestone, Cannondale, Nishiki, or Gary Fisher)
Tire type (Knobby, Treads)
Handlebar type (Straight, Curved)
Water bottle holder (Boolean Y/N)
28 BITS Pilani, Hyderabad Campus
Example
The candidate will be a bit string of length 10, because we have 10
possible attribute values.
Let’s say we want a rule that will match any bike that is made by
Bridgestone or Cannondale, has treaded tires, and has straight
handlebars.
This rule could be represented as 1100011011:
Make Tires Handlebars Water bottle
1 1 0 0 0 1 1 0 1 1
B C N G K T S C Y N
29 BITS Pilani, Hyderabad Campus
Encoding
30 BITS Pilani, Hyderabad Campus
KNAPSACK PROBLEM
Given a set of items,
each with a quantified
weight and value (₹), 10Kg | ₹11 4Kg | ₹8 5Kg | ₹6 2Kg | ₹12
what combination of
15 Kg
items will:
1. Fit inside a
knapsack capable of 8Kg | ₹5 2Kg | ₹8 6Kg | ₹4 7Kg | ₹13
carrying a fixed amount of
weight?
2. Maximize the value of the
knapsack’s payload? 10Kg 4Kg 5Kg 2Kg 8Kg 2Kg 6Kg 7Kg
₹11 ₹8 ₹6 ₹12 ₹5 ₹8 ₹4 ₹13
31 BITS Pilani, Hyderabad Campus
Fitness Function
Maximize value & Maximize weight to limit
Maximize value & Don’t exceed weight limit
32 BITS Pilani, Hyderabad Campus
Selection
https://medium.datadriveninvestor.com/genetic-algorithms-selection-5634cfc45d78
33 BITS Pilani, Hyderabad Campus
Stochastic Universal
Sampling
˚
Selection ˚
F(x) p Cumulative Rand* RW Selected Uniform Distance SUS Selected
Strings (Cumulative) Strings
String 1 8.2 0.58 0.58 0.76 String 2 0*360/5 = 0˚ (0.0) String 1
String 2 3.2 0.23 0.81 0.80 String 2 1*360/5 = 72˚ (0.2) String 1
String 3 1.4 0.10 0.91 0.05 String 1 2*360/5 = 144˚ (0.4) String 1
S1 S2 S3 S4 S5
String 4 1.2 0.09 0.99 0.25 String 1 3*360/5 = 216˚ (0.6) String 2
String 5 0.1 0.01 1.00 0.86 String 3 4*360/5 = 288˚ (0.8) String 2
Roulette Wheel
˚
˚
*https://www.homestructions.com/random-number/
S1 S2 S3 S4 S5
34 BITS Pilani, Hyderabad Campus
Selection
Rank Based
F(x) Rank Ranks based Cumulative Rand* Rank based Tourna Selected Selection˚
Probability Selected Strings ment† Strings ˚
String 1 8.2 1 0.30 0.30 0.05 String 1 2-4 2
String 2 3.2 2 0.25 0.55 0.69 String 3 1-5 1
String 3 1.4 3 0.20 0.75 0.01 String 1 1-4 1
String 4 1.2 4 0.15 0.90 0.45 String 2 3-2 2
String 5 0.1 5 0.10 1.00 0.85 String 4 5-4 4
S1 S2 S3 S4 S5
*https://www.homestructions.com/random-number/, † Two way tournament (random selection of two parents)
35 BITS Pilani, Hyderabad Campus
Crossover
Single point crossover
Two-point crossover
Uniform crossover
Arithmetic crossover
https://www.obitko.com/tutorials/genetic-algorithms/crossover-mutation.php
36 BITS Pilani, Hyderabad Campus
Mutation
Bit flip mutation
Swap mutation
Scramble mutation
Inversion mutation
https://www.tutorialspoint.com/genetic_algorithms/genetic_algorithms_mutation.htm
37 BITS Pilani, Hyderabad Campus
Survivor Selection
https://medium.datadriveninvestor.com/genetic-algorithms-selection-5634cfc45d78
38 BITS Pilani, Hyderabad Campus
Elitism
Elitism means that once a good result is found, it will always remain in
the population until a better result is found.
So elitism is basically saying copy the elite individuals in the new
generation without applying any kind of change (probability of selecting
the elite solutions for the crossover and mutation are zero p = 0).
39 BITS Pilani, Hyderabad Campus
Search Termination (Convergence)
❑ Maximum generations
❑ Elapsed time
❑ No change in fitness
- Stall generations
- Stall time limit
40 BITS Pilani, Hyderabad Campus
Traveling Salesman Problem
Encoding
Distance matrix
41 BITS Pilani, Hyderabad Campus
Crossover
s1: [1, 6, 2, 8, 9, 7, 4, 3, 5] 12031 Truncation selection
s2: [9, 2, 4, 5, 7, 3, 8, 1, 6] 13066 Threshold = 10000
s3: [3, 2, 1, 9, 5, 7, 8, 6, 4] 10522
s4: [4, 2, 9, 5, 3, 8, 1, 6, 7] 9612 Partially Matched crossover
s5: [3, 2, 4, 7, 1, 9, 8, 6, 5] 9891 parents
s6: [9, 2, 7, 6, 5, 3, 8, 4, 1] 9946 [4, 2, 9, 5, 3, 8, 1, 6, 7]
s7: [5, 4, 7, 1, 8, 3, 2, 6, 9] 10914 [9, 2, 7, 6, 5, 3, 8, 4, 1]
s8: [9, 2, 5, 8, 4, 6, 1, 3, 7] 10529
s9: [1, 7, 5, 8, 3, 6, 4, 9, 2] 11702 children
s10:[3, 8, 1, 5, 2, 9, 4, 6, 7] 9664 [4, 2, 9, 5, 3, 8, 7, 6, 1]
s11: ... [9, 2, 7, 6, 5, 3, 4, 8, 1]
42 BITS Pilani, Hyderabad Campus
Mutation
Any solution is randomly selected for swap mutation.
[5, 4, 7, 1, 8, 3, 2, 6, 9] [5, 4, 2, 1, 8, 3, 7, 6, 9]
1: [1, 6, 2, 8, 9, 7, 4, 3, 5]
2: [9, 2, 4, 5, 7, 3, 8, 1, 6]
3: [3, 2, 1, 9, 5, 7, 8, 6, 4]
4: [4, 2, 9, 5, 3, 8, 1, 6, 7]
5: [3, 2, 4, 7, 1, 9, 8, 6, 5]
6: [9, 2, 7, 6, 5, 3, 8, 4, 1]
7: [5, 4, 7, 1, 8, 3, 2, 6, 9]
8: [9, 2, 5, 8, 4, 6, 1, 3, 7]
9: [1, 7, 5, 8, 3, 6, 4, 9, 2]
10:[3, 8, 1, 5, 2, 9, 4, 6, 7]
11: ...
43 BITS Pilani, Hyderabad Campus
Termination
Sriram Kodey,
2018A4PS0671H
44 BITS Pilani, Hyderabad Campus
Example
Suppose a genetic algorithm uses chromosomes of the form x = abcdefgh
with a fixed length of eight genes. Each gene can be any digit between 0 and 9.
Let the fitness of individual x be calculated as:
f (x) = (a + b) − (c + d) + (e + f ) − (g + h)
and let the initial population consist of four individuals with the following
chromosomes
s1 = 6 5 4 1 3 5 3 2
s2 = 8 7 1 2 6 6 0 1
s3 = 2 3 9 2 1 2 8 5
s4 = 4 1 8 5 2 0 9 4
BITS Pilani, Hyderabad Campus
Example
i. Cross the fittest two individuals using one–point crossover at the middle point.
ii. Cross the first and third fittest individuals using a two–point
crossover (points b and f ).
iii. Cross the second and third fittest individuals (ranked 2nd and 3rd)
using a uniform crossover (10010100).
iv. Evaluate the fitness of the new population of 6 solutions.
v. Is the overall fitness improved?
vi. Is it possible to reach the optimal solution without mutation operation?
BITS Pilani, Hyderabad Campus
Example
# Strings F Average fitness
s1 65413532 (6+5) - (4+1) + (3+5) - (3+2) = 9 = -0.75
s2 87126601 (8+7) - (1+2) + (6+6) - (0+1) = 23
s3 23921285 (2+3) - (9+2) + (1+2) - (8+5) = - 16
s4 41852094 (4+1) - (8+5) + (2+0) - (9+4) = -19
i. s1-s2 65416601, 87123532
ii. s2-s3 87921201, 23126685
iii. s1-s3 25423232, 63911585 (10010100)
BITS Pilani, Hyderabad Campus
Example
# Strings F v. Average fitness = 5.33
c1 65416601 (6+5) - (4+1) + (6+6) - (0+1) = 17 (increased),
Best fitness decreased.
c2 87123532 (8+7) - (1+2) + (3+5) - (3+2) = 15
c3 87921201 (8+7) - (9+2) + (1+2) - (0+1) = 6
vi. xoptimal = 99009900,
c4 23126685 (2+3) - (1+2) + (6+6) - (8+5) = 1 f(xoptimal) = (9 + 9)
c5 25423232 (2+5) - (4+2) + (3+2) - (3+2) = 1 − (0 + 0)
c6 63911585 (6+3) - (9+1) + (1+5) - (8+5) = -8 + (9 + 9)
− (0 + 0) = 36
So, without mutation getting 9s is not possible.
BITS Pilani, Hyderabad Campus
Multi-objective Optimization
A MOO problem has a number of objective functions which are to be
minimized or maximized.
A solution x is a vector of n decision variables: x = (x1, x2,…, xn)T
49 BITS Pilani, Hyderabad Campus
Multi-dimensional Objective Space
In MOOP the objective
functions constitute a
multi-dimensional space, in
addition to the decision
variable space.
50 BITS Pilani, Hyderabad Campus
Convex and Non-convex MOOP
A function is a convex function if for
any two pair of solutions
a, b ∈ ℝn
the following condition is true
f(ka + (1 - k)b) ≤ k f(a) + (1 - k) f(b)
for all 0 ≤ k ≤ b.
51 BITS Pilani, Hyderabad Campus
Principles of MOOP
We are familiar with the stopovers that
most of the airlines force us to take.
Airlines try different strategies to
compromise the number of intermediate
stopovers and large business mileage by
introducing “direct flights”.
For e.g.
I have to travel from HYD to JAI
52 BITS Pilani, Hyderabad Campus
Principles of MOOP
Although the actual travel distance is
more than the actual geographical
distance, it helps the airline to reduce
the cost of its operation.
However if comfort & convenience
is only consideration to the passenger,
which route (s)he will take?
53 BITS Pilani, Hyderabad Campus
Dominance
In multi-objective optimization problem, the goodness of a solution is
determined by the dominance.
x1 dominates x2, if
- Solution x1 is not worse than x2
in all objectives
- Solution x1 is strictly better than
x2 in at least one objective
Similarly, x3 dominates x1, x2 & x4
x5 dominates x1, x2 & x4
But, x3 and x5 are not dominated by
each other.
54 BITS Pilani, Hyderabad Campus
Pareto Optimal Solution
Let us take a cantilever design
problem with two decision variables -
diameter (d) and length (l).
There are two conflicting objectives -
min. of weight (f1) and
min. of end deflection (f2)
Minimize f1(d, l) = ρ (πd2/4) l,
Minimize f2(d, l) = δ = 64Pl3 / 3E πd4,
subject to σmax ≤ Sy where σmax = 32 Pl / πd3
δ ≤ δmax
55 BITS Pilani, Hyderabad Campus
Pareto Optimal Solution
10 ≤ d ≤ 50 and
200 ≤ l ≤ 1000
56 BITS Pilani, Hyderabad Campus
Pareto Optimal Solution
The non-dominated solution f2
set is a set of all the solutions
that are not dominated by any
member of the solution set.
The non-dominated set of the
entire feasible decision space is
called the Pareto-optimal set.
The boundary defined by the
set of all point mapped from the
Pareto optimal set is called the
Pareto optimal front. f1
57 BITS Pilani, Hyderabad Campus
Pareto Optimality
Ideal Objective vector z*
Utopian Objective Vector z**
Nadir Objective vector znad
where (zjnad = zj(j)c)
Critical points z(1, 2)c
Domination
58 BITS Pilani, Hyderabad Campus
Pareto Optimality
59 BITS Pilani, Hyderabad Campus
Finding a Non-dominated Set
Step1 Set a counter to i = 1, create an empty non-dominated set P’.
Step2 For any solution j (≠ i), check if j dominates i, if yes go to Step4
Step3 increase j by one and go to
Step2
Step4 Increase i by one, if i ≤ N
go to Step2
where N = number of solutions = 5
60 BITS Pilani, Hyderabad Campus
Weighted Sum Method
Scalarize a set of objectives into a single objective by adding each
objective pre-multiplied by a user supplied weight.
Weight of an objective is chosen in
proportion to the relative importance of the
objective.
Maximize
subject to
61 BITS Pilani, Hyderabad Campus
ε-Constraint Method
One of the objective functions is selected to be optimized and all the
other objective functions are converted into constraints by setting an
upper bound to each of them.
The problem to be solved is now of the form:
62 BITS Pilani, Hyderabad Campus
Weighted Metric Method
as
63 BITS Pilani, Hyderabad Campus
Multi-objective EA
Depending on the usage of elitism, there are two types of multi-
objective EAs.
Non-Elitist MOEAs Elitist MOEAs
❑Vector evaluated GA ❑ Elitist Non-dominated
❑Vector optimized ES Sorting GA
❑Weight based GA ❑ Distance-based Pareto GA
❑Random weighted GA ❑ Strength Pareto GA
❑Multiple-objective GA ❑ Pareto-archived ES
❑Non-dominated Sorting GA
❑Niched Pareto GA
64 BITS Pilani, Hyderabad Campus
NSGA
The first step is to sort the population P according to non-domination.
The fitness assignment procedure begins from the first nondominated
set and successively proceeds to dominated sets.
Any solution i of the first nondominated set is assigned a fitness equal
to Fi = N (the population size).
In this way, assigning more fitness to solutions belonging to a better
nondominated set ensures a selection pressure towards the Pareto
optimal front.
In order to promote the diversity among solutions the sharing
function method is used which degrades the assigned fitness based on
the number of neighboring solutions.
65 BITS Pilani, Hyderabad Campus
Example
Min-Min Problem
66 BITS Pilani, Hyderabad Campus
Example
Subject to
i. identify the Pareto-optimal set when
(a) both f1 and f2 are minimized,
(b) f1 is minimized and f2 is maximized,
(c) f1 is maximized and f2 is minimized,
(d) both f1 and f2 are maximized.
BITS Pilani, Hyderabad Campus
Example
ii. Select binary genes for both x1 and x2 with min one decimal place
accuracy.
iii. Sort the population in increasing level of non-domination.
iv. Use two point crossover at the middle point of each gene (leaving
the last level of dominated set).
v. Use inversion mutation for the two bits at the middle of the string.
BITS Pilani, Hyderabad Campus
Example
f2 g2
Min-max
(point) Max-Max
(curve)
f1
Min-Min Max-Min
(curve) g1 (point)
BITS Pilani, Hyderabad Campus
Example
Accuracy for x1 and x2 is 0.1. So, minimum 9 divisions are necessary {0, 1}.
We need 4 bits gene (24 = 16) representation. String length = 2 x 4 = 8
Strings f1 = x1 f2 = x2 g1 g2
0101 0100 (1-0)x5/(16-1) = 0.33 (1-0)x4/(16-1) = 0.27 0.18 0.98
0110 0111 (1-0)x6/(16-1) = 0.40 (1-0)x7/(16-1) = 0.47 0.38 0.64
1001 1000 (1-0)x9/(16-1) = 0.60 (1-0)x8/(16-1) = 0.53 0.64 0.38
1101 0100 (1-0)x13/(16-1) = 0.87 (1-0)x4/(16-1)= 0.27 0.82 0.56
0100 1100 (1-0)x4/(16-1) = 0.27 (1-0)x12/(16-1) = 0.8 0.71 0.58
0011 0110 (1-0)x3/(16-1) = 0.20 (1-0)x6/(16-1) = 0.4 0.2 1.00
BITS Pilani, Hyderabad Campus
Example
First non-dominated set 1-6
5
Second non-dominated set 5-2-4
Third non-dominated set 3
3
2
6
1 4
BITS Pilani, Hyderabad Campus
Example
Strings Parents Crossover Mutation
01010100 1-6 01010110 01001110
01100111 1-6 00110100 00101100
10011000 2-5 01101100 01110100
11010100 2-5 01000111 01000111
01001100 2-4 01100100 01100100
00110110 2-4 11010111 11001111
BITS Pilani, Hyderabad Campus
Elitist NSGA (NSGA II)
In NSGA-II, each solution in the current population P is evaluated
using Pareto ranking and a crowding measure.
First the best rank is assigned to all the nondominated solutions in the
current population.
Solutions with the best rank are removed from the current population.
Next, the second best rank is assigned to all the nondominated
solutions in the remaining population.
In this manner, ranks are assigned to all solutions in the current
population.
73 BITS Pilani, Hyderabad Campus
Selection
Then, a binary tournament selection based on non-domination rank
and crowding distance is performed to select a set of parent solutions.
That is, when two solutions are selected, the one with the lower non-
domination rank is preferred.
Otherwise, if both solutions belong to the same rank, then the solution
with the higher crowding distance is selected.
74 BITS Pilani, Hyderabad Campus
Crossover Mutation
Next, genetic operators such as recombination and mutation are
applied to create an offspring population Q.
Then, the two populations are merged together to form a combined
population Rt = Pt ∪ Qt.
Next, the combined population is sorted according to different
nondominated front.
If the size of the first nondominated front F1 is smaller then N, all
members of the set F1 are chosen for the new population.
75 BITS Pilani, Hyderabad Campus
Example
Minimize f1 = x1
Minimize f2 = (1+x2)/x1
# x1 x2 f1 f2 # x1 x2 f1 f2
ps1 0.31 0.09 0.31 6.10 cs1 0.21 0.24 0.21 5.9
ps2 0.43 1.92 0.43 6.79 cs2 0.79 2.14 0.79 3.97
ps3 0.22 0.56 0.22 7.09 cs3 0.51 2.32 0.51 6.51
ps4 0.59 3.63 0.59 7.85 cs4 0.27 0.87 0.27 6.93
ps5 0.66 1.41 0.66 3.65 cs5 0.58 1.62 0.58 4.52
ps6 0.83 2.51 0.83 4.23 cs6 0.24 1.05 0.24 8.54
76 BITS Pilani, Hyderabad Campus
f1 f2
Non-dominated Sorting
0.31 6.10 F2
0.43 6.79 F3
0.22 7.09 F2
0.59 7.85 F4
0.66 3.65 F1
0.83 4.23 F3
0.21 5.9 F1
0.79 3.97 F2
0.51 6.51 F3
0.27 6.93 F2
0.58 4.52 F1
0.24 8.54 F3
77 BITS Pilani, Hyderabad Campus
Crowding Distance
Denotes half of the perimeter of the enclosing cuboid with the nearest
neighboring solutions in the same front.
Crowding distance,
1. Manhattan distance –
Δf1 + Δf2
2. Spread Indicator – standard
deviation of the closest distances
√ [ Σ(di – d)2/ |P’|]
where
|P’| represents the number of non-
dominated individual in the solution P.
78 BITS Pilani, Hyderabad Campus
Evolved Antenna (NASA)
ST5 spacecraft has an antenna that was
designed by a computer running a simulation
of Darwinian evolution.
Its shape is unusual because most human
antenna designers would never think of such
a design.
A major objective of ST5 was to reduce
mass, size, power, and costs of the missions
by providing acceptable functional
capabilities.
[https://www.jpl.nasa.gov/nmp/st5/TECHNOLOGY/antenna.html]
79 BITS Pilani, Hyderabad Campus
Genetic Programming
Mats Helander’s dog:
This is a classic example of a
highly asymmetric compression/
decompression scheme.
It takes an impossibly long time
to find a good “fit” candidate
model for compression, but once
you do, it takes bytes (and very
little time and complexity) to tell
a decoder how to reconstruct [https://rogerjohansson.blog/2008/12/07/genetic-
programming-evolution-of-mona-lisa/]
the image.
80 BITS Pilani, Hyderabad Campus
Super Mario
This is a
demonstration of
a neural network
learning to play
an NES game
using a genetic
algorithm to
adapt.
[https://www.youtube.com/watch?v=05rEefXlmhI]
81 BITS Pilani, Hyderabad Campus
Thank You !
BITS Pilani
Hyderabad Campus