|
r=[ -3.9 -0.71 -3.75 11.79 9.6 -4.95 -0.42 -2.21 3.23 21.95 10.02;
6.13 16.93 4.11 8.17 15.23 0.47 29.92 3.63 50.6 -7 0.58;
2.17 1.1 11.22 -3.43 61.08 -3.68 3.14 4.09 32.4 49.68 47.41;
0.07 57.52 69.09 25.18 21.55 -2.94 -7.65 5.3 -1.21 13.94 21.44;
-2.19 -18.6 1.02 3.41 -21.1 -7.6 -5.11 -6.06 -15.6 -27 -27.7;
8.88 0.96 -8.52 -7.58 0.85 -0.89 -0.61 -5.36 15.07 4.49 14.21;
-10.6 -13 -4.6 -2.5 -21 -10.3 -12.3 -11.4 -21.2 13.55 -18.4;
5.31 34.78 3.66 24.63 32.82 3 3.89 -2.84 11.42 5.82 32.62;
0.1 -0.81 0.47 -11.8 -8.89 0 -2.54 -5.97 -3.44 -11.3 -12;
11.03 -2.03 -11.5 -6.99 -3.61 -3.76 -2.74 0.13 0.37 -8.06 -8.67;
-12.7 -18.7 -10.6 -15.9 -9.62 0 -4.94 -5.05 -11.2 -13.5 -9.5;
4.67 6.12 2.59 -4.26 -4.82 0.76 -2.67 7.63 8.33 -1.36 9.26;
-3.98 -8.65 -3.68 -6.67 -2.82 -10.1 -6.25 -6.08 -2.54 15.02 -4.07;
1.82 21.47 0.45 29.21 19.13 1.67 4.23 6.47 8.45 42.78 16.14;
-2.18 1.3 -9.17 -17.9 -15.4 16.16 1.25 2.41 -10.5 -1.56 -6.69;
8.12 4.5 4.35 -1.5 8.52 42.1 10.48 2.35 31.46 1.22 2.17;
31.27 59.14 10.15 31.91 21.13 -2.07 11.58 51.21 90.48 50.36 71.57;
-3.36 -5.68 0 5.99 -18.3 12.71 4.5 -9.35 -11.3 -27.2 -23.4;
1.04 -1.9 -11.1 6.52 5.03 -6.28 5.08 8.9 8.45 15.44 0.68;
-6.59 -2.6 -3.61 -11.6 -6.17 -7.64 -2.08 -7.61 -2.49 -10.8 -1.64];
M=mean(r)
for t=1:20
for j=1:11
C(t,j)= M(1,j)-r(t,j);
end
end
T=zeros(20,1);
f=[-1*0.01*M';T]
H=eye(20,20);
A=[0.01*C,-1*H] ;
disp(A);
b=zeros(20,1);
L1=ones(1,11);
L2=zeros(1,20);
Aeq=[L1,L2];
beq=[1];
lb=zeros(31,1);
[x,fval,exitflag,output,lambdal]=linprog(f,A,b,Aeq,beq,[],lb)
e1=-fval
r=[ -3.9 -0.71 -3.75 11.79 9.6 -4.95 -0.42 -2.21 3.23 21.95 10.02;
6.13 16.93 4.11 8.17 15.23 0.47 29.92 3.63 50.6 -7 0.58;
2.17 1.1 11.22 -3.43 61.08 -3.68 3.14 4.09 32.4 49.68 47.41;
0.07 57.52 69.09 25.18 21.55 -2.94 -7.65 5.3 -1.21 13.94 21.44;
-2.19 -18.6 1.02 3.41 -21.1 -7.6 -5.11 -6.06 -15.6 -27 -27.7;
8.88 0.96 -8.52 -7.58 0.85 -0.89 -0.61 -5.36 15.07 4.49 14.21;
-10.6 -13 -4.6 -2.5 -21 -10.3 -12.3 -11.4 -21.2 13.55 -18.4;
5.31 34.78 3.66 24.63 32.82 3 3.89 -2.84 11.42 5.82 32.62;
0.1 -0.81 0.47 -11.8 -8.89 0 -2.54 -5.97 -3.44 -11.3 -12;
11.03 -2.03 -11.5 -6.99 -3.61 -3.76 -2.74 0.13 0.37 -8.06 -8.67;
-12.7 -18.7 -10.6 -15.9 -9.62 0 -4.94 -5.05 -11.2 -13.5 -9.5;
4.67 6.12 2.59 -4.26 -4.82 0.76 -2.67 7.63 8.33 -1.36 9.26;
-3.98 -8.65 -3.68 -6.67 -2.82 -10.1 -6.25 -6.08 -2.54 15.02 -4.07;
1.82 21.47 0.45 29.21 19.13 1.67 4.23 6.47 8.45 42.78 16.14;
-2.18 1.3 -9.17 -17.9 -15.4 16.16 1.25 2.41 -10.5 -1.56 -6.69;
8.12 4.5 4.35 -1.5 8.52 42.1 10.48 2.35 31.46 1.22 2.17;
31.27 59.14 10.15 31.91 21.13 -2.07 11.58 51.21 90.48 50.36 71.57;
-3.36 -5.68 0 5.99 -18.3 12.71 4.5 -9.35 -11.3 -27.2 -23.4;
1.04 -1.9 -11.1 6.52 5.03 -6.28 5.08 8.9 8.45 15.44 0.68;
-6.59 -2.6 -3.61 -11.6 -6.17 -7.64 -2.08 -7.61 -2.49 -10.8 -1.64];
M=mean(r)
for t=1:20
for j=1:11
C(t,j)= M(1,j)-r(t,j);
end
end
T=zeros(11,1);
R=0.3/20*ones(20,1);
f=[T;R]
H=eye(20,20);
A=[0.01*C,-1*H] ;
disp(A);
b=zeros(20,1);
L1=ones(1,11);
L2=zeros(1,20);
Aeq=[L1,L2];
beq=[1];
lb=zeros(31,1);
[x,fval,exitflag,output,lambdal]=linprog(f,A,b,Aeq,beq,[],lb)
e2=fval
format long
max=e1-e2
|
|