Genetic Algorithm stops after few iterations when constraints are added
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sneha Thakur
le 29 Nov 2018
Commenté : Sneha Thakur
le 29 Nov 2018
HI
I have been working on a genetic algorithm for optimizing the calculation of power loss and volume of my converter. The algorithm works fine when no constraints are added. But once, I add the constraints the algorithm stops in a second after 3-4 iterations with the following error:
Infeasible individuals are present in the final population.
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
Constraints are not satisfied within constraint tolerance.
I am using GA multi-obj with mixed integers. I do understand the constraints with GA for using mixed-integers and equality constraints. But I am using inequality constraints.
dins_max = dins_min - dins_cal ;
Temp_rise_max = Temp_rise-150;
c = [dins_max,Temp_rise_max];
ceq = [];
Where I want my dins_cal >dins_min and Temp_rise<150. I have tried to workaround every method given in the GA matlab documentation. But nothing helps. and here is how i call:
fitnessFunction= @DAB_loss_volume_cal; % Function handle to the fitness function
numberOfVariables = 8; % Number of decision variables
populationSize = 100;
stallGenLimit = 100;
generations = 200;
ParetoFraction = 0.85;
lb = [10e-3, 1, 1,0.1,2e6,100e3,1,0.5e-6];
ub = [100e-3, 50, 30,0.42, 4e6,300e3,100, 5e-6];
Bound = [lb; ub]
options = gaoptimset('PopulationSize',populationSize,...
'CreationFcn', @int_pop,...
'MutationFcn', @int_mutation,...
'CrossoverFcn',@int_crossoverarithmetic,...
'StallGenLimit', stallGenLimit,...
'Generations', generations,...
'PopulationSize',populationSize,...
'ParetoFraction',ParetoFraction,...
'PopInitRange', Bound,...
'PlotFcns',@gaplotpareto);
[x, f, exitflag, output, population, score] = gamultiobj(fitnessFunction,...
numberOfVariables, [], [], [], [], lb, ub,@constraintfile, options);
variables [2,3,6,7] are integers
This is the output:
output =
struct with fields:
problemtype: 'nonlinearconstr'
rngstate: [1×1 struct]
generations: 102
funccount: 10302
message: 'Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.↵Constraints are not satisfied within constraint tolerance.'
maxconstraint: 568.3102
averagedistance: 0
spread: 0
exitflag = -2
Any help would be appreciated.
Thanks
Sneha
0 commentaires
Réponse acceptée
Alan Weiss
le 29 Nov 2018
You cannot run gamultiobj with integer constraints. Sorry.
Alan Weiss
MATLAB mathematical toolbox documentation
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!