楼主: hmhn421001
5548 21

[问答] matlab做DEA,程序出错了,急救啊,谁能帮我解答下 [推广有奖]

  • 0关注
  • 2粉丝

副教授

25%

还不是VIP/贵宾

-

威望
0
论坛币
207 个
通用积分
52.6293
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
498 点
帖子
241
精华
0
在线时间
819 小时
注册时间
2010-8-6
最后登录
2024-5-16

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
程序如下:
clear
X=[264806.95,3998,340244.15;
146823.04,4179,131544.52;
25401.48,929,7862.49;
215305.84,1674,279184.52;
417338.19,6656,240468.29;
475780.83,5210,164915.04;
163304.52,540,45263.70;
255716.76,1876,220412.48;
115885.38,869,108008.70;
232136.41,3325,158022.80;
161578.74,1392,127160.69;
];   
Y=[20818.89,406987.07;
14479.76,174703.22;
904.18,12587.72;
3328.15,313829.38;
31047.86,327888.54;
21627.37,253739.73;
2956.68,62213.18;
1964.39,249315.82;
2165.19,117318.03;
9586.89,191067.60;
584.47,140788.65;
];
n=size(X', 1);
m=size(X,1);
s=size(Y,1);
epsilon=10^-10;
f=[zeros(1,n) -epsilon*ones(1,m+s) 1];
A=zeros(1,n+m+s+1);b=0;
LB=zeros(n+m+s+1,1);
UB=[];
LB(n+m+s+1)=-inf;
for i=1:n;
Aeq=[X eye(m) zeros(m,s) -X(:,i)
     Y zeros(s,m) -eye(s) zeros(s,1)];
beq=[zeroS(m,1)
     Y(:,i)];
  w(:,i)=LINPROG(f,A,b,Aeq,beq,LB,UB);
end
w
Lambda=w(1:n,:)
s_minus=w(n+1:n+m,:)
s_plus=w(n+m+1:n+m+s,:)
theta=w(n+m+s+1,:)
运行出现:
Error in ==> CCR_DEA at 36
Aeq=[X eye(m) zeros(m,s) -X(:,i)

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:MATLAB atlab matla Lab DEA matlab Error 程序

epoh 发表于 2011-12-8 19:04
% Input matrix
X=[264806.95,3998,340244.15;
146823.04,4179,131544.52;
您好,请问能用matlab编写两阶段关联DEA程序吗

使用道具

21
伊冰儿 发表于 2012-4-24 11:31:12 |只看作者 |坛友微信交流群
epoh 发表于 2011-12-10 16:05
zhangtao兄
当初主是要让程序进行而已.
若也是Input oriented CCR model
请问这里theta大于1是什么意思呢,请指教!

使用道具

20
epoh 发表于 2011-12-28 19:31:29 |只看作者 |坛友微信交流群
wliu06 发表于 2011-12-28 16:59
借花献佛了,这个程序为何报错啊?我检查好几遍了
X=[8124,6061,10130,20342,20561,4632;
12560,5230,42 ...
% Input matrix
X=[8124,6061,10130,20342,20561,4632;
12560,5230,4260,2310,1210,1790;
8420,4320,5820,12560,13510,12640;];   
% Output matrix  
Y=[3573,3510,4210,12680,21760,7920;
6970,5870,9120,21680,43250,21320;];   
%extracts the number of inputs and outputs;
X=X';
Y=Y';
[n,m] = size(X);
[n,s] = size(Y);
epsilon=10^-10;
% Input oriented CCR model;
w = zeros(n,n+m+s+1);
% Objective function of the CCR model: min(0*lambda - epsilon*(s+ + s-) + theta);
   f = [zeros(1,n) -epsilon*ones(1,s) -epsilon*ones(1,m) 1];
   A=zeros(1,n+m+s+1);b=0;  
   lb=zeros(1,n+m+s+1);
   lb(n+m+s+1)=-inf;               
    for j=1:n
       Aeq = [Y', -eye(s,s), zeros(s,m+1);
             -X', zeros(m,s), -eye(m,m), X(j,:)'];
       beq = [Y(j,:)';zeros(m,1)];
       w(j,:) = LINPROG(f,A,b,Aeq,beq,lb);   
    end
w

%%%%%
w =

  1.0e+003 *

  Columns 1 through 6

    0.0000    0.0000    0.0000    0.0000    0.0001    0.0001
    0.0000    0.0000    0.0000    0.0000    0.0002    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0002    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0006    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0010    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0010

  Columns 7 through 12

    0.0000    0.8007    0.0000    4.3303    0.0000    0.0004
    0.0000    1.2121    0.0000    2.5946    0.0000    0.0005
    0.3785    0.0000    0.6229    1.8301    0.0000    0.0005
    0.0000    3.5227    0.7690    0.7428    0.0000    0.0006
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0010
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0010

使用道具

19
wliu06 发表于 2011-12-28 16:59:19 |只看作者 |坛友微信交流群
借花献佛了,这个程序为何报错啊?我检查好几遍了
X=[8124,6061,10130,20342,20561,4632;
12560,5230,4260,2310,1210,1790;
8420,4320,5820,12560,13510,12640;];    %用户输入多指标输入矩阵X
Y=[3573,3510,4210,12680,21760,7920;
6970,5870,9120,21680,43250,21320;];    %用户输入多指标输出矩阵Y
n=size(X', 1);m=size(X,1);
s=size(Y,1);
epsilon=10^-10;
f=[zeros(1,n) -epsilon*ones(1,m+s) 1];
A=zeros(1,n+m+s+1);b=0;
LB=zeros(n+m+s+1,1);
UB=[];
LB(n+m+s+1)=-inf;
for i=1:n;
Aeq=[X eye(m) zeros(m,s) -X(:,i)
     Y zeros(s,m) -eye(s) zeros(s,1)];
beq=[zeros(m,1)
     Y(:,i)];
  w(:,i)=LINPROG(f,A,b,Aeq,beq,LB,UB);
end
w
Lambda=w(1:n,:)
s_minus=w(n+1:n+m,:)
s_plus=w(n+m+1:n+m+s,:)
theta=w(n+m+s+1,:)
Optimization terminated.
??? Subscripted assignment dimension mismatch.

使用道具

18
epoh 发表于 2011-12-18 21:37:16 |只看作者 |坛友微信交流群
zhangtao 发表于 2011-12-18 21:15
epoh老师,您好!
    非常感谢!这个文件DEAresults.table在matlab中我为什么找不到?
在那儿看呢?
就在你放dea_modified.m的旁边
DEAresults2.table
   DEAresults2.rar (769 Bytes) 本附件包括:
  • DEAresults2.table

使用道具

17
zhangtao 发表于 2011-12-18 21:15:18 |只看作者 |坛友微信交流群
epoh 发表于 2011-12-17 18:47
zhangtao兄请执行dea_modified.m
结果存在DEAresults2.table
epoh老师,您好!
    非常感谢!这个文件DEAresults.table在matlab中我为什么找不到?
在那儿看呢?
数学好就是要天天学

使用道具

16
epoh 发表于 2011-12-17 18:47:51 |只看作者 |坛友微信交流群
zhangtao 发表于 2011-12-17 13:35
>> % Input matrix
X=[264806.95,3998,340244.15;
146823.04,4179,131544.52;
zhangtao兄请执行dea_modified.m
结果存在DEAresults2.table
   dea_modified.rar (2.02 KB) 本附件包括:
  • dea_modified.m


使用道具

15
zhangtao 发表于 2011-12-17 13:35:33 |只看作者 |坛友微信交流群
>> % Input matrix
X=[264806.95,3998,340244.15;
146823.04,4179,131544.52;
25401.48,929,7862.49;
215305.84,1674,279184.52;
417338.19,6656,240468.29;
475780.83,5210,164915.04;
163304.52,540,45263.70;
255716.76,1876,220412.48;
115885.38,869,108008.70;
232136.41,3325,158022.80;
161578.74,1392,127160.69];   
% Output matrix
Y=[20818.89,406987.07;
14479.76,174703.22;
904.18,12587.72;
3328.15,313829.38;
31047.86,327888.54;
21627.37,253739.73;
2956.68,62213.18;
1964.39,249315.82;
2165.19,117318.03;
9586.89,191067.60;
584.47,140788.65];
%extracts the number of inputs and outputs;
[n,m] = size(X);
[n,s] = size(Y);
epsilon=10^-3;
% Input oriented CCR model;
w = zeros(n,n+m+s+1);
% Objective function of the CCR model: min(0*lambda - epsilon*(s+ + s-) + theta);
   f = [zeros(1,n) -epsilon*ones(1,s) -epsilon*ones(1,m) 1];
   A=zeros(1,n+m+s+1);b=0;  
   lb=zeros(1,n+m+s+1);
   lb(n+m+s+1)=-inf;               
    for j=1:n
       Aeq = [Y', -eye(s,s), zeros(s,m+1);
             -X', zeros(m,s), -eye(m,m), X(j,:)'];
       beq = [Y(j,:)';zeros(m,1)];
       w(j,:) = LINPROG(f,A,b,Aeq,beq,lb);   
    end
w
Lambda=w(1:n,:)
s_minus=w(n+1:n+m,:)
s_plus=w(n+m+1:n+m+s,:)
theta=w(n+m+s+1,:)
Warning: Function call LINPROG invokes inexact match C:\MATLAB7\toolbox\optim\linprog.m.

Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
         the dual appears to be infeasible (and the primal unbounded).      
         (The primal residual < TolFun=1.00e-008.)

w =

  1.0e+006 *

  Columns 1 through 6

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 7 through 12

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0477
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1029
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0350
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0710
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0965
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0421
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0739
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0964
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0792
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1339
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1046

  Columns 13 through 17

    0.9333    0.7865    0.0119    1.0105    0.0000
    1.1866    1.1585    0.0391    1.1957    0.0000
    0.7419    0.9179    0.0995    0.3482    0.0001
    1.2952    0.8658    0.0000    1.1335    0.0000
    1.1010    0.9376    0.0226    0.8920    0.0000
    1.0869    1.2311    0.0404    0.6711    0.0000
    1.5549    1.0863    0.0036    0.3011    0.0000
    1.2980    1.0082    0.0000    1.0990    0.0000
    1.0821    0.9806    0.0000    1.1126    0.0000
    1.3380    1.2517    0.0159    1.1239    0.0000
    1.0972    0.9572    0.0000    1.1049    0.0000


Lambda =

  1.0e+006 *

  Columns 1 through 6

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 7 through 12

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0477
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1029
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0350
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0710
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0965
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0421
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0739
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0964
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0792
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1339
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1046

  Columns 13 through 17

    0.9333    0.7865    0.0119    1.0105    0.0000
    1.1866    1.1585    0.0391    1.1957    0.0000
    0.7419    0.9179    0.0995    0.3482    0.0001
    1.2952    0.8658    0.0000    1.1335    0.0000
    1.1010    0.9376    0.0226    0.8920    0.0000
    1.0869    1.2311    0.0404    0.6711    0.0000
    1.5549    1.0863    0.0036    0.3011    0.0000
    1.2980    1.0082    0.0000    1.0990    0.0000
    1.0821    0.9806    0.0000    1.1126    0.0000
    1.3380    1.2517    0.0159    1.1239    0.0000
    1.0972    0.9572    0.0000    1.1049    0.0000

??? Index exceeds matrix dimensions.

>>
epoh老师,您好!
以上错误如何修改?
数学好就是要天天学

使用道具

14
zhangtao 发表于 2011-12-17 13:34:33 |只看作者 |坛友微信交流群
epoh 发表于 2011-12-10 16:05
zhangtao兄
当初主是要让程序进行而已.
若也是Input oriented CCR model
epoh老师,您好!
      为什么您的这个程序执行不出您提供的结果?
% Input matrix
X=[264806.95,3998,340244.15;
146823.04,4179,131544.52;
25401.48,929,7862.49;
215305.84,1674,279184.52;
417338.19,6656,240468.29;
475780.83,5210,164915.04;
163304.52,540,45263.70;
255716.76,1876,220412.48;
115885.38,869,108008.70;
232136.41,3325,158022.80;
161578.74,1392,127160.69];   
% Output matrix
Y=[20818.89,406987.07;
14479.76,174703.22;
904.18,12587.72;
3328.15,313829.38;
31047.86,327888.54;
21627.37,253739.73;
2956.68,62213.18;
1964.39,249315.82;
2165.19,117318.03;
9586.89,191067.60;
584.47,140788.65];
%extracts the number of inputs and outputs;
[n,m] = size(X);
[n,s] = size(Y);
epsilon=10^-3;
% Input oriented CCR model;
w = zeros(n,n+m+s+1);
% Objective function of the CCR model: min(0*lambda - epsilon*(s+ + s-) + theta);
   f = [zeros(1,n) -epsilon*ones(1,s) -epsilon*ones(1,m) 1];
   A=zeros(1,n+m+s+1);b=0;  
   lb=zeros(1,n+m+s+1);
   lb(n+m+s+1)=-inf;               
    for j=1:n
       Aeq = [Y', -eye(s,s), zeros(s,m+1);
             -X', zeros(m,s), -eye(m,m), X(j,:)'];
       beq = [Y(j,:)';zeros(m,1)];
       w(j,:) = LINPROG(f,A,b,Aeq,beq,lb);   
    end
w
数学好就是要天天学

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-22 13:33