Clear Filters
Clear Filters

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

2 views (last 30 days)
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

Answers (0)

Community Treasure Hunt

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

Start Hunting!