Genetic Optimization
Genetic Optimization
Optimization
S.D. Sudhoff
Fall 2005
Traditional Optimization Methods
• Newton’s Method
• Steepest Decent
• Conjugate Direction Algorithm
• Conjugate Gradient Algorithm
• Davidon, Fletcher, Powell, Algorithm (DFP)
• Broyden, Fletcher, Goldfarb, and Shanno
Algorithm (BFGS)
• Nelder-Mead Simplex Method
• Take ECE580
START
Initialization
Fitness evaluation
Selection
Crossover
Mutation
STOP?
END
Mutation point
Original chromosome 0 1 0 0 0 1 1 0 1 1
Mutated chromosome 0 1 0 0 1 1 1 0 1 1
• A Collection of
Genes on Gene 1 Gene 6 Gene 9
Chromosomes Gene 2 Gene 7 Gene 10
• Fitness (Measures of Gene 3 Gene 8 Gene 11
Goodness)
Gene 4 Chromosome 2 Gene 12
f = [ f1 fN ]
T
f2 " Gene 5 Chromosome 3
Chromosome 1
• Region
Fi Fi
Region 1 Fi
Fi
Fi
Fi Fi
Fi
Fi
Fi Fi Fi
Fi
Region 2
Fi Fi
Fi Fi
Fi
Fi
Region 3
Fall 2005 EE595S 15
Evolution in GOSET
• Minimize
f ( x) = ( x1 + 10 x 2 ) 2 + 5( x3 − x 4 ) 2 + ( x 2 − 2 x 3 ) 4 + 10( x1 − x 4 ) 4
• Fitness
−5
fitness( x) = 5 − log 10( f ( x) + 10 )
% x1 x2 x3 x4
% gene 1 2 3 4
GAP.gd_min =[ -2.1 -2.1 -2.1 -2.1];
GAP.gd_max =[ 2.0 2.0 2.0 2.0];
GAP.gd_type=[ 2 2 2 2 ];
GAP.gd_cid =[ 1 1 1 1 ];
[P,GAS]= gaoptimize(@powell_fit,GAP,[],[],[],[]);
parameters=GAS.bestgenes(:,GAS.cg);
function f = powell(x)
x1=x(1);
x2=x(2);
x3=x(3);
x4=x(4);
f1 = (x1 + 10*x2)^2 + 5*(x3 - x4)^2 + (x2 - 2*x3)^4 + 10*(x1-x4)^4;
f=5-log10(f1+0.00001);
1
Normalized Value
0.5
parameters =
0
1 2 3 4
Parameter Number
10
-0.0098
0.0014
f:B(b) Md(g) Mn(r)
8
-0.0097
6
-0.0105
4
2
10 20 30 40 50 60 70 80 90 100
Generation
v = ai + (bi) c
% gafit
GAP=gapdefault;
GAP.rp_lvl=1;
GAP.mg_nreg=4;
GAP.mg_tmig=20;
GAP.mg_pmig=0.05;
GAP.dp_fp=0.5;
GAP.dth_alg=2;
Fall 2005 EE595S 22
igbt.m (cont.)
% do the optimization
[fP,GAS]= gaoptimize(@igbt_fit,GAP,Data,[],[],[]);
vpred=a*data.i+(b*data.i).^c;
error=abs(1-vpred./data.v);
fitness=1.0/(1.0e-6+mean(error));
Fall 2005 EE595S 24
igbt_fit (cont)
if nargin>2
fitness
figure(fignum);
Npoints=200;
ip=linspace(0,max(data.i),Npoints);
vp=a*ip+(b*ip).^c;
plot(data.i,data.v,'bx',ip,vp,'r')
title('Voltage Versus Currrent');
xlabel('Current, A');
ylabel('Voltage, V');
legend({'Measured','Fit'});
figure(fignum+1);
Npoints=200;
plot(data.i,data.v.*data.i,'bx',ip,vp.*ip,'r')
title('Power Versus Currrent');
xlabel('Current, A');
ylabel('Power, V');
legend({'Measured','Fit'});
end
1
Normalized Value
0.5
bestparameters =
0
1 2 3
Parameter Number 0.0000
10 4.5288
0.2588
f:B(b) Md(g) Mn(r)
0
10 20 30 40 50 60 70 80 90 100
Generation
3.5
3 Measured
Fit
2.5
Voltage, V
1.5
0.5
0
0 5 10 15 20 25 30
Current, A
80
Power, V
60
40
20
0
0 5 10 15 20 25 30
Current, A
Lq = 15 mH
L d = 10 mH
P=4