function ImputedObj = imputeObjective(this, PendingXTable, ParallelMethod)
% Use the selected method to impute Objective values for the pending X points.
%

%   Copyright 2016-2022 The MathWorks, Inc.

switch ParallelMethod
    case 'clippedmodelprediction'
        % Worst case of: Model mean at X, Model feasible min, Observed feasible min.
        ImputedObj = max(max(predictObjective(this, PendingXTable), this.IncumbentF), this.MinObjective);
    case 'modelprediction'
        % model predicted mean at X
        ImputedObj = predictObjective(this, PendingXTable);
    case 'minobserved'
        % min feasible observed
        ImputedObj = repmat(this.MinObjective, height(PendingXTable), 1);
    case 'maxobserved'
        % max feasible observed
        FeasMask = double(this.FeasibilityTrace);
        FeasMask(FeasMask==0) = NaN;
        if isempty(this.FTrain)
            ImputedObj = NaN(height(PendingXTable), 1);
        else
            ImputedObj = repmat(nanmax(this.FTrain(:).*FeasMask), height(PendingXTable), 1);
        end
    otherwise
        assert(ismember(ParallelMethod, {'clippedmodelprediction', ...
            'modelprediction', 'minobserved', 'maxobserved'}));
end
end
