Nonlinear constraints not respected in optimization

4 views (last 30 days)
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

Answers (1)

Matt J
Matt J on 7 Sep 2022
Edited: Matt J on 7 Sep 2022
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 Comments
Bruno Luong
Bruno Luong on 8 Sep 2022
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 on 8 Sep 2022
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

Sign in to comment.

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!