Nonlinear constraints not respected in optimization

2 次查看(过去 30 天)
Dear all, I'm trying to perform a optimization procedure where nonlinear constraints (equality and inequality) are involved. The problem regards the optimization of a double wishbone suspension geometry, where the output will be the optimal coordinates of the joints in order to achieve the goals. In the objective function, after some preliminar step, a simscape model will be simulated and the objectives consists in some performance directly measured from the model. I'm trying to solve the optimization using the MATLAB live optimization, however it seems it completely ignore the nonlinear constraints and when it tests a model that can't be assembled in the simscape model, the optimization fails. The reason of the nonlinear constraints is to only test feaseble solutions and restrict the sarch space and also exclude some solution that will be bad performing, I'm not understending why they are not respected, at the moment I'm using the multi-objective genetic algorithm, but the same behaviour happens also with other solvers.
Thanks to everyone.
Mattia

回答(1 个)

Matt J
Matt J 2022-9-7
编辑:Matt J 2022-9-7
Nonlinear constraints are only satisfied at convergence, and then only within the tolerance settings that you've specified.
You must write your objective function so that it can return something without crashing for any input point tested. Usually, you would write it to return NaN or Inf at points where it doesn't already have a real, finite value.
  4 个评论
Bruno Luong
Bruno Luong 2022-9-8
if isempty(ans.zside)
f(1:end) = inf;
else
whatever f is (constraint function?) it looks highly discontinuous. No wonder why the standard optimizer get lost (not sure how much it bother GA though)
Matt J
Matt J 2022-9-8
I don't know what everything means in the code excerpt, but it looks like this would be more apt:
f(1:end) = inf;
simout=[];
try
simopt = simset('SrcWorkspace','current');
simout=sim('DoubleWishbone',Tsim,simopt);
end
if isempty(simout)
return
end
%rest of the objective function

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by