Borrar filtros
Borrar filtros

Genetic algorithm initial popuplation

2 visualizaciones (últimos 30 días)
dimitris
dimitris el 3 de Mzo. de 2013
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)

Respuestas (2)

Matt J
Matt J el 3 de Mzo. de 2013
use gaoptimset to control the Population options as you please

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

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by