Using ga, how to display the best x, fval it discovered so far in an individual?

2 次查看(过去 30 天)
Hello,
I have the problem that the ga algorithm shows not the best x, Fval as output it discovered so far when it stops (e.g. by time or generation max) but instead the value and chromosome of the current individual its evaluating.
Is there a way to store the best x, Fval it has discovered in one individual of the overall populations?
My function call looks like this.
LB = zeros(1,22); UB = ones(1,22); IntCon = 1:22; options = gaoptimset('Generations',4,'StallGenLimit', 4, 'PopulationSize', 30, 'TimeLimit',73800 );
[X,fval,exitflag,output,population,score]=ga(@myfunction,22,[],[],[],[],(LB),(UB),[],IntCon,options);
I have 22 binary variables, and like to see the best value / best variables the ga discovered so far when stopping.
Would be great if you could help me out.
Thank you and best regards William

回答(0 个)

类别

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