function tf = optimizationFinished(this, iteration)
%

%   Copyright 2016-2023 The MathWorks, Inc.

if iteration == 1
    tf = false;
elseif this.PlotFcnStop || this.OutputFcnStop || ...
        this.NumObjectiveEvaluations >= this.PrivOptions.MaxObjectiveEvaluations
    tf = true;
elseif toc(this.CurrentRunStartTime) >= this.PrivOptions.MaxTime
    tf = true;
else
    tf = false;
end
end
