ywf641122 发表于 2005-7-5 23:48

用LINDO、LINGO、excel计算同一题目结果不同

<P ><B>例1.(选自《运筹学基础》P54.汽油混合问题,线性规划问题)<p></p></B></P>
<P ><FONT face=宋体>一种汽油的特性可用两个指标描述:其点火性用</FONT>“<FONT face=宋体>辛烷数</FONT>”<FONT face=宋体>描述,其挥发性用</FONT>“<FONT face=宋体>蒸汽压力</FONT>”<FONT face=宋体>描述。某炼油厂有四种标准汽油,设其标号分别为1,2,3,4,其特性及库存量列于下表1中,将上述标准汽油适量混合,可得两种飞机汽油,某标号为1,2,这两种飞机汽油的性能指标及产量需求列于表2中。<p></p></FONT></P>
<P ><FONT face=宋体>问应如何根据库存情况适量混合各种标准汽油,使既满足飞机汽油的性能指标,而产量又为最高。<p></p></FONT></P>
<P  align=center><FONT face=宋体>表1<p></p></FONT></P>
<TABLE  cellSpacing=0 cellPadding=0 width=546 border=0>

<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>标准汽油<p></p></FONT></P></TD>
<TD  width=106>
<P ><FONT face=宋体>辛烷数</FONT></P></TD>
<TD  vAlign=top width=32>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>蒸汽压力(g/cm^2)</FONT></P></TD>
<TD  width=136>
<P ><FONT face=宋体>库存量</FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>1 </FONT></P></TD>
<TD  width=106>
<P ><FONT face=宋体>107.5</FONT></P></TD>
<TD  vAlign=top width=32>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>7.11*10^(-2) <p></p></FONT></P></TD>
<TD  width=136>
<P ><FONT face=宋体>380000 </FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>2 </FONT></P></TD>
<TD  width=106>
<P ><FONT face=宋体>93.0</FONT></P></TD>
<TD  vAlign=top width=32>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>11.38*10^(-2) <p></p></FONT></P></TD>
<TD  width=136>
<P ><FONT face=宋体>262200 </FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>3 </FONT></P></TD>
<TD  width=106>
<P ><FONT face=宋体>87.0</FONT></P></TD>
<TD  vAlign=top width=32>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>5.69*10^(-2) <p></p></FONT></P></TD>
<TD  width=136>
<P ><FONT face=宋体>408100 </FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>4 </FONT></P></TD>
<TD  width=106>
<P ><FONT face=宋体>108.0</FONT></P></TD>
<TD  vAlign=top width=32>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>28.45*10^(-2) <p></p></FONT></P></TD>
<TD  width=136>
<P ><FONT face=宋体>130100 </FONT></P></TD></TR></TABLE>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>(1 g/cm^2=98Pa) <p></p></FONT></P>
<P ><FONT face=宋体>表2<p></p></FONT></P>
<TABLE  cellSpacing=0 cellPadding=0 width=547 border=0>

