Why are the computations take longer computational time as the one set in property 'MaxTime' throughout the iterations when using functions from the Optimization Toolbox?

조회 수: 3 (최근 30일)
For a particular optimization task it is sought to have the optimization finished before a particular time threshold. For this reason it is defined property 'MaxTime' as follows,
options = optimoptions('patternsearch', 'Display', 'final', 'MaxTime', 0.01, 'MaxFunctionEvaluations', 10);
 
However, it takes considerably longer time to finish the optimization task than the specified time of 0.01 seconds.
 
Why are the computations take longer computational time as the one set in property 'MaxTime' throughout the iterations when using functions from the Optimization Toolbox?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 12월 27일
The functions from the Optimization Toolbox check the latter threshold by means of property 'MaxTime' only after the cost function evaluation has been finished. This means, that the functions from the Optimization Toolbox do not take the computational time needed for the custom cost function into consideration when checking the defined threshold 'MaxTime'. In other words, the computational time for the optimization iterations might be affected by the computational time needed by the custom cost function and this cannot be constrained by means of property 'MaxTime'.
In this case one needs to manually check if the computation of the cost function may exceed the desirable limit and stop it with a default value accordingly.

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by