Genetic Algorithms. 2 Introduction To Genetic Algorithms (GAs)
Genetic Algorithms - UFL MAE Algorithms • Genetic algorithms imitate natural optimization...
Transcript of Genetic Algorithms - UFL MAE Algorithms • Genetic algorithms imitate natural optimization...
Genetic Algorithms• Genetic algorithms imitate natural optimization
process, natural selection in evolutionp ,• Algorithm developed by John Holland at the
University of Michigan for machine learning in 1975• Similar algorithms developed in Europe in the
1970s under the name evolutionary strategiesM i diff h b i th t f th• Main difference has been in the nature of the variables: Discrete vs. continuous
• Class is called evolutionary algorithms• Class is called evolutionary algorithms• Most of material from Chapter 5 of Design and
Optimization of Laminated Composite Material, p p ,Gurdal, Haftka and Hajela, Wiley, 1999.
Basic Scheme• Coding: replace design variables with a
continuous string of digits or “genes”g g g– Binary– Integer– Real
• Population: Create population of design p p p gpoints
• Selection: Select parents based on fitnessp• Crossover: Create child designs • Mutation: Mutate child designsMutation: Mutate child designs
Coding• Integer variables are easily coded as they
are or converted to binary digits• Real variables require more care
• Key question is resolution or interval• The number m of required digits found
from
Stacking sequence optimizationg q p
• For many practical problems anglesFor many practical problems angles limited to 0-deg, 45-deg, 90-deg.
• Ply thickness given by manufacturer• Ply thickness given by manufacturer• Stacking sequence optimization a
bi t i l blcombinatorial problem• Genetic algorithms effective and easy to
implement, but do not deal well with constraints
Coding - stacking sequenceg g q• Binary coding common. Natural coding
works better. (00=>1, 450=>2, - 450=>3,works better. (0 1, 45 2, 45 3, 900=>4) (45/-45/90/0)s => (2/3/4/1)
• To satisfy balance condition, convenient y ,to work with two-ply stacks (02=>1, 45=>2, 902=>3) or (45/-45/902/02)s => (2/3/1)
• To allow variable thickness add empty t k (2/3/1/E/E) (45/ 45/90 /0 )stacks (2/3/1/E/E)=> (45/-45/902/02)s
• Permutation coding may be used when number of plies is givennumber of plies is given
Coding - dimensions• Binary coding most common. Real
number coding possible but requiresnumber coding possible but requires special treatement. Trinary coding used in one examplein one example.
• Genetic algorithm not effective for getting high precision It is better to gogetting high precision. It is better to go for coarse grid of real values. With n binary digits get n valuesbinary digits get 2n values.
• Segregate stacking sequence and geometry chromosomes.
Initial populationInitial population• Random number generator usedg• Typical function call is rand(seed)• In Matlab rand(n) generates nxn matrix of ( ) g
uniformly distributed (0,1) random numbers• Seed updated after call to avoid repeating the
b S M tl b h l h tsame number. See Matlab help on how to change seed (state).
• Most routines supply a random number• Most routines supply a random number uniformly distributed in [0,1]. Need to transform to values of alleles.
FitnessFitness
• Augmented objectiveAugmented objective f*=f + pv-bm+sign(v) .
i l i – v = max violation
– m = min margin
• Repair may be more efficient than penalty
• Fitness is normalized objective or ns-1-rankj s
SelectionSelection
• Roulette wheel and tournament basedRoulette wheel and tournament based selection
• Elitist and superelitist strategies• Elitist and superelitist strategies• Selection pressures versus exploration• No twin rule
Roulette wheelRoulette wheel
• Example fitnessesExample fitnesses
Single Point CrossoverSingle Point Crossover
• Parent designs [04/±452/902] and [±454/02]• Parent designs [04/±452/902]s and [±454/02]s
P 1 [1/1/2/2/3]• Parent 1 [1/1/2/2/3]• Parent 2 [2/2/2/2/1]• One child [1/1/2/2/1]• That is: [04/±452/02]That is: [04/±452/02]s
Other kinds of crossoverOther kinds of crossover• Multiple point crossoverp p• Uniform crossover and hitchhiking
problemproblem• Bell-curve crossover for real numbers
M lti t• Multi-parent crossover• Complex crossovers for permutation
coding
Mutation and stack swapMutation and stack swap
• [1/1/2/2/3]=> [1/1/2/3/3]• [1/1/2/2/3]=> [1/1/2/3/3]• [04/±452/902]s => [04/±45/904]s
• [1/1/2/2/3]=> [1/2/1/2/3]• [04/±452/902]s => [(02/±45)2/902]s
Genetic operatorsp
• Crossover: portions of strings of the two parents are p g pexchanged
• Mutation: the value of one bit (gene) is changed at random
• Permutation: the order of a portion of the chromosome is reversed
• Addition/deletion: one gene is added to/removed from the chromosome
Algorithm of standard GAAlgorithm of standard GA
40
100100
30
Create initialCreate initial CalculateCalculate
70
Select parentsSelect parentsCreate initialpopulation
Create initialpopulation
Calculatefitness
Calculatefitness Create childrenCreate children
ReliabilityReliability
• Genetic algorithm is random search withGenetic algorithm is random search with random outcome.
• Reliability can be estimated from multiple• Reliability can be estimated from multiple runs for similar problems with known solutionsolution
• Variance of reliability, r, from n runs
r1r )(
nr
Reliability curvesReliability curvesall zero-basic algorithms
0 8
1
0.6
0.8
abili
ty GAhalfrank
0.2
0.4
relia rank
half
00 100 200 300 400 500
analyses
Multi-material laminate• “Materials”: one material = 1 lamina ( matrix or fiber (
materials)E.g.: glass-epoxy, graphite-epoxy, Kevlar-epoxy…U t t i l i d t bi hi h ffi i• Use two materials in order to combine high efficiency (stiffness) and low cost
• Graphite-epoxy: very stiff but expensive;Graphite epoxy: very stiff but expensive; glass-epoxy: less stiff, less expensive
• Objective: use graphite-epoxy only where most efficient, l f th i i liuse glass-epoxy for the remaining plies
Multi-criterion optimizationMulti criterion optimization• Two competing objective functions: WEIGHT and p g j
COST• Design variables:
– number of pliesnumber of plies– ply orientations– ply materials
• No single design minimizes weight and cost• No single design minimizes weight and cost simultaneously: A design is Pareto-optimal if there is no design for which both Weight and Cost are lowerwhich both Weight and Cost are lower
• Goal: construct the trade-off curve between weight and cost (set of Pareto-optimal designs)
Material propertiesMaterial properties
G hit GlGraphite-epoxy– Longitudinal modulus,
E1: 20.01 106 psiT d l
Glass-epoxy– Longitudinal modulus,
E1: 6.30 106 psiT d l– Transverse modulus,
E2: 1.30 106 psi– Shear modulus,
G12: 1 03 106 psi
– Transverse modulus, E2: 1.29 106 psi
– Shear modulus, G12: 6 60 105 psiG12: 1.03 10 psi
– Poisson’s ratio, 12: 0.3– Ply thickness, t: 0.005 in
Density : 5 8 10-2 lb/in3
G12: 6.60 10 psi– Poisson’s ratio, 12: 0.27– Ply thickness, t: 0.005 in
Density : 7 2 10-2 lb/in3– Density, : 5.8 10 2 lb/in3
– Ultimate shear strain, ult: 1.5 10-2
– Cost index: $8/lb
– Density, : 7.2 10 2 lb/in3
– Ultimate shear strain, ult: 2.5 10-2
– Cost index: $1/lbCost index: $8/lb Cost index: $1/lb
Material propertiesMaterial propertiesCarbon-epoxy Glass-epoxy
E1 (psi) 20.01 x 106 5.7 x 106
E2 (psi) 1.30 x 106 1.24 x 106
G (psi) 1 03 x 106 0 54 x 106G12 (psi) 1.03 x 106 0.54 x 106
12 0.3 0.28
(lb/in3) 0.058 0.076
Cost (lb-1) 8 1-2
Thickness (in) 0.005 0.005
lim 0 01 0 021lim 0.01 0.02
2lim 0.01 0.02
12lim 0.015 0.025
Source: http://composite.about.com for the stiffnesses, Poisson's ratios and densities
Method for constructing the Pareto trade-off curve
• Simple method: weighting method A composite function• Simple method: weighting method. A composite function is constructed by combining the 2 objectives:
W: weightC: cost
CWF )1(
: weighting parameter (01)
• A succession of optimizations with varying from 0 to 1 is solved. The set of optimum designs builds up theis solved. The set of optimum designs builds up the Pareto trade-off curve
Multi-material Genetic AlgorithmMulti material Genetic Algorithm
T i bl f h l• Two variables for each ply:– Fiber orientation– Material
• Each laminate is represented by 2 strings:– Orientation string– Material stringg
• Example:[45/0/30/0/90] is represented by:– Orientation: 45-0-30-0-90
1: graphite-epoxy– Orientation: 45-0-30-0-90
– Material: 2-2-1-2-1• GA maximizes fitness: Fitness = -F
epoxy2: glass-epoxy
Simple vibrating plate problemSimple vibrating plate problem• Minimize the weight (W) and cost (C) of
36” 30” t l l i t d l ta 36”x30” rectangular laminated plate• 19 possible ply angles from 0 to 90 in 5-
degree step• Constraints:
– Balanced laminate (for each + ply, there must be a - ply in the laminate)p y )
– first natural frequency > 25 Hz
Frequency calculated using Classical Lamination TheoryFrequency calculated using Classical Lamination Theory
How constraints are enforcedHow constraints are enforced
• GAs do not permit constrained optimizationGAs do not permit constrained optimization• Balance constraint hard coded in the strings: stacks
of ± are usedExample: (45-0-30-25-90) represents [±45/0/±30/±25/90]s
• Other constraints (frequency maximum strain ) are• Other constraints (frequency, maximum strain…) are incorporated into the objective function by a penalty, which is proportional to the constraint violation
>0: penalty parameter, g: constraint
)1( gFFconst
Pareto Trade-off curveA (16.3,16.3)
(lb)
Cpoint CB (5.9,55.1)
p– 64% lighter than
A; 17% more expensive
– 53% cheaper pthan B; 25% heavier
($)
Optimum laminatesIntermediate optimum laminates:
• Cost minimization: [±5010/0]s, cost = 16.33, weight = 16.33W i ht i i i ti [ 50 /0]
Graphite-epoxy as outer pliesfor a high frequency
sandwich-type laminates
• Weight minimization: [±505/0]s, cost = 55.12, weight = 6.89
• Intermediate design:
g q y
Intermediate design: [±502/±505]s, cost = 27.82, weight = 10.28
Glass-epoxy in the core layersto increase the thickness
Midplane
Pressure Vessel ExamplePressure Vessel Example• Closed-end pressure vessel• Length L=1000 in; radius r = 115 in• Internal pressure p; applied torque T• Critical quantities:Critical quantities:
internal loads:;; TNprNprN
critical torque (stability):
22;;
2 rNprNN xxx
4/32
222
2 ;925.0;2 ZKD
KrT tcrcrcr
2122211
2
2
12
;;
DAAAALZ
L
t
tcrcrcr
222212 DArt
Problem formulationProblem formulation
• Determine the optimal layup [1/2/ / N]Determine the optimal layup [1/2/…/ N]s• Allowable values of : 0 to 90 in 15-degree
stepssteps
Buckling load maximizationBuckling load maximization
• Fixed number of plies: N = 4 x 4 (balanceFixed number of plies: N = 4 x 4 (balance achieved by using stacks + symmetric)
• Material: carbon epoxy• Material: carbon-epoxy• Optimum laminate: [904/04]s• Maximal critical torque: Tcr = 2.847 x 106
lb-in
Strain minimizationStrain minimization
• Material: carbon-epoxy• Problem maximize the critical strain ratio s
cr:
1221i cr
lim
12
12lim2
2lim1
1 ,,min
cr
s
T p Optimum Critical strainp p108 lb-in 0 [454]s 1 = 1.45 x 10-3
0 50 psi [45/ 303]s 1 = 4.9 x 10-3
108 lb in 50 psi [45 /0 ] = 6 2 x 10-3108 lb-in 50 psi [453/02]s 2 = 6.2 x 10-3
Weight/cost mimimization subject to strain and bucklingsubject to strain and buckling
constraints• 2 materials• Goal: Pareto front• Coding:
– 0 and 90 degree genes are decoded as 1 ply0 and 90 degree genes are decoded as 1 ply– Other genes decoded as
• Formulation:– The 2 objectives are combined into a single function as:– The 2 objectives are combined into a single function as:
– The constraints are incorporated into the fitness function by usingpenalties: CWf )1(penalties: CWf )1(
otherwise(10
if(106
6
)1)(0)
pgfgf
fitness otherwise(10 )1)( pgf
Trade-off curveTrade off curve• T = 5 x 106 lb-in• p = 100 psi• Cost(carbon) = 8;
cost(glass) = 2
Data relative to Example 2:Weight Cost Laminate gstrain gbuckling
4609 36879 [75/90/0/90/0/15/03]s 0.226 0.58 x 10-1
4740 34646 [90 /15/0/15 ] 0 210 0 77 x 10-24740 34646 [903/15/0/152]s 0.210 0.77 x 10
4870 32370 [904/0/02/0/15]s 0.013 0.42 x 10-1
6358 27804 [75/75/02/02/0/15/15]s 0.024 0.35 x 10-3[ 2 2 ]s
7037 26648 [75/0/153/15/15/0]s 0.013 0.14 x 10-1
7717 25492 [90/90/15/60/15/02/15/0/ 0.002 0.81x 10-2
30]s9624 24278 [45/90/75/15/75/15/0/
153]s0.015 0.50 x 10-1
10433 20867 [75/90/152/30/153]s 0.233 0.77 x 10-1