<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>飞机汽油<p></p></FONT></P></TD>
<TD  width=102>
<P ><FONT face=宋体>辛烷数</FONT></P></TD>
<TD  vAlign=top width=36>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>蒸汽压力(g/cm^2)</FONT></P></TD>
<TD  width=137>
<P ><FONT face=宋体>产量需求(L)</FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>1 </FONT></P></TD>
<TD  width=102>
<P ><FONT face=宋体>&gt;=91</FONT></P></TD>
<TD  vAlign=top width=36>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>&lt;=9.96*10^(-2) <p></p></FONT></P></TD>
<TD  width=137>
<P ><FONT face=宋体>越多越好</FONT></P></TD></TR>
<TR >
<TD  width=98>
<P  align=center><FONT face=宋体>2 </FONT></P></TD>
<TD  width=102>
<P ><FONT face=宋体>&gt;=100</FONT></P></TD>
<TD  vAlign=top width=36>
<P ><FONT face=宋体> <p></p></FONT></P></TD>
<TD  width=174>
<P ><FONT face=宋体>&lt;=9.96*10^(-2) <p></p></FONT></P></TD>
<TD  width=137>
<P ><FONT face=宋体>&gt;=250000</FONT></P></TD></TR></TABLE>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>建模过程略(详见《运筹学基础》P54</FONT>—<FONT face=宋体>55)<p></p></FONT></P>
<P ><FONT face=宋体>目标函数:max z=x1+x2+x3+x4   <p></p></FONT></P>
<P ><FONT face=宋体>约束条件:x5+x6+x7+x8&gt;=250000 <p></p></FONT></P>
<P ><FONT face=宋体>x1+x5&lt;=380000 <p></p></FONT></P>
<P ><FONT face=宋体>x2+x6&lt;=265200 <p></p></FONT></P>
<P ><FONT face=宋体>x3+x7&lt;=408100<p></p></FONT></P>
<P ><FONT face=宋体>x4+x8&lt;=130100 <p></p></FONT></P>
<P ><FONT face=宋体>2.85x1-1.42x2+4.27x3-18.49x4&gt;=0 <p></p></FONT></P>
<P ><FONT face=宋体>2.85x5-1.42x6+4.27x7-18.49x8&gt;=0 <p></p></FONT></P>
<P ><FONT face=宋体 size=3>16.5x1+2.0x2-4.0x3+17x4&gt;=0 </FONT></P>
<P ><FONT face=宋体>7.5x5-7.0x6-13.0x7+8.0x8&gt;=0 <p></p></FONT></P>
<P ><FONT face=宋体>xj&gt;=0(j=1,2...,8)  <p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><B>用LINDO6.1<A>的运算结果:</A><p></p></B></P>
<P ><FONT face=宋体>LP OPTIMUM FOUND AT STEP      6<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>        OBJECTIVE FUNCTION VALUE<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>        1)      933400.0<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>  VARIABLE        VALUE          REDUCED COST<p></p></FONT></P>
<P ><FONT face=宋体>        X1    161351.734375          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X2    265200.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X3    408100.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X4     98748.265625          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X5    218648.265625          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X6         0.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X7         0.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        X8     31351.734375          0.000000<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>       ROW   SLACK OR SURPLUS     DUAL PRICES<p></p></FONT></P>
<P ><FONT face=宋体>        2)         0.000000         -1.000000<p></p></FONT></P>
<P ><FONT face=宋体>        3)         0.000000          1.000000<p></p></FONT></P>
<P ><FONT face=宋体>        4)         0.000000          1.000000<p></p></FONT></P>
<P ><FONT face=宋体>        5)         0.000000          1.000000<p></p></FONT></P>
<P ><FONT face=宋体>        6)         0.000000          1.000000<p></p></FONT></P>
<P ><FONT face=宋体>        7)         0.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        8)     43454.000000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>        9)   3239024.250000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体>       10)   1890675.875000          0.000000<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体> NO. ITERATIONS=       6<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体> RANGES IN WHICH THE BASIS IS UNCHANGED:<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>                           OBJ COEFFICIENT RANGES<p></p></FONT></P>
<P ><FONT face=宋体> VARIABLE         CURRENT        ALLOWABLE        ALLOWABLE<p></p></FONT></P>
<P ><FONT face=宋体>                   COEF          INCREASE         DECREASE<p></p></FONT></P>
<P ><FONT face=宋体>       X1        1.000000         0.000000         1.154137<p></p></FONT></P>
<P ><FONT face=宋体>       X2        1.000000         INFINITY         0.000000<p></p></FONT></P>
<P ><FONT face=宋体>       X3        1.000000         INFINITY         0.000000<p></p></FONT></P>
<P ><FONT face=宋体>       X4        1.000000         0.000000         0.000000<p></p></FONT></P>
<P ><FONT face=宋体>       X5        0.000000         1.154137         0.000000<p></p></FONT></P>
<P ><FONT face=宋体>       X6        0.000000         0.000000         INFINITY<p></p></FONT></P>
<P ><FONT face=宋体>       X7        0.000000         0.000000         INFINITY<p></p></FONT></P>
<P ><FONT face=宋体>       X8        0.000000         0.000000         0.000000<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><FONT face=宋体>                           RIGHTHAND SIDE RANGES<p></p></FONT></P>
<P ><FONT face=宋体>      ROW         CURRENT        ALLOWABLE        ALLOWABLE<p></p></FONT></P>
<P ><FONT face=宋体>                    RHS          INCREASE         DECREASE<p></p></FONT></P>
<P ><FONT face=宋体>        2   250000.000000    186222.062500    234752.984375<p></p></FONT></P>
<P ><FONT face=宋体>        3   380000.000000    234752.984375     15247.017578<p></p></FONT></P>
<P ><FONT face=宋体>        4   265200.000000     30601.410156    265200.000000<p></p></FONT></P>
<P ><FONT face=宋体>        5   408100.000000    156685.250000     10176.581055<p></p></FONT></P>
<P ><FONT face=宋体>        6   130100.000000      2350.135254     36184.207031<p></p></FONT></P>
<P ><FONT face=宋体>        7        0.000000     43454.000000    669046.000000<p></p></FONT></P>
<P ><FONT face=宋体>        8        0.000000     43454.000000         INFINITY<p></p></FONT></P>
<P ><FONT face=宋体>        9        0.000000   3239024.250000         INFINITY<p></p></FONT></P>
<P ><FONT face=宋体>10        0.000000   1890675.875000         INFINITY<p></p></FONT></P>
<P ><FONT face=宋体> <p></p></FONT></P>
<P ><B>用LINGO8.0的运算结果:<p></p></B></P>
<P  align=left>Global optimal solution found at iteration:             8<p></p></P>
<P  align=left>  Objective value:                                 933400.0<p></p></P>
<P  align=left> <p></p></P>
<P  align=left> <p></p></P>
<P  align=left>                       Variable           Value        Reduced Cost<p></p></P>
<P  align=left>                             X1        264937.9            0.000000<p></p></P>
<P  align=left>                             X2        135702.1            0.000000<p></p></P>
<P  align=left>                             X3        408100.0            0.000000<p></p></P>
<P  align=left>                             X4        124660.0            0.000000<p></p></P>
<P  align=left>                             X5        115062.1            0.000000<p></p></P>
<P  align=left>                             X6        129497.9            0.000000<p></p></P>
<P  align=left>                             X7        0.000000            0.000000<p></p></P>
<P  align=left>                             X8        5440.011            0.000000<p></p></P>
<P  align=left> <p></p></P>
<P  align=left>                            Row    Slack or Surplus      Dual Price<p></p></P>
<P  align=left>                              1        933400.0            1.000000<p></p></P>
<P  align=left>                              2        0.000000           -1.000000<p></p></P>
<P  align=left>                              3        0.000000            1.000000<p></p></P>
<P  align=left>                              4        0.000000            1.000000<p></p></P>
<P  align=left>                              5        0.000000            1.000000<p></p></P>
<P  align=left>                              6        0.000000            1.000000<p></p></P>
<P  align=left>                              7        0.000000            0.000000<p></p></P>
<P  align=left>                              8        43454.00            0.000000<p></p></P>
<P  align=left>                              9        5129700.            0.000000<p></p></P>
<P  align=left>                             10        0.000000            0.000000<p></p></P>
<P  align=left> <p></p></P>
<P  align=left><B>用excel的</B><B>运算结果:</B><p></p></P>
<TABLE  cellSpacing=0 cellPadding=0 border=1>

