楼主: hmhn421001
5550 21

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

11
zhangtao 发表于 2011-12-9 17:30:05 |只看作者 |坛友微信交流群
为什么两个W不一样?
数学好就是要天天学

使用道具

12
jing8547 发表于 2011-12-9 23:32:10 |只看作者 |坛友微信交流群
学习下

使用道具

13
epoh 发表于 2011-12-10 16:05:00 |只看作者 |坛友微信交流群
zhangtao 发表于 2011-12-9 17:30
为什么两个W不一样?
zhangtao兄
当初主是要让程序进行而已.
若也是Input oriented CCR model
而各种条件也相同,A,b,lb,..
% 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
则结果是相近的.
%%%%%%%%%%%%%%
DMU name Input_1             Input_2         Input_3        output_1         output_2
DMU_1        264806.95        3998        340244.15        20818.89        406987.07
DMU_2        146823.04        4179        131544.52        14479.76        174703.22
DMU_3        25401.48          929          7862.49             904.18            12587.72
DMU_4        215305.84        1674        279184.52        3328.15           313829.38
DMU_5        417338.19        6656        240468.29        31047.86         327888.54
DMU_6        475780.83        5210        164915.04        21627.37         253739.73
DMU_7        163304.52        540          45263.7             2956.68           62213.18
DMU_8        255716.76        1876        220412.48        1964.39             249315.82
DMU_9        115885.38        869         108008.7           2165.19             117318.03
DMU_10       232136.41       3325        158022.8         9586.89              191067.6
DMU_11       161578.74       1392        127160.69        584.47               140788.65
.....
.....
x_slack_1         x_slack_2         x_slack_3         y_slack_1         y_slack_2
6.56E+03        3.84E-23        3.38E-22        1.22E-23        232241.4828
3.54E-09        4.28E-08        1.26E-12        3.69E-13        4.40E-12
5.63E-13        3.94E-14        3.15E-11        3.20E-12        3.12E-14
1.79E-09        9.73E-36        6.24E-21        1.44E-20        3.52E-08
1.63E-15        2.24E-05        2.55E-14        6.25E-16        6.36E-16
3.78E-12        1.10E-11        7.19E-09        3.38E-11        7.43E-12
1.47E-07        2.19E-16        8.56E-05        2.40E-17        2.15E-16
6706.386157        1.36E-22        1.51E+03        2.60E-22        2.21E+04
821.3853932        3.09E-21        3.13E-06        1.91E-22        3.09E-21
3472.919962        1.07E-23        1.85E+03        2.75E-24        1.14E-23
5751.784274        2.66E-25        1.33E+02        1.58E-24        2.77E-32

Theta
1.598844219
1
1
1
1
1
1
1.044542637
0.929655084
0.916238425
0.909960401

使用道具

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
数学好就是要天天学

使用道具

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老师,您好!
以上错误如何修改?
数学好就是要天天学

使用道具

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


使用道具

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

使用道具

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

使用道具

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.

使用道具

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

使用道具

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

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

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

GMT+8, 2024-5-22 16:14