Optimum solution found does not correspond to minimum of the cost function - Genetic Algorithm
2 次查看(过去 30 天)
显示 更早的评论
Hi All,
I have a Simulink model which depend on parameters like springs value and damper settings. The spring values available are the followings
Springs_F = [275, 325, 375, 425, 475];
Springs_H = [125,150,175,200,225,250,275];
Springs_R = [75,100,125,150,175];
The available damper curves (Damper force Vs speed) are loaded into the Simulink workspace and then the selection of them is done by selecting from the following (number of clicks, as racing damper can be tuned by adjusting the Bump and Rebound knobs)
ii = [0 1 2 3 4 5]; % Front Damper Rebound
jj = [0 1 2 3 4 5]; % Front Damper Bump
kk = [0 1 2 3 4 5]; % Heave Damper Rebound
ll = [0 1 2 3 4 5]; % Heave Damper Bump
mm = [0 1 2 3 4 5]; % Roll Damper Rebound
nn = [0 1 2 3 4 5]; % Roll Damper Bump
I also generate a cost function (objetive.m) which is passed to the ga (Genetic Algorithm) optimization tool
The options of ga are set using the following code
options = gaoptimset('CrossoverFraction',0.6,'PopulationSize',100,'StallGen',100,'Generations',900,'PlotFcns', @gaplotbestindiv,'Display','iter');
The Genetic Algorithm optimization is then called with the following
[xOptimum,Cost_fVal,exitflag,output,population,scores] = ga(@(x)objective(x,ii,jj,kk,ll,mm,nn,Springs_F,Springs_H,Springs_R),9,[],[],[],[],lb,ub,[],intCon,options);
where x is a variable which define the parameters that I want to vary in the model. Conceptually is something like x = [ii,jj,kk,ll,mm,nn,Springs_F,Springs_H,Springs_R]. Note also that intCon = 1:9; (as all the variables passed to the ga function are integer)
The optimization runs and the results are attached for you to have a look
My problem is the following:
The value of Cost_fVal returned by the optimization is 2.7280, and xOptimum = [1,3,3,5,5,1,2,4,4]
However, if I run the model with x = xOptimum; I got a value of the cost function of about 3.15.
I was expecting that xOptimum would have given a cost function value equal to Cost_fVal (=2.7280)
So in summary, the optimization tells me the minimum of the cost function found is 2.7280 BUT the cost function value running the model with x = xOptimum does not correspond to this, but it actually gives an higher value (3.15)
How can I find the value of x corresponding to the minimum value of the const function found (2.7280)?
Finally, with a for-loop I run all the 100 values of x returned by the optimization in "population" (see attached) but the minimum value of the cost function is higher than cost_fVal (with the minimum being 2.76).
Any idea on what I am missing here?
Thanks in advance
G
1 个评论
Matt J
2014-5-6
When you say "x=xOptimum" what x are you referring to exactly? The genetic algorithm doesn't let you specify a single initial point, if that's what you mean. GA works with a population of points.
回答(1 个)
Robert Wohlfarth
2019-12-22
Hi Giuseppe,
its a long time ago, I know, but have you solved your problem? It seems, that I have the same/similar problem:
- the optimal solution returned by ga, [x,fval,...]=ga(...), does not correspond to the minimal fval* (and corresponding x*) in my population history found with the min function
- also, when I do a forward simulation with the so obtained optimal parameters x*, the result differs from the fittness function fval* of that optimal parameter set
I have checked everything twice but can't find any solution. Also, I can not simply rerun the optimization since it takes over 3 days.
Thank you and all others who can help!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!