How to Add Fitness Limit as Stopping Criterion in Genetic Algorithm?
14 views (last 30 days)
I added fitness limit into field 'options' in genetic algorithm code and defined its value to be 0.5.
global x1e x2e x3e x1r x2r x3r alfa12 alfa13 alfa23
%LLE podatci - ekstrakcija aromata smjesom TTEG i vode - 6 komponenata (heptan) na 60°C
%eksperimentalni podatci - ekstrakt
x1e = [0.0140 0.0175 0.0163 0.0188 0.0181 0.0227 0.0228 0.0214 0.0191 0.0208];
x2e = [0.0729 0.0696 0.106 0.1041 0.1107 0.0931 0.0732 0.0739 0.113 0.069];
x3e = 1 - x1e - x2e;
%eksperimentalni podatci - rafinat
x1r = [0.689 0.6289 0.485 0.4727 0.4332 0.6831 0.6967 0.6553 0.4507 0.6139];
x2r = [0.275 0.2855 0.4418 0.3501 0.4056 0.313 0.2716 0.271 0.4436 0.253];
x3r = 1 - x1r - x2r;
%Optimizacija NRTL parametara - Metoda Sorensena i Arlta
%1. stupanj optimizacije - opis fazne ravnoteze - geneticki algoritam
alfa12 = 0.3;
alfa13 = 0.3;
alfa23 = 0.2;
%definiranje strukture problema
OF_A = @OF_2_6H_60C;
problem.fitnessfcn = OF_A;
problem.nvars = 6;
problem.options = optimoptions('ga','FitnessLimit',0.5);
[x,fval] = ga(problem)
However, after running code I get following result:
Optimization terminated: average change in the fitness value less than options.FunctionTolerance.
6.1833 5.3657 2.3855 0.6108 2.6711 2.4970
Matlab used function tolerance (default setting) as stopping criterion and not fitness limit even though I added FitnessLimit in field options. Why is this?
Geoff Hayes on 26 Jan 2022
@Dario Miric - from Stopping Conditions for GA, it mentions that for all of the different stopping conditions, the algorithm stops as soon as any one of these conditions is met. In your case, it seems that the FunctionTolerance condition is being met before the FitnessLimit. For the function tolerance, it also mentions that the algorithm runs until the average relative change in the fitness function value over MaxStallGenerations is less than Function tolerance. You could try increasing the MaxStallGenerations but this won't gurantee that the FitnessLimit will be used to stop the algorithm.