请大神指导,我的代码前面都是赋值 只有最后一个循环是计算,问题也是出在那,循序运行的结果总是显示 警告: 矩阵为奇异值、接近奇异值或缩放错误。结果可能不准确。RCOND = NaN。
> In op
timprivatelipsol>sherman at 1642
In optimprivatelipsol>ShermanSolve at 1611
In optimprivatelipsol at 697
In linprog at 272
In DEA_environment at 76
Exiting: cannot converge because the primal residual, dual residual,
or upper-bound feasibility is NaN. 已经熬了一夜,还是没解决,下面代码跟数据放上来 请大神帮忙看看
% 环境问题: three-stage network DEA model
clear
DEA = xlsread('DEA-processed-data1.xlsx');
A = zeros(1120,809); % 生成一个系数矩阵规模的全零矩阵
f = zeros(112,809); % 生成一个目标函数矩阵规模的全零矩阵
% 对系数矩阵A赋值
for j=1:112
% 对第一个不等式的系数矩阵赋值
A(j,1:3)=DEA(j,8:10);
beta1 = zeros(112,784);
for t=1:112
beta1(t,7*t-6:7*t)=-DEA(t,1:7);
end
A(1:112,23:806)=beta1;
A(j,807)=DEA(j,23);
% 对第二个不等式的系数矩阵赋值
k=j+112;
A(k,1:3)=-DEA(j,8:10);
A(k,4:8)=DEA(j,11:15);
A(k,16:18)=-DEA(j,1:3);
beta2 = zeros(112,784);
for t=1:112
beta2(t,7*t-6:7*t-4)=DEA(t,1:3);
end
A(113:224,23:806)=beta2;
A(k,808)=DEA(j,24);
% 对第三个不等式的系数矩阵赋值
h=j+224;
A(h,4:8)=-DEA(j,11:15);
A(h,9:15)=DEA(j,16:22);
A(h,19:22)=-DEA(j,4:7);
beta3 = zeros(112,784);
for t=1:112
beta3(t,7*t-3:7*t)=DEA(t,4:7);
end
A(225:336,23:806)=beta3;
A(h,809)=DEA(j,25);
% 对omega和beta之间的约束矩阵的系数赋值
omb = zeros(784,791);
for m=1:7
omb(112*m-111:112*m,m)=-ones(112,1);
omb(112*m-111:112*m,m+7)=ones(112,1);
end
A(337:1120,16:806)=omb;
end
b=zeros(1120,1);
% 给等式约束条件的系数矩阵赋值
Aeq = zeros(112,809); % 生成一个等式约束规模的全零矩阵
for i=1:112
Aeq(i,1:8)=DEA(i,8:15);
Aeq(i,16:22)=DEA(i,1:7);
end
beq=ones(112,1);
for i=1:112 % 对总共112个DMU分别求效率值
f(i,1:15)=-DEA(i,8:22);% 目标函数系数矩阵
f(i,807:809)=-DEA(i,23:25);
% 变量的界
lb = zeros(809,1);
lb(807:809,1)=[-1000000,-1000000,-1000000];
ub = ones(809,1);
ub(807:809,1)=[1000000,1000000,1000000];
%options = optimoptions(@linprog,'Algorithm','simplex','display','iter','diagnostics','on');
A=1e-10 *ones(size(A))+A;
% x0 = ones(809,1);
[x,fval,exitflag,output,lambda] = linprog(f(i,:),A,b,Aeq(i,:),beq(i,:),lb,ub);
end
一周热门 更多>