Optimization tools: handling error output from objective functions

조회 수: 6 (최근 30일)
hussain alqattan
hussain alqattan 2021년 1월 6일
답변: Alan Weiss 2021년 1월 10일
Hello,
I'm working with two optimization MATLAB codes (lsqcurvefit & fminsearch). With these tools I use a user-customized objective function, which is basically a MATLAB function I made. The issue here is that, sometimes this function passes out error outputs, like Inf.
How can I make the optimization tools exclude these error answers from the optimization analysis?
Thanks,
Hussain

답변 (1개)

Alan Weiss
Alan Weiss 2021년 1월 10일
I suggest that you test for unexpected results within your objective function code and handle it appropriately. For example, if you get an Inf or NaN as a result of evaluating your objective function, you can try returning a large, finite value instead.
The real problem is when you have this kind of result at the initial point x0. In that case your optimization should halt immediately and ask for a better initial value.
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by