-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnatex_lenv.m
38 lines (34 loc) · 983 Bytes
/
natex_lenv.m
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
function natex = natex_lenv(K, lpr)
% NATEX_LENV returns the natural extension with lower envelope LP approach
%
% Synopsis:
% natex = natex_lenv(K, lpr)
%
% Input:
% K = a matrix ("gambles")
% lpr = a column vector with length the number of rows of K
%
% Output:
% natex = a column vector with lenth the number of rows of K
%
% Background & Method:
% For each gamble f (column of K), the natural extension E(f) of a
% lower prevision P can be calculated using the following linear
% program:
%
% E(f) = min f'μ subject to K'μ <= P and μ >= 0 and 1'μ = 1
%
% See also GLPK, NATEX_BENSOLVE, NATEX_DIRECT.
[n, m] = size(K);
natex = lpr;
% prepare the common parts of the linear programs
A = [K'; ones(1, n)];
b = [lpr; 1];
ctype = [repmat('L', 1, m), 'S'];
% for each gamble, complete the preparations for and solve the linear
% program
for k = 1:m
c = K(:, k);
[~, natex(k), ~, ~] = glpk(c, A, b, [], [], ctype);
end
end