Genetic algorithm initial popuplation

2 次查看(过去 30 天)
I use GA to minimize an objective function with 20 variables. I noticed that ga always produces initial population with small distance between individuals, usually at [0,1] while lower bound is 0 and upper bound is 90. I would like ga to produce the initial population more uniformly. Is this possible? My code:
n=20;
A=zeros(n,n); %linear constraint x1<=x2<=x3<=x4<=...<=x20
b=zeros(n,1);
for i = 1:n
for j = 1:n
if(i+j==n+1)
A(i,j)=-1;
end
if(i+j==n)
A(i,j)=1;
end
end
end
b(n)=90;
LB=zeros(n,1);
UB=90*ones(n,1);
options=gaoptimset('creationfcn',@gacreationuniform,'PlotFcns',{@gaplotbestf,@gaplotscores,@gaplotbestindiv,@gaplotdistance},'Display','iter');
[x,fval,exitflag,output,final_pop]=ga(@(x) obj(x),n,A,b,[],[],LB,UB,[],options)

回答(2 个)

Matt J
Matt J 2013-3-3
use gaoptimset to control the Population options as you please

Alan Weiss
Alan Weiss 2013-3-4
I believe you need to set your PopInitRange option. See this example.
Alan Weiss
MATLAB mathematical toolbox documentation

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by