Genetic algorithm initial popuplation
1 view (last 30 days)
Show older comments
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)
0 Comments
Answers (2)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!