0% found this document useful (0 votes)
15 views31 pages

Genetic Optimization

The document introduces genetic algorithms as an optimization technique that is probabilistic, loosely based on genetics, does not require gradients or initial guesses, and operates on a population to evolve solutions over generations. Examples of applying genetic algorithms to optimize Powell's function and fit IGBT conduction loss data to a model are presented to illustrate genetic algorithm concepts and usage. Genetic optimization toolbox GOSET is also introduced for implementing genetic algorithms in MATLAB.

Uploaded by

Jasson Molina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views31 pages

Genetic Optimization

The document introduces genetic algorithms as an optimization technique that is probabilistic, loosely based on genetics, does not require gradients or initial guesses, and operates on a population to evolve solutions over generations. Examples of applying genetic algorithms to optimize Powell's function and fit IGBT conduction loss data to a model are presented to illustrate genetic algorithm concepts and usage. Genetic optimization toolbox GOSET is also introduced for implementing genetic algorithms in MATLAB.

Uploaded by

Jasson Molina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

A Brief Introduction to Genetic

Optimization
S.D. Sudhoff

Fall 2005
Traditional Optimization Methods

• Newton’s Method

Fall 2005 EE595S 2


Traditional Optimization Methods

• 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

Fall 2005 EE595S 3


Traditional Optimization Methods

• Properties of all of these methods


¾Need an initial guess
¾Very susceptible to finding local minimum
• Properties of most of these methods (not
Nelder Meed Simplex)
¾Take derivatives

Fall 2005 EE595S 4


An Alternate Approach

Fall 2005 EE595S 5


Genetic Algorithms in a Nutshell

• Probabilistic Optimization Technique


• Loosely Based in Principals of Genetics
• First Developed By Holland, Late 60’s –
Early 70’s
• Does Not Require Gradients or Hessians
• Does Not Require Initial Guess
• Operates on a Population

Fall 2005 EE595S 6


A Gene As A Parameter:
Biological Systems

• Each Gene Has Value From Alphabet


{AT,GC,CG,AT} from Nitrogenous
Adenine, Guanine, Thymine, Cytosine
• Each Gene is Located on One of a Number
of Chromosomes
• Chromosomes May Be Haploid, Diploid,
Polyploid

Fall 2005 EE595S 7


A Gene As A Parameter:
Canonical Genetic Algorithm

• Each Gene Has a Value From Alphabet


(Normally Binary {0,1})
• Each Gene is Located on a Chromosome
(Normally 1)
• Chromosomes Generally Haploid

Fall 2005 EE595S 8


Evolution in a Canonical GA

START

Initialization

Fitness evaluation

Selection

Crossover

Mutation

STOP?

END

Fall 2005 EE595S 9


Example Operator:
Single Point Crossover

Gene 1 Gene 1 Gene 1 Gene 1

Gene 2 Gene 2 Gene 2 Gene 2

Gene 3 Gene 3 Gene 3 Gene 3

Gene 4 Gene 4 Gene 4 Gene 4

Gene 5 Gene 5 Gene 5 Gene 5

Parent 1 Parent 2 Child 1 Child 2


Fall 2005 EE595S 10
Example Operator:
Mutation

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

Fall 2005 EE595S 11


A Gene As A Parameter:
Non-Encoded Genetic Algorithms
• Each Gene Has A Range (Minimum Value,
Maximum Value)
• Each Gene Has A Type (Mapping)
¾Integer
¾Linearly Mapped Real Number
¾Logarithmically Mapped Real Number
• Each Gene is Located on One of a Number
of Chromosomes
• Chromosomes Are Haploid
Fall 2005 EE595S 12
Genetic Optimization System
Engineering Tool (GOSET)
• Matlab based toolbox
• Usable with minimum knowledge
• Allows, if desired, high degree of algorithm
control

Fall 2005 EE595S 13


An Individual in GOSET

• 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

Fall 2005 EE595S 14


A Population In GOSET

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

Fall 2005 EE595S 16


Example: Powell’s Problem

• 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 )

Fall 2005 EE595S 17


powell.m

% Optimization of Powell's Problem

% Initialize the parameters


GAP=gapdefault;

% 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);

Fall 2005 EE595S 18


powell_fit.m

function f = powell(x)

% Powell's function taken from Chong & Zak, p. 140.


% The global miniizer is powell(0,0,0,0) = 0

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);

Fall 2005 EE595S 19


Powell’s Problem: Conclusion

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

Fall 2005 EE595S 20


IGBT Conduction Loss

• Fit IGBT Conduction Loss Data To:

v = ai + (bi) c

Fall 2005 EE595S 21


igbt.m
% load experimental data
% voltage is first column
% current is second column
load igbt_data.mat
Data.v=v_data;
Data.i=i_data;

% 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.)

% declare the types of all the parameters


GAP.gd_min = [1e-8 1.0e-6 1.0e-3];
GAP.gd_max = [1e+2 1.0e+3 1.0e+0];
GAP.gd_type= [ 3 3 3 ];
GAP.gd_cid = [ 1 1 1 ];

% do the optimization
[fP,GAS]= gaoptimize(@igbt_fit,GAP,Data,[],[],[]);

% plot the best fit


bestparameters=GAS.bestgenes(:,GAS.cg,1)
igbt_fit(bestparameters,Data,3);
Fall 2005 EE595S 23
igbt_fit
% this rountine returns the fitness of the IGBT conduction
% loss parameters based on the mean percentage error
function fitness = IGBTfitness(parameters,data,fignum)

% assign genes to parameters


a=parameters(1);
b=parameters(2);
c=parameters(3);

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

Fall 2005 EE595S 25


IGBT Results

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

Fall 2005 EE595S 26


IGBT Results (Cont.)
Voltage Versus Currrent
4

3.5

3 Measured
Fit
2.5
Voltage, V

1.5

0.5

0
0 5 10 15 20 25 30
Current, A

Fall 2005 EE595S 27


IGBT Results (Cont.)
Power Versus Currrent
120
Measured
Fit
100

80
Power, V

60

40

20

0
0 5 10 15 20 25 30
Current, A

Fall 2005 EE595S 28


Your Problem

• Consider a machine for which


λ m = 0.3 VS

Lq = 15 mH

L d = 10 mH

P=4

Fall 2005 EE595S 29


Your Problem (Cont)

• Develop an approximate expression for the


optimal q-axis current command (in MTPA
sense) as a function of desired torque

• Deliverables: short write up with your


expression, all *.m files etc used.

• NOTE: GOSET2.2 is on the web. See


software distribution.
Fall 2005 EE595S 30
Comments on Approach

Fall 2005 EE595S 31

You might also like