Optimization results when run GA with mixed integer
Afficher commentaires plus anciens
Dear all,
I have run ga in matlab with setting one of my four variables to be an integer then i found every time i run i will receive totally different value of an interger variable.
options = optimoptions('ga','FitnessScalingFcn',{@fitscalingrank }, ...
'PopInitRange',[LB ; UB],...
'StallGenL',10,...
'Generations',100, ...
'PopulationSize',25,...
'EliteCount',1, ...
'CrossoverFraction',0.6,...
'UseParallel','always',...
'MigrationInterval',10,...
'MigrationFraction',0.1,...
'MigrationDirection','both', ...
'plotFcn',@gaplotbestf);
%Setup for use of the function ga for continuous variables
%[X fval exitflag output population scores] = ga(FitnessFunction,nvars,[],[],[],[],LB,UB,[],options);
%Setup for use of function ga for integer variables
[X, fval, exitflag, output, population, scores] = ga(FitnessFunction,nvars,[],[],[],[],LB,UB,[],[1],options);
for example: first time
X =
10.0000 0.6548 0.0150 0.0200
fval =
5.3928
exitflag =
0
second time
X =
5.0000 0.6520 0.0150 0.0200
fval =
5.3929
exitflag =
0
As you can see the first value is quite different from 10 to 5 so i really have no idea which one i should choose even i run it many times or may be i have set something wrong please kindly help me
Thank you.
Réponses (0)
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!