resuming and starting from new line in genetic algorithm after specific generations

2 views (last 30 days)
Hi,
I want to resume and start from new line in genetic algorithm after specific generations.
Has anyone know How is impossible??
Any suggestion may help a lot.
Thank you guys.
  7 Comments
Hamid
Hamid on 9 Nov 2014
Edited: Hamid on 9 Nov 2014
I want to change f-matrix every 100 generations and I'm partly sure that a solution better happen at the end of generation 700, beside I don't have another choice and I have to inject all these 7 conditions.
for example : nn=20 nb=4 nl=6
case 1 (0-100 generations) : f(13)=800 f(14)=0 f(15)=-1000 and so on
case 2 (101-200 generations) : f(13)=0 f(14)=700 f(15)=-500 and so on
also I used 5 for an experiment and the right one is 700 generations.
Thank you very much Geoff for helping me.
Hamid
Hamid on 9 Nov 2014
Dear Geoff - my final goal is to reaching to best solution under all 7 conditions together, these conditions only difference in f-matrix.
What do you recommend?????
I'm so confused and I'm gonna be crazy.

Sign in to comment.

Answers (1)

Geoff Hayes
Geoff Hayes on 10 Nov 2014
Hamid - I don't think that I can give a valid recommendation because I don't know enough of what you are trying to do. f seems to be a matrix used in the fitness function, but I can't guess as to its impact or that of changing a handful of its values. But if you want to try and re-use the population after 100 iterations with a slight change to the f matrix, then you could change your return from the ga function of
[x,fval]=ga(@(x) penalty2(x,available,bc,Dof,E...),Nvars,options);
to
[x,fval,exitflag,output,population] = ga(@(x)penalty2(x,available,bc,Dof, E...),Nvars,options);
The population output parameter will be the final population for (say) 100 iterations of the algorithm. You then update the f matrix, and re-call
% re-use the population as the initial population for the next 100 generations
options = gaoptimset('InitialPopulation', population);
% run the algorithm
[x,fval,exitflag,output,population] = ga(@(x)penalty2(x,available,bc,Dof, E...),Nvars,options);
for 100 more generations. Then change f to whatever you want. You can put this in a loop that iterates from 1 through to 7, and you would change f on each iteration.
However, this method may not work as expected especially if the GA has converged to a premature solution before generation 100. If all members of the population are identical (or near-identical) then there will not be enough genetic diversity in the next round of 100 generations to produce any new members even though you have changed the f matrix.
  19 Comments
Geoff Hayes
Geoff Hayes on 14 Nov 2014
Hamid - you will have to work backwards from the above in order to determine what the problem is. Consider how nevt and neft are initialized and/or updated.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!