function [BestXTable, MinMean, Iteration] = minVisitedMeanPoint(this)
% Attempts to find the feasible point BestXTable that minimizes
% the mean of the ObjectiveFcn model, from among those points
% visited (evaluated).

%   Copyright 2016-2024 The MathWorks, Inc.

if isempty(this.ObjectiveFcnModel) || ...
        (this.PrivOptions.NumCoupledConstraints > 0 && any(cellfun(@isempty, this.ConstraintModels)))
    BestXTable = [];
    MinMean = NaN;
    Iteration = NaN;
else
    ObjMeans = GPFMeanOnPoints(this, this.XTrain);
    ObjMeans(isPointOutOfBounds(this, this.XTrace)) = NaN;      % Exclude out of bounds points
    [MinMean, Iteration] = nanmin(ObjMeans);
    BestXTable = this.XTrace(Iteration,:);
end
end
