The genetic algorithm isn't constraint!!!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Everyone,
My main research is to optimize the reinforced concrete frame using genetic algorithms and external penalty function.
I created 3 subroutine for this problem: Optimizedesign.m; framecost.m; frameanalysis.m
I have been doing it in long time (Running - checking - fixing and repeat...).
But I have a bit problem with it!
I show the structure of Optimizedesign.m:
opts = gaoptimset('PopulationType', 'doubleVector', ...
'PopInitRange', [0.3 0.9 0.3 0.9 0.3 0.9 0.3 0.6 0.4 0.9 0.7 1.2 0.4 0.6 0.6 0.7 0.3 0.4 0.4 0.5 9.82*10^-4 9.82*10^-4 9.82*10^-4 9.82*10^-4 9.82*10^-4 9.82*10^-4 9.82*10^-4 9.82*10^-4 78.54*10^-4 147.26*10^-4 19.74*10^-4 98.18*10^-4 19.64*10^-4 98.18*10^-4;
0.5 1.3 0.5 1.3 0.5 1.3 0.5 1.0 0.6 1.2 0.9 1.6 0.6 0.8 0.9 0.9 0.5 0.6 0.6 0.7 108.02*10^-4 49.09*10^-4 108.02*10^-4 49.09*10^-4 108.02*10^-4 49.09*10^-4 73.65*10^-4 49.09*10^-4 117.8*10^-4 196.34*10^-4 58.9*10^-4 196.34*10^-4 58.9*10^-4 196.34*10^-4], ...
'PopulationSize', 300, ...
'EliteCount', [], ...
'CrossoverFraction', [], ...
'ParetoFraction', [], ...
'MigrationDirection',[], ...
'MigrationInterval',[], ...
'MigrationFraction',[], ...
'Generations', 300, ...
'TimeLimit', [], ...
'FitnessLimit', [], ...
'StallGenLimit', [], ...
'StallTest',[], ...
'StallTimeLimit', [], ...
'TolFun', [], ...
'TolCon', [], ...
'InitialPopulation',[0.4 1.2 0.4 1.2 0.4 1.2 0.4 1.0 0.5 1.1 0.9 1.5 0.5 0.8 0.7 0.9 0.4 0.5 0.5 0.6 98.17*10^-4 49.09*10^-4 98.17*10^-4 49.09*10^-4 98.17*10^-4 49.09*10^-4 63.81*10^-4 34.36*10^-4 98.18*10^-4 176.72*10^-4 39.26*10^-4 147.26*10^-4 39.26*10^-4 147.26*10^-4], ...
'InitialScores', [], ...
'PlotInterval',[], ...
'CreationFcn', @gacreationuniform, ...
'FitnessScalingFcn', @fitscalingrank, ...
'SelectionFcn', @selectionroulette, ...
'CrossoverFcn', @crossovertwopoint, ...
'MutationFcn', @mutationuniform, ...
'DistanceMeasureFcn',[], ...
'HybridFcn', [], ...
'Display', 'final', ...
'PlotFcns',@gaplotbestf, ...
'OutputFcns', [], ...
'Vectorized', 'off', ...
'UseParallel', []);
%-----Call |ga| to Solve the Problem-------------------------------------
[xbest, fbest, exitflag, Output] = ga(@framecost, 34, [], [], [], [], ...
[], [], [], [], opts);
fprintf('The number of generations was : %d\n', Output.generations);
fprintf('The number of function evaluations was : %d\n', Output.funccount);
fprintf('The best function value found was : %g\n', fbest);
fprintf('The best variation value found was : %g\n', xbest);
The framecost.m use to calculate cost (F(x)) and call to frameanalysis.m to analysis and create the penalty function (G(x)).
Then, create the fitnessfunction use the exterial penalty function: Fp= F + rp*G.
when I ran the algorithm, the constraints that I created in the frameanalysis.m are not satisfactory and the values obtained are very small compared with the conventional design.
I'm very very headache and I don't know why???
I hope that you can help me.
Thank you so much
0 commentaires
Réponse acceptée
Matt J
le 22 Mai 2015
Modifié(e) : Matt J
le 22 Mai 2015
when I ran the algorithm, the constraints that I created in the frameanalysis.m are not satisfactory and the values obtained are very small compared with the conventional design.
Your call to ga
[xbest, fbest, exitflag, Output] = ga(@framecost, 34, [], [], [], [], ...
[], [], [], [], opts);
has no constraint arguments specified. You've made them all [].
Penalties applied within framecost are, of course, not an exact way to enforce constraints. You can increase the weight on the penalty to encourage better conformity with the constraints, but how large the weight needs to be is a matter of experiment.
2 commentaires
Matt J
le 22 Mai 2015
A penalty is just encouragement. It encourages the optimizer to satisfy a constraint, but how well it does so depends on how strong the penalty is.
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!