Lecture 7 Genetic Algorithms PDF
Lecture 7 Genetic Algorithms PDF
2 p
X u
XL
1, where Ac is precision
Ac
for discrete variable with k alternatives,
2p k
▪ Properties of coding
Equality - one to one correspondence between variables
and its representation in GA (desirable)
Inequality - non-unique representation of design variable
(not desirable)
Inequality handling
▪ Penalty approach
Compute smallest p that satisfies the inequality
2p
X
XL u
1
Ac
assign unique string to each m discrete variables
assign remaining strings to out-of-bound integers
▪ Excessive distribution approach
assign excessive bit-strings to already assigned variables
uneven expansion of design space could target a string
length that would give more even expansion of the
design space
Non-binary Represenations
▪ Binary coding is not essential for implementing GA
▪ For example, a composite laminate can be
represented purely based on its stacking sequence
of admissible angles (say 0, +45, -45, and 90
represented by 1,2,3 and 4 respectively)
Represent 16-ply laminate 0 deg 1
(+45/-45/04/902)s by 16 digit
code (2311114444111132) -45 deg 3
S
▪ Cumulative probability is obtained for each individual
by adding the fitnesses of the preceding population
members
Selection of members for
reproduction
i
ci pk , i 1,2,..., popsize
k 1
▪ A random number r uniformly distributed in [0,1]
is drawn from the popsize times and each time ith
string is selected such that ci-1 < r <ci. When r <
c1 , the first string is selected.
For example, for a population of four strings with p1= 0.30,
p2 = 0.20, p3 = 0.40 and p4 = 0.10, c1 = 0.30; c2 = 0.50;
c3 = 0.90; c4 = 1.0
If r = 0.25, then individual 1 will be selected as r < c1. If
r=0.96 then individual 4 will be eselected (c3 < 0:96 < c4 )
Selection of members for
reproduction
▪ It can be seen that the fittest members have
proportionatly more chances of being reproduced
and strings mapped to represent them can be
selected more than once.
▪ Note that the method works only if fitness is
positive
Mechanics of Genetic Serach
▪ Reproduction
Biases the evolutionary process towards more fit
members of the population. It is implemented by adding
extra copies of more fit members into the population pool
no new designs are created during this process
▪ Crossover
This mechanism brings in new information into the
population. This mechanism is akin to exchange of genes
between mating partners. In GA crossover mechanism is
dominant
▪ Mutation
This process toggles bits of string at very few random
sites to prevent premature loss of genetic information.
The process is necessary due to finite size populations
used in practical simulations
Basic operations
▪ Reproduction
Assign each design i a probability of selection pi given by
F
pi i
N
F i
At random select the N most fit designs for the cross over
and mutation operation
▪ Crossover
Of the N member population generated during
reproduction, select mating pairs, two at a time, to
conduct the cross over operation
Basic operations
▪ parent 1 1100010011
▪ parent 2 1011011011
▪ child 1 1100011011
▪ child 2 1011010011
▪ Repeat for all possible mating pairs
▪ Note that real variables can also be used to code
design variables into string like representations
Basic operations
▪ Consider the design of a rectangular laminated
plate, where plate dimensions are to be sized in
addition to determining number of 020, +/-450 and
9020 groups
parent 1: 10.17.3500 is a 10.1x7.3 plate of layup (0100)s
parent 2: 12.56.4212 is a 12.5x6.4 plate of layup (040,+/-
450,9040)s
▪ In such presentations, child design will only
contain numbers that were present in the original
population
▪ one of the solutions is an averaging cross over
Basic operations
▪ For a string length L, generate a real random
number w = rL between 0 and L- define [w] as
integer portion of w
▪ Take first [w] variables from one parent, last L-
[w]-1 from second part, and average the [w]+1
variable between two parents
▪ If x1 and x2 are the [w]+1 variables of parent 1
and 2, average these numbers to create xc child
as xc =(w-[w])x1 + (1-w+[w])x2
For w=1.6, [w]=1 and child is generated by using first
number from parent 1, last 3 from parent 2 and
averaging these numbers as
xc = (1.6-1)7.3+(1-1.6+1)6.4=6.9
child 1 = 10.1 6.9 2 1 2
Basic operations
▪ Mutation
▪ Select strings at random from the population
pool, and at randomly selected sites, switch zero
to one and vice versa
▪ The cross over and mutation operators are
assigned a finite probability
▪ pc ~ 0.7
▪ pm ~0.01
Basic operations
▪ Permutation
An operator referred to as permutation can be exploited
with some success
Permutation may be viewed as a mutation that is applied
over a segment of the string
Balance [45/-45/0/902/0/45/02/-45)s symmetric laminate
are
before permutation 2314412113
after permutation 2312144113
results in a (45/-45/0/45/0/902/02/-45)s laminate
Schema Theorem
▪ Schema theorem serves as the analysis tool for
the GA process
▪ It explains why GAs work by showing the
expectation of schema survival
▪ Schema theorem is applicable to
a canonical GA
with binary representation
fixed length individuals
fitness proportional selection
single point crossover
gene-wise mutation
Schema – definition, order and
length
▪ A schema is a template that defines a subset of
strings with similarities at certain string positions
▪ Schema 1##0#1 is the set of all words of length
6 with 1 at 1st and 6th positions and a 0 at 4th
position and 0 or 1 at 2nd,3rd and 4th position
▪ Order of a schema O(H) is the number of
explicitly stated 0's and 1’s
▪ Schema H=10#1# represents the set of binary
strings 10010, 10011, 10110, 10111
▪ Length of a schema ⸹(H) is the distance between
the first and last specific digits on a string
▪ String 10 of length 2 belongs to 22= 4 different
schemas ##, #0, 1#, 10
Schema – definition, order and
length
1001000010 0000001100 1000000000 O(H) = 30, (H) = 29
m (H ,k )
Effect of GA On a Schema
▪ Schema affects each step in GA.
Effect of Selection
Effect of Crossover
Effect of Mutation
▪ These effects collectively give “Schema Theorem”
Effect of Selection on Schema
▪ Assume that fitness is proportional selection, then
selection probability for the individual x
f (x)
ps(x) N
i1
f (xi)
f l 1
▪ The schema theorem states that the schema with
above average fitness, short defining length and
lower order is more likely to survive
Constraint handling - Penulty
Formulation
▪ Genetic transformation operations require that a
fitness measure is maximised during the search
process
▪ For unconstrained maximisation, the objective
function itself may be chosen as the fitness value
Z = F(X)
▪ For unconstrained minimisation, the fitness
measure can be defined as
Z = Fmax-F(X)
▪ For constrained minimisation, a composite measure
of objective function and constrained functions
must be used in defining the fitness function
Constraint handling using Penalty
Formulation
F F(x) P andZ Fmax F
Minimise
where
Pisthepenalty
term
▪ Penalty term must be chosen carefully so as to
prevent biasing the search in favour of objective
function or constraint functions
▪ For an average fitness of feasible designs as Fave,
define a limit value of the penalty
Limit valueof penalty L k Fave , where k 2
G if (G L )
P
L (G L ) if (G L )
m
G r g j , r is penalty paramter; g j is violated costraint
j 1
Constraint handling - Penulty
Formulation
▪ Scaling prevents constraint violations from
biasing the search process.
If =0, penalty of all violated constraints is limited to L
For =0.2 or similar such small value, constraint
violations are allowed to increase beyond L, with a
slope =.
Performance of the penalty function approach is clearly
dependent upon user specified constants:
penalty parameter r,
factor k used to establish L, and
slope parameter
Expression Based Strategies
▪ GA is essentially developed by borrowing ideas
from biological evolution
▪ In the biological analogue of genetic search, the
chromosome is a double-stranded (diploid)
structure and expressed gene at a particular
location is determined on the basis of a dominant
recessive gene theory
▪ Traditional GA implementation represents designs
by a single stranded (haploid) structure
▪ We combine features of feasible and infeasible
designs in a given population through the use of
an expression operator probabilistic in nature
Expression Based Strategies
▪ Consider a temporarily assembled diploid model
String A (feasible) 1110010110
String B (infeasible): 1000011011
▪ Expression operator can be applied on a bit-by-
bit basis to determine an expressed chromosome
that would replace string B in the population.
▪ Replace bit at a location in string B by
corresponding bit on string A with probability ρE.
Expression Based Strategies
Stepwise Implementation
1. Population is initialized - uniform normal distribution of
design variables between specified lower and upper bounds
2. Evaluate population of designs by evaluating objective and
constraint function values
3. Combine infeasible and feasible designs in the population
through use of an expression operator
4. Determine objective and constraint function values of
expressed designs
5. Selection operation of traditional GA applied to population
of feasible designs
6. Selected designs combined with all infeasible designs to
obtain predetermined population size
7. Perform crossover and mutation as in a traditional GA
implementation
8. repeat from step 2 till convergence
Expression Based Strategies –
Strategy I
▪ Identify best feasible design in population as Xbest
▪ Rank all j infeasible designs in population (j=1, N)
as Rj, with Rj=N assigned to design with most
constraint violation
▪ Combine each infeasible design with Xbest through
use of the expression operation on a bit-by-bit basis
i
g B
if ( ri N R i )
g iE v
g ij if ( ri N R i )
giE : ith bit on chromosome representing expressed design.
gijv : ith bit on chromosome representing jth violated design.
giB : ith bit on chromosome representing best design.
riN : randomly generated integer between 1 and M
(population size)
Expression Based Strategies –
Strategy I
▪ Designs with higher constraint violations become
similar to chromosome of best design.
Expression Based Strategies –
Strategy II
▪ Selection of feasible-infeasible pair determined by
closeness in terms of the objective function value
▪ If ij = obj(i) - obj(j), the difference in objective
function values between an infeasible design j
and a feasible design i
▪ The design i with smallest absolute ij is chosen for
expression.
Negative ij preferred over positive value for comparable
absolute value of ij
Expression Based Strategies –
Strategy II
giE : ith bit on chromosome representing expressed design.
giBF : ith bit on chromosome of feasible design selected for
expression.
gijv : ith bit on chromosome representing jth violated design.
ri : random number (uniform distribution) between 0 and 1
ρE : fixed probability of expression
g iBF if ( ri E )
g E
v
g ij if ( ri E )
i
Simultaneous Min/Max Identification
Sharing Functions in GA
▪ Based on a principle of sharing available resources
of an environment to maximize individual gains for
distinct species
▪ Sharing is implemented by degrading fitness of
each design in proportion to the number of designs
located in its neighbourhood
d
1 ij
ij , if d ij sharing
sharing
0
▪ dij is the metric distance between the ith and jth
design
▪ sharing is the radius of a defined neighbourhood
Sharing Functions in GA
▪ Fitness of each design is modified as follows
fi
f sharing _ i
M
ij