function Objective = GPFMeanOnPoints(this, X)
% Return the mean ObjectiveFcnGP value for all feasible points
% in X. Return Inf for infeasible points. Note that we must
% transform to native space in order to apply the user-supplied
% conditionalVariableFcn and constraint functions, and after
% that must canonicalize X and transform back before we can
% apply the GP models.
%

%   Copyright 2016-2022 The MathWorks, Inc.

[Xcanon, InputFeasible] = legalizePoints(this, X);
allSat = allConstraintsSatisfied(this, Xcanon, this.ConstraintModels, this.ErrorModel);
feasible = InputFeasible & allSat;
Objective = inf(size(X,1),1);
Objective(feasible) = predict(this.ObjectiveFcnModel, Xcanon(feasible,:));
end
