请问怎么用lingo求解?帮帮忙!!!

evolmath
2014-04-05 · TA获得超过2745个赞
知道小有建树答主
回答量:413
采纳率:100%
帮助的人:231万
展开全部

 

方法一:

model:

    sets:

        Level/1..3/: P, U, Goal;      !有3个优先级别;

        Variable/1..4/: x;                !有4个变量;

        Sn/1..5/: g, dp, dm;           !有5个柔性目标约束;

        Sc(Sn, Variable): C;          !柔性约束系数矩阵(5×4矩阵);

        W(Level, Sn): Wp, Wm;    !偏差权重矩阵(3×5矩阵);

    endsets

    data:

        P=? ? ?;                       !对优先级P赋值;

        Goal=? ? 0;                  !Goal(i)为第i(≤2)个优先级时最优目标值,注:Goal(3)不起作用;

        g=20 20 150 20 900;   !柔性约束常数项矩阵;

        C=1 0 1 0                     !柔性约束系数矩阵;

             0 1 0 1

             3 4 0 0

             0 0 3 4

            10 8 9 7;

        Wp=0 0 1 0 0               !正偏差权重矩阵;

               0 0 0 1 0

               0 0 0 0 0;

        Wm=1 1 1 0 0              !负偏差权重矩阵;

                0 0 0 0 0

                0 0 0 0 1;

    enddata

    min=@sum(Level(i):P(i)*U(i));                                                   !目标函数;

    @for(Level(i):U(i)=@sum(Sn(j):Wp(i,j)*dp(j)+Wm(i,j)*dm(j)));   !求偏差矩阵U;

    @for(Sn(j):@sum(Variable(k):C(j,k)*x(k))+dm(j)-dp(j)=g(j));     !柔性约束;

    @for(Level(i)|i#lt#@size(Level):@bnd(0,U(i),Goal(i)));             !偏差限定在最优值范围内;

end

 

第一级目标计算,P(1),P(2),P(3)分别输入1,0,0,Goal(1)与Goal(2)输入两个较大的值(例如1000),表明这两项约束不起作用.结果如下:

 

  Global optimal solution found.

  Objective value:                              0.000000

 

                                Variable           Value        Reduced Cost

                                   P( 1)        1.000000            0.000000

                                   P( 2)        0.000000            0.000000

                                   P( 3)        0.000000            0.000000

                                   U( 1)        0.000000            1.000000

                                   U( 2)        1000.000            0.000000

                                   U( 3)        520.0000            0.000000

                                   X( 1)        20.00000            0.000000

                                   X( 2)        22.50000            0.000000

                                   X( 3)        0.000000            0.000000

                                   X( 4)        0.000000            0.000000

 

第一级最优偏差为0,进行第二论计算

第二级目标计算,P(1),P(2),P(3)分别输入0,1,0,由于第一级最优偏差为0,因此Goal(1)输入0,Goal(2)输入较大的值(例如1000).结果如下:

 

  Global optimal solution found.

  Objective value:                              0.000000

 

                                Variable           Value        Reduced Cost

                                   P( 1)        0.000000            0.000000

                                   P( 2)        1.000000            0.000000

                                   P( 3)        0.000000            0.000000

                                   U( 1)        0.000000            0.000000

                                   U( 2)        0.000000            0.000000

                                   U( 3)        520.0000            0.000000

                                   X( 1)        20.00000            0.000000

                                   X( 2)        22.50000            0.000000

                                   X( 3)        0.000000            0.000000

                                   X( 4)        0.000000            0.000000

 

第二级最优偏差为0,进行第三论计算

第三级目标计算,P(1),P(2),P(3)分别输入0,0,1,由于第一、二级最优偏差都为0,因此Goal(1)与Goal(2)输入0.结果如下:

 

  Global optimal solution found.

  Objective value:                              445.0000

 

 

                                Variable           Value        Reduced Cost

                                   P( 1)        0.000000            0.000000

                                   P( 2)        0.000000            0.000000

                                   P( 3)        1.000000            0.000000

                                   U( 1)        0.000000           -5.333333

                                   U( 2)        0.000000           -3.083333

                                   U( 3)        445.0000            0.000000

                                GOAL( 1)    0.000000            0.000000

                                GOAL( 2)    0.000000            0.000000

                                   X( 1)        30.00000            0.000000

                                   X( 2)        15.00000            0.000000

                                   X( 3)        0.000000           0.2500000

                                   X( 4)        5.000000            0.000000

                                  DP( 1)       10.00000            0.000000

                                  DP( 2)       0.000000            5.333333

                                  DP( 3)       0.000000            2.000000

                                  DP( 4)       0.000000            0.000000

                                  DP( 5)       0.000000            1.000000

                                  DM( 1)       0.000000            5.333333

                                  DM( 2)       0.000000            0.000000

                                  DM( 3)       0.000000            8.666667

                                  DM( 4)       0.000000            3.083333

                                  DM( 5)       445.0000            0.000000

 

最终结果为x1=30,x2=15,x3=0,x4=5,第三级最优偏差为445

 

 

方法二:

第一轮计算:

min=dm1+dm2+dm3+dp3;

x1+x3+dm1-dp1=20;

x2+x4+dm2-dp2=20;

3*x1+4*x2+dm3-dp3=150;

3*x3+4*x4+dm4-dp4=20;

10*x1+8*x2+9*x3+7*x4+dm5-dp5=900;

 

  Global optimal solution found.

  Objective value:                              0.000000

 

第二轮计算:

min=dp4;

x1+x3+dm1-dp1=20;

x2+x4+dm2-dp2=20;

3*x1+4*x2+dm3-dp3=150;

3*x3+4*x4+dm4-dp4=20;

10*x1+8*x2+9*x3+7*x4+dm5-dp5=900;

dm1+dm2+dm3+dp3=0;

 

  Global optimal solution found.

  Objective value:                              0.000000

 

第三轮计算:

min=dm5;

x1+x3+dm1-dp1=20;

x2+x4+dm2-dp2=20;

3*x1+4*x2+dm3-dp3=150;

3*x3+4*x4+dm4-dp4=20;

10*x1+8*x2+9*x3+7*x4+dm5-dp5=900;

dm1+dm2+dm3+dp3=0;

dp4=0;

 

  Global optimal solution found.

  Objective value:                              445.0000

 

                                Variable           Value        Reduced Cost

                                     DM5      445.0000            0.000000

                                      X1        30.00000            0.000000

                                      X3        0.000000           0.2500000

                                     DM1      0.000000            5.333333

                                     DP1       10.00000            0.000000

                                      X2        15.00000            0.000000

                                      X4        5.000000            0.000000

                                     DM2      0.000000            0.000000

                                     DP2       0.000000            5.333333

                                     DM3       0.000000            8.666667

                                     DP3       0.000000            2.000000

                                     DM4       0.000000            3.083333

                                     DP4       0.000000            0.000000

                                     DP5       0.000000            1.000000

 

按一般方法输入,其结果与方法一相同

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式