今天我们来看如上图所示的这个错误。这个错误代码为205,和我硕士时的办公室门牌号是一致的。。。不同的代号对应的错误类型可查看科学网的一篇文章,基本全部包含了所有错误(http://blog.sciencenet.cn/blog-2089193-1184256.html)。

这是由于模型中的系数与求解的目标的数量级差别太大所导致的。下图是官方给出的一个解决方案。

After LINGO generates a model, it checks all the nonzero coefficients in the model and computes the ratio of the largest to smallest coefficients.  This ratio is an indicator of how well the model is scaled.  When the ratio gets to be too high, scaling is considered to be poor, and numerical difficulties may result during the solution phase.  If the scaling ratio exceeds the value of the SCALEW parameter, LINGO will display this error message  The default value for SCALEW is 1e9.  Instead of simply increasing the SCALEW setting to eliminate error 205, we strongly suggest that you attempt to rescale the units of your model so as to reduce the largest-to-smallest coefficient ratio.

In some instances, changing the units of measure can be an easy way to improve a model’s scaling.  For instance, suppose we have a model with the following budget constraint in dollar units:

 1000000 * X + 2200000 * Y + 2900000 * Z <= 5000000;

This constraint introduces several large coefficients into the model.   If we rewrote the constraint so that it is in units of millions of dollars, then we would have:

 X + 2.2 * Y + 2.9 * Z <= 5;

The coefficients in this new constraint are much less likely to present a problem.

As part of this error message, LINGO reports the values of the largest and smallest coefficients, as well as where they appear in the model.  This information should help in tracking down the problem.  You may also run the Solver|Generate command to track down other extreme coefficients.  This Generate command displays the full, generated model and specifically lists all the coefficients.

翻译过来是什么意思呢?继续往下看:

LINGO生成模型后,它将检查模型中所有非零系数,并计算最大系数与最小系数的比率。该比率指示模型的缩放程度。当比率变得太高时,缩放比例被认为很差,并且在求解阶段可能会导致数值困难。如果缩放比例超过SCALEW参数的值,则LINGO将显示此错误消息SCALEW的默认值为1e9。我们强烈建议您尝试重新缩放模型的单位,以减小最大/最小系数比,而不是简单地增加SCALEW设置以消除错误205。


在某些情况下,更改度量单位可能是提高模型缩放比例的简便方法。例如,假设我们有一个模型,该模型具有以下以美元为单位的预算约束:


 1000000 * X + 2200000 * Y + 2900000 * Z <= 5000000;


该约束将几个大系数引入模型。如果我们重写约束使其以百万美元为单位,那么我们将有:


 X + 2.2 * Y + 2.9 * Z <= 5;


这个新约束中的系数不太可能出现问题。


作为此错误消息的一部分,LINGO报告最大和最小系数的值以及它们在模型中的出现位置。此信息应有助于跟踪问题。您也可以运行Solver | Generate命令来追踪其他极限系数。该Generate命令显示完整的,已生成的模型,并专门列出所有系数。

更多资料请到QQ群(647185626)讨论和下载相关资料。