problem with curve tracking obtained by the genetic algorithm

1 次查看(过去 30 天)
Hello,
I'm running a genetic algorithm with linear inequality constraints:
gaoptions = gaoptimset('TolCon', 1e-12, 'TolFun', 1e-8, 'CrossoverFcn', @crossoverheuristic, 'MutationFcn',@mutationadaptfeasible, 'PopulationSize', 100, 'Generations', 200, 'InitialPopulation',U0');
U =ga(@(U0) funcaoObjetivo(QP,U0',n,auxPrevisoes,R,Riqueza,auxR1,tbBarra,C,D,r1,ci,Uant,peso1,peso2),m*(n+1),B,b,[],[],[],[],[],gaoptions);
I'm also running the same algorithm with fmincon optimization.
options = optimoptions(@fmincon,'Algorithm','sqp','TolFun',1e-12);
U = fmincon(@(U0) funcaoObjetivo(QP,U0,n,auxPrevisoes,R,Riqueza,auxR1,tbBarra,C,D,r1,ci,Uant,peso1,peso2),U0,B,b,[],[],[],[],[],options);
Both results must be equivalents however, the genetic algorithm is not able to achieve good solutions as fmincon does. The main objective is tracking a curve, the solutions obtained by fmincon get tracking the curve exactly (with small error), the solutions obtained by ga also get tracking the curve but with a big error. Do you know what can be my mistake?

采纳的回答

John D'Errico
John D'Errico 2019-2-11
编辑:John D'Errico 2019-2-11
It is not really a mistake, except perhaps a mistake of choice. Or you might say a mistake of understanding the tools involved.
GA is a stochastic algorithm. It is good at trying to not get stuck in a local minimum, while still trying to find the global solution. But it is not really that good at zeroing in on the exact solution. Or if you try to force it to do so, a stochastic optimizer will take a longer time to do so, because it will require many function evaluations.
Fmincon is designed to move down a smoothly structured surface, with rapid convergence when the solution is near. If you want, think of the quadratic convergence behavior of algorithms in the class of Newton's method.
Different algoithms have differing performance, and different things they do really well.
So you can have it either way, but you cannot so easily have the best of all worlds. Yes, I suppose you could use GA to do as well as it can in areasonable amount of time, then when it terminates, switch to fmincon to hone in on the solution.
  3 个评论
John D'Errico
John D'Errico 2019-2-11
AH. Thank you Alan. One thing I really need to do is learn the GO TB toolset. Harder since I do not have that TB.
Maisa Melo
Maisa Melo 2019-2-11
Thank you, everyone, to the help. I used the HybridFcn option as suggested. The result for ga optimization was a lot better than the result before.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by