function XBest = initialXFeasiblePoints(this, N)
% Use random search to find N X-feasible points within bounds
% for which the smallest Euclidean distance between points is
% maximized.
%

%   Copyright 2016-2022 The MathWorks, Inc.

LB = this.PrivOptions.VarSpec.LBTrans;
UB = this.PrivOptions.VarSpec.UBTrans;
% Random search
XBest = randomXFeasiblePoints(this, N);
bsf = minDist(XBest);
reps = 50;
for r = 1:reps
    X = randomXFeasiblePoints(this, N);
    if minDist(X) > bsf
        bsf = minDist(X);
        XBest = X;
    end
end
    function d = minDist(X)
        X = (X-LB)./(UB-LB);
        PointDists = pdist(X);
        d = min(PointDists(:));
    end
end
