summaryrefslogtreecommitdiff
path: root/inst/misc/design/stk_phipcrit.m
blob: 5e3a4ea3b4586ff2581c121fb7b1df40f440fd61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% STK_PHIPCRIT computes the "phi_p" criterion of Morris & Mitchell
%
% CALL: D = stk_phipcrit (X, P)
%
%    computes the phi_P criterion on the set of points X, which is defined for
%    an n x d array X as
%
%       D = (sum_{1 <= i < j <= n} d_ij ^ (-p)) ^ (1/p)
%
%    where d_ij is the Euclidean distance in R^d between X(i,:) and X(j,:).
%
% CALL: D = stk_phipcrit (X)
%
%    computes the phi_P criterion with P = 50.
%
% NOTES:
%
%    * In the special case P = 2, this criterion has first been introduced by
%      Audze & Eglais (1977).
%
%    * When p -> +Inf, the value of the phi_p criterion tends to the inverse of
%      the mindist criterion. The phi_p criterion with a high value of p is
%      often used in place of the mindist criterion for its being easier to
%      optimize. Morris & Mitchell recommend using p in the range 20-50 for this
%      purpose.
%
% REFERENCES
%
%   [1] Max D. Morris and Toby J. Mitchell, "Exploratory Designs for Computer
%       Experiments", Journal of Statistical Planning and Inference,
%       43(3):381-402, 1995.
%
%   [2] P. Audze and V. Eglais, "New approach for planning out experiments",
%       Problems of Dynamics and Strengths, 35:104-107, 1977.
%
%   [3] Luc Pronzato and Werner G. Muller, "Design of computer
%       experiments: space filling and beyond", Statistics and Computing,
%       22(3):681-701, 2012.
%
%   [4] G. Damblin, M. Couplet and B. Iooss, "Numerical studies of space filling
%       designs: optimization of Latin hypercube samples and subprojection
%       properties", Journal of Simulation, in press.
%
% See also: stk_mindist, stk_filldist

% Copyright Notice
%
%    Copyright (C) 2017, 2018 CentraleSupelec
%    Copyright (C) 2013, 2014 SUPELEC
%
%    Author:  Julien Bect  <julien.bect@centralesupelec.fr>

% Copying Permission Statement
%
%    This file is part of
%
%            STK: a Small (Matlab/Octave) Toolbox for Kriging
%               (https://github.com/stk-kriging/stk/)
%
%    STK is free software: you can redistribute it and/or modify it under
%    the terms of the GNU General Public License as published by the Free
%    Software Foundation,  either version 3  of the License, or  (at your
%    option) any later version.
%
%    STK is distributed  in the hope that it will  be useful, but WITHOUT
%    ANY WARRANTY;  without even the implied  warranty of MERCHANTABILITY
%    or FITNESS  FOR A  PARTICULAR PURPOSE.  See  the GNU  General Public
%    License for more details.
%
%    You should  have received a copy  of the GNU  General Public License
%    along with STK.  If not, see <http://www.gnu.org/licenses/>.

function phi = stk_phipcrit (x, p)

if nargin < 2,
    p = 50;
end

% compute the distance matrix
D = stk_dist (x);

% compute mindist
D = D + diag (inf (1, size (x, 1)));
z = min (D(:));

% compute the value of the criterion
if z > 0
    tmp = triu ((D / z) .^ (-p), 1);
    phi = 1 / z * sum(tmp(:)) .^ (1/p);
else
    phi = Inf;
end

end % function


%!shared x
%! x = [0, 0.2, 0.4, 0.6, 0.8, 1.0;
%!      0, 0.6, 0.8, 1.0, 0.2, 0.4]';

%!assert (stk_isequal_tolabs ...
%!          (stk_phipcrit (x, 10), 3.946317664423303, 1e-15))

%!assert (stk_isequal_tolabs ...
%!          (stk_phipcrit (x, 50), 3.614077252813102, 1e-15));

%!assert (stk_isequal_tolabs ...
%!          (stk_phipcrit (x, 100), 3.574589859827413, 1e-15));

%!assert (stk_isequal_tolabs ...
%!          (stk_phipcrit (x, 1e9), 1 / stk_mindist (x), 1e-8));

%!assert (isequal (stk_phipcrit (ones (2)), Inf));

% library (DiceDesign)   # load DiceDesign 1.2
% options (digits = 16)  # display 16 significat digits
%
% x <- data.frame (x1 = c(0, 0.2, 0.4, 0.6, 0.8, 1.0),
%                  x2 = c(0, 0.6, 0.8, 1.0, 0.2, 0.4))
%
% phiP (x, 10)    # 3.946317664423303
% phiP (x, 50)    # 3.614077252813102
% phiP (x, 100)   # 3.574589859827413
% phiP (x, 1000)  # Inf, but we can do better