<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x1<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>264937.9423<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件1<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>250000<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x2<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>135702.0686<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件2<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>380000<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x3<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>408100<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件3<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>265200<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x4<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>124659.9891<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P >目标函数<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>933400<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件4<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>408100<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x5<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>115062.0577<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件5<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>130100<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x6<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>129497.9314<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件6<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>0<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x7<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>0<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件7<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>43454<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman">x8<p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>5440.010913<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件8<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>5129700<p></p></P></TD></TR>
<TR>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P ><FONT face="Times New Roman"> <p></p></FONT></P></TD>
<TD  vAlign=bottom width=95>
<P >约束条件9<p></p></P></TD>
<TD  vAlign=bottom width=95>
<P  align=right>-1.45519E-10<p></p></P></TD></TR></TABLE>
<P ><FONT face=宋体> <p></p></FONT></P>
<P >以上可以看出用三个软件计算的目标函数值相同,即<FONT face="Times New Roman">z=933400</FONT>。</P>
<P >可变函数值<FONT face="Times New Roman">x<SUB>j</SUB>(j =1,2...,8),LINDO6.1与LINGO8.0和excel的结果不同,LINGO8.0和excel的结果相同。<p></p></FONT></P>
<P ><FONT face="Times New Roman">由此可见,此题至少有二个最优解。</FONT></P>
<P ><FONT face="Times New Roman"> <p></p></FONT></P>
<P ><FONT face="Times New Roman"> <p></p></FONT></P>

damutou 发表于 2005-7-7 00:07

<P>嗯. 应该是这样.</P>

neuzq 发表于 2005-7-7 08:37

<P>楼主您好!能否将您的lindo和lingo软件给我传一下?谢谢!</P>
<P>email:neu_zq@126.com</P>

wintoper 发表于 2006-5-5 20:47

既然结果有出入,那应该用哪个结论呢??

hy86 发表于 2007-1-12 01:22

madio 发表于 2007-8-19 09:54

lindo似乎没有找到全局最优解就停止了!可能是初始点的选择不同造成的!

lzh0601 发表于 2008-4-19 13:30

是精度的问题么?

william689 发表于 2008-7-30 08:37

“<strong>用excel的运算结果</strong>” 是用的 What'sBest!吗?

minedoc 发表于 2009-9-5 18:15

是不是lingo和excel的算法是一样的,求解的结果也就是一样的?

minedoc 发表于 2009-9-5 18:16

是不是lingo和excel的算法是一样的,求解的结果也就是一样的?
页: [1] 2
查看完整版本: 用LINDO、LINGO、excel计算同一题目结果不同