1

当我运行使用 CPLEX 的 .NET 4 应用程序时,我在不同的机器上得到不同的输出。在我的开发机器上,CPLEX 输出一个结果(异常并停留在某个较大的值),而在所有其他机器上,结果正常。

首先,我认为它与操作系统有关,并且由于我的开发机器上同时安装了 Windows 7 x64 和 Windows 8 x64,因此我尝试在这两个系统上运行应用程序。结果是一样的——有问题。

然后我尝试在两台不同的台式机上运行,​​它工作正常。我什至在虚拟机中尝试过,在我的开发机器上使用 Windows 7 来宾,在所有这些情况下,结果都还可以。

如何解决这个问题?我该如何调试正在发生的事情?任何建议都会有所帮助。

附加信息:

  • 我的开发机器是华硕 N73N 笔记本电脑,配备 Intel Core i7-2670QM CPU @ 2.20GHz、4 核、8 个逻辑处理器和 8GB RAM。
  • 使用的 CPLEX:v12.4

这是我的开发机器的错误输出:

IBM ILOG CPLEX Optimization Studio Commercial Edition                         
Tried aggregator 1 time.
MIP Presolve eliminated 125 rows and 0 columns.
MIP Presolve modified 15000 coefficients.
Reduced MIP has 28795 rows, 14520 columns, and 965648 nonzeros.
Reduced MIP has 14520 binaries, 0 generals, 0 SOSs, and 0 indicators.
Probing time =    0.05 sec.
Tried aggregator 1 time.
Presolve time =    1.39 sec.
Found feasible solution after 1.48 sec.  Objective = 4.5736e+016
Probing time =    0.03 sec.
Clique table members: 14520.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time =    2.70 sec.

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

*     0+    0                      4.57357e+016                   1870     ---
*     0+    0                      2.93779e+016                   1870     ---
      0     0  1.54596e+015   811  2.93779e+016  1.54596e+015     1870   94.74%
*     0+    0                      5.78471e+015  1.54596e+015     2258   73.28%
      0     0  1.59388e+015   942  5.78471e+015     Cuts: 377     2258   72.45%
      0     0  1.65120e+015   813  5.78471e+015 ZeroHalf: 216     2590   71.46%
      0     0  1.67178e+015   968  5.78471e+015 ZeroHalf: 285     2857   71.10%
      0     0  1.71285e+015   957  5.78471e+015 ZeroHalf: 123     3241   70.39%
      0     0  1.73687e+015   991  5.78471e+015 ZeroHalf: 148     3642   69.97%
      0     0  1.76181e+015   997  5.78471e+015  ZeroHalf: 50     4048   69.54%
      0     0  1.77762e+015   976  5.78471e+015  ZeroHalf: 23     4344   69.27%
      0     0  1.78664e+015   977  5.78471e+015  ZeroHalf: 22     4601   69.11%
      0     0  1.80055e+015   994  5.78471e+015  ZeroHalf: 75     4943   68.87%
      0     0  1.80615e+015   993  5.78471e+015   ZeroHalf: 9     5143   68.78%
      0     0  1.81464e+015   996  5.78471e+015  ZeroHalf: 33     5440   68.63%
      0     0  1.82294e+015   991  5.78471e+015      Cuts: 27     5765   68.49%
      0     0  1.83208e+015   989  5.78471e+015      Cuts: 18     6104   68.33%
      0     0  1.84944e+015   946  5.78471e+015     Cuts: 182     6698   68.03%
      0     0  1.88828e+015   956  5.78471e+015     Cuts: 269     7432   67.36%
      0     0  1.89984e+015   971  5.78471e+015     Cuts: 118     7822   67.16%
      0     0  1.91068e+015   985  5.78471e+015      Cuts: 45     8155   66.97%
      0     0  1.92274e+015   980  5.78471e+015      Cuts: 40     8597   66.76%
      0     0  1.94969e+015   977  5.78471e+015     Cuts: 121     9295   66.30%
      0     0  1.95749e+015   970  5.78471e+015      Cuts: 69     9682   66.16%
      0     0  1.96689e+015   978  5.78471e+015      Cuts: 42    10093   66.00%
      0     0  1.97224e+015   980  5.78471e+015      Cuts: 30    10392   65.91%
      0     0  1.97649e+015   978  5.78471e+015      Cuts: 13    10622   65.83%
      0     0  1.98557e+015   976  5.78471e+015      Cuts: 50    10876   65.68%
      0     0  1.99259e+015   987  5.78471e+015      Cuts: 46    11183   65.55%
      0     0  2.00116e+015   987  5.78471e+015      Cuts: 77    11494   65.41%
      0     0  2.01149e+015   990  5.78471e+015      Cuts: 37    11921   65.23%
      0     0  2.01969e+015   976  5.78471e+015      Cuts: 60    12286   65.09%
      0     0  2.02492e+015   966  5.78471e+015      Cuts: 43    12578   65.00%
      0     0  2.03316e+015   969  5.78471e+015      Cuts: 84    12881   64.85%
      0     0  2.04175e+015   971  5.78471e+015      Cuts: 52    13174   64.70%
      0     0  2.05273e+015   964  5.78471e+015      Cuts: 68    13649   64.51%
      0     0  2.05591e+015   966  5.78471e+015      Cuts: 23    13902   64.46%
      0     0  2.06170e+015   964  5.78471e+015      Cuts: 43    14235   64.36%
      0     0  2.06574e+015   971  5.78471e+015      Cuts: 46    14481   64.29%
      0     0  2.07500e+015   952  5.78471e+015      Cuts: 47    14890   64.13%
      0     0  2.08393e+015   941  5.78471e+015      Cuts: 53    15280   63.98%
      0     0  2.09065e+015   948  5.78471e+015      Cuts: 36    15601   63.86%
      0     0  2.09803e+015   955  5.78471e+015     Cuts: 104    16015   63.73%
      0     0  2.10316e+015   944  5.78471e+015      Cuts: 63    16384   63.64%
      0     0  2.11460e+015   948  5.78471e+015      Cuts: 76    16846   63.45%
      0     0  2.12942e+015   956  5.78471e+015      Cuts: 97    17366   63.19%
      0     0  2.16151e+015   931  5.78471e+015     Cuts: 327    18262   62.63%
      0     0  2.17502e+015   930  5.78471e+015     Cuts: 120    18714   62.40%
      0     0  2.27173e+015   884  5.78471e+015     Cuts: 385    20411   60.73%
      0     0  2.29553e+015   899  5.78471e+015     Cuts: 134    21117   60.32%
      0     0  2.30977e+015   920  5.78471e+015      Cuts: 71    21621   60.07%
      0     0  2.31979e+015   909  5.78471e+015      Cuts: 38    22064   59.90%
      0     0  2.32293e+015   911  5.78471e+015      Cuts: 33    22333   59.84%
      0     0  2.32804e+015   908  5.78471e+015      Cuts: 60    22682   59.76%
      0     0  2.33324e+015   906  5.78471e+015      Cuts: 43    22991   59.67%
      0     0  2.34725e+015   909  5.78471e+015      Cuts: 22    23332   59.42%
      0     0  2.35327e+015   903  5.78471e+015      Cuts: 72    23571   59.32%
      0     0  2.36485e+015   889  5.78471e+015      Cuts: 61    23938   59.12%
      0     0  2.37310e+015   884  5.78471e+015      Cuts: 45    24319   58.98%
      0     0  2.39039e+015   885  5.78471e+015      Cuts: 79    24958   58.68%
      0     0  2.39677e+015   901  5.78471e+015      Cuts: 56    25186   58.57%
      0     0  2.40149e+015   885  5.78471e+015      Cuts: 41    25442   58.49%
      0     0  2.40325e+015   883  5.78471e+015      Cuts: 60    25617   58.46%
      0     0  2.41812e+015   894  5.78471e+015      Cuts: 84    26070   58.20%
      0     0  2.42607e+015   903  5.78471e+015      Cuts: 68    26474   58.06%
      0     0  2.52725e+015   844  5.78471e+015     Cuts: 524    28147   56.31%
      0     0  2.55516e+015   835  5.78471e+015     Cuts: 196    28727   55.83%
      0     0  3.23302e+015   654  5.78471e+015     Cuts: 889    30777   44.11%
      0     0  3.32795e+015   604  5.78471e+015     Cuts: 337    31390   42.47%
      0     0  3.37780e+015   686  5.78471e+015     Cuts: 212    31791   41.61%
      0     0  3.41202e+015   701  5.78471e+015     Cuts: 121    32148   41.02%
      0     0  3.52260e+015   654  5.78471e+015     Cuts: 398    33114   39.10%
      0     0  3.57604e+015   639  5.78471e+015     Cuts: 244    33613   38.18%
      0     0  3.61288e+015   625  5.78471e+015     Cuts: 235    34098   37.54%
      0     0  3.67035e+015   615  5.78471e+015     Cuts: 163    34491   36.55%
      0     0  3.73087e+015   663  5.78471e+015     Cuts: 157    35105   35.50%
      0     0  3.75834e+015   668  5.78471e+015     Cuts: 144    35530   35.03%
      0     0  3.77753e+015   662  5.78471e+015      Cuts: 93    35899   34.70%
      0     0  3.81446e+015   660  5.78471e+015      Cuts: 82    36310   34.06%
      0     0  3.83284e+015   648  5.78471e+015      Cuts: 76    36608   33.74%
      0     0  3.84779e+015   656  5.78471e+015      Cuts: 58    36845   33.48%
      0     0  3.85941e+015   639  5.78471e+015      Cuts: 67    37084   33.28%
      0     0  3.87033e+015   649  5.78471e+015      Cuts: 40    37284   33.09%
      0     0  3.87967e+015   662  5.78471e+015      Cuts: 32    37422   32.93%
      0     0  3.88305e+015   666  5.78471e+015      Cuts: 24    37577   32.87%
      0     0  3.89084e+015   654  5.78471e+015      Cuts: 59    37771   32.74%
      0     0  3.89489e+015   654  5.78471e+015      Cuts: 38    37968   32.67%
      0     0  3.90160e+015   669  5.78471e+015      Cuts: 55    38172   32.55%
      0     0  3.90440e+015   663  5.78471e+015      Cuts: 40    38329   32.50%
      0     0  3.90794e+015   660  5.78471e+015      Cuts: 27    38492   32.44%
      0     0  3.91249e+015   661  5.78471e+015      Cuts: 31    38662   32.36%
      0     0  3.91569e+015   673  5.78471e+015      Cuts: 32    38814   32.31%
      0     2  3.91569e+015   673  5.78471e+015  3.91569e+015    38814   32.31%
Elapsed real time = 312.08 sec. (tree size =  0.01 MB, solutions = 3)
      1     3  4.19433e+015   728  5.78471e+015  3.91569e+015    41427   32.31%
      2     2        cutoff        5.78471e+015  3.91569e+015    43784   32.31%
      3     3  4.35193e+015   730  5.78471e+015  3.91569e+015    45337   32.31%
      4     2        cutoff        5.78471e+015  3.91569e+015    46000   32.31%
      5     3  4.52240e+015   741  5.78471e+015  3.91569e+015    47554   32.31%
      6     2        cutoff        5.78471e+015  3.91569e+015    49263   32.31%
      7     3  4.66098e+015   799  5.78471e+015  3.91569e+015    51056   32.31%
      8     2        cutoff        5.78471e+015  3.91569e+015    51943   32.31%
      9     3  4.85025e+015   807  5.78471e+015  3.91569e+015    52422   32.31%
     12     2        cutoff        5.78471e+015  3.91569e+015    53363   32.31%
Elapsed real time = 350.88 sec. (tree size =  0.01 MB, solutions = 3)
     15     3  5.59278e+015   896  5.78471e+015  3.91569e+015    54625   32.31%

Clique cuts applied:  1901
Implied bound cuts applied:  160
Zero-half cuts applied:  150

Root node processing (before b&c):
Real time             =  310.11
Parallel b&c, 8 threads:
Real time             =   39.39
Sync time (average)   =    0.00
Wait time (average)   =    0.00
                          -------
Total (root+branch&cut) =  349.50 sec.


inst\instance.txt 00:05:50.9629598        5,78471010310452E+15

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0

这是所有其他机器的正常输出:

IBM ILOG CPLEX Optimization Studio Commercial Edition                         
Tried aggregator 1 time.
MIP Presolve eliminated 129 rows and 0 columns.
MIP Presolve modified 15480 coefficients.
Reduced MIP has 28791 rows, 14520 columns, and 965163 nonzeros.
Reduced MIP has 14520 binaries, 0 generals, 0 SOSs, and 0 indicators.
Probing time =    0.03 sec.
Tried aggregator 1 time.
Presolve time =    1.51 sec.
Found feasible solution after 1.62 sec.  Objective = 5170425.9868
Probing time =    0.05 sec.
Clique table members: 14520.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time =    4.82 sec.

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

*     0+    0                      5170425.9868                   2742     ---
*     0+    0                      2176197.5073                   2742     ---
      0     0   963286.8006  1320  2176197.5073   963286.8006     2742   55.74%
*     0+    0                      1742629.0387   963286.8006     3146   44.72%
      0     0   968918.1899  1292  1742629.0387     Cuts: 180     3146   44.40%
      0     0   972621.9253  1285  1742629.0387  ZeroHalf: 36     3543   44.19%
      0     0   974930.7260  1336  1742629.0387 ZeroHalf: 157     3934   44.05%
      0     0   975330.5044  1344  1742629.0387   ZeroHalf: 9     4042   44.03%
      0     0   976752.3324  1344  1742629.0387  ZeroHalf: 23     4298   43.95%
      0     0   977523.1431  1375  1742629.0387  ZeroHalf: 13     4523   43.91%
      0     0   978030.2843  1358  1742629.0387   ZeroHalf: 7     4732   43.88%
      0     0   978582.8390  1290  1742629.0387      Cuts: 13     4897   43.84%
      0     0   979462.4757  1394  1742629.0387      Cuts: 22     5107   43.79%
      0     0   980081.0140  1361  1742629.0387      Cuts: 16     5256   43.76%
      0     0   986296.0889  1453  1742629.0387     Cuts: 135     6066   43.40%
      0     0   987753.3557  1412  1742629.0387     Cuts: 105     6386   43.32%
      0     0   988885.7034  1442  1742629.0387      Cuts: 57     6694   43.25%
      0     0   989742.4516  1434  1742629.0387      Cuts: 27     6924   43.20%
      0     0   990497.2364  1434  1742629.0387      Cuts: 45     7178   43.16%
*     0+    0                      1402648.1251   990497.2364     7489   29.38%
      0     0   991849.2315  1437  1402648.1251     Cuts: 288     7489   29.29%
      0     0  1243733.1371   593  1402648.1251    Cuts: 2446    12636   11.33%
      0     0  1276887.2546   583  1402648.1251     Cuts: 556    14078    8.97%
      0     0  1296511.1088   701  1402648.1251     Cuts: 600    14813    7.57%
      0     0  1305221.3720   679  1402648.1251     Cuts: 193    15488    6.95%
      0     0  1309747.0795   660  1402648.1251     Cuts: 139    15848    6.62%
      0     0  1318085.1042   725  1402648.1251      Cuts: 43    16281    6.03%
      0     0  1323312.2600   747  1402648.1251      Cuts: 55    16728    5.66%
      0     0  1325171.8791   677  1402648.1251      Cuts: 23    17033    5.52%
      0     0  1326274.8424   704  1402648.1251      Cuts: 19    17265    5.44%
      0     0  1327853.0467   714  1402648.1251      Cuts: 20    17519    5.33%
      0     0  1328078.7180   687  1402648.1251       Cuts: 6    17621    5.32%
      0     0  1328705.5414   702  1402648.1251      Cuts: 18    17768    5.27%
      0     0  1329753.6276   716  1402648.1251      Cuts: 15    17988    5.20%
      0     0  1330728.0832   705  1402648.1251   ZeroHalf: 5    18165    5.13%
      0     0  1331208.9314   707  1402648.1251      Cuts: 15    18322    5.09%
      0     0  1331935.6017   709  1402648.1251   ZeroHalf: 5    18432    5.04%
      0     0  1332438.9391   738  1402648.1251   ZeroHalf: 4    18536    5.01%
      0     0  1332565.6221   712  1402648.1251       Cuts: 3    18578    5.00%
      0     0  1332961.2175   712  1402648.1251   ZeroHalf: 7    18653    4.97%
      0     2  1332962.3523   711  1402648.1251  1332962.3523    18656    4.97%
Elapsed real time = 136.63 sec. (tree size =  0.01 MB, solutions = 4)
      1     3  1355937.1387   819  1402648.1251  1332962.3523    20475    4.97%
      2     2        cutoff        1402648.1251  1332962.3523    20810    4.97%
      3     3  1373864.6210   889  1402648.1251  1332962.3523    21989    4.97%
      5     3  1391805.4913   902  1402648.1251  1332962.3523    22812    4.97%
      6     2        cutoff        1402648.1251  1332962.3523    24410    4.97%
      7     1        cutoff        1402648.1251  1332962.3523    25377    4.97%
      8     0        cutoff        1402648.1251  1332962.3523    26154    4.97%

Clique cuts applied:  2880
Implied bound cuts applied:  73
Zero-half cuts applied:  97

Root node processing (before b&c):
Real time             =  134.80
Parallel b&c, 8 threads:
Real time             =   16.44
Sync time (average)   =    0.00
Wait time (average)   =    0.00
                      -------
Total (root+branch&cut) =  151.24 sec.


inst\instance.txt 00:02:32.8137404        1402648.12514155

0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4

1 回答 1

5

首先,您应该绝对确定您正在解决完全相同的问题。

查看日志,CPLEX 解决的问题似乎有所不同。
例如 presolve 在第一种情况下消除 125 行,在第二种情况下消除 129 行,并在第一种情况下修改 15000 个系数,在第二种情况下修改 15480 个;减少的 MIP 似乎也有所不同:
第一种情况下为 28795 行、14520 列和 965648 个非零值,第二种情况下为 28791 行、14520 列和 965163 个非零值。

我很确定 CPLEX presolve 是完全确定性的并且绝对独立于平台。所以在我看来,由于某种原因,你会产生两个不同的问题。

您可以尝试将问题导出到开发和测试机器上的 LP 文件,然后检查两个文件是否相等(甚至尝试将测试机器上生成的 .LP 文件解决到开发机器上并检查日志)

无论如何,在 IBM 网站上有一个关于“运行再现性”的部分。
他们指出,在不同的硬件架构上,结果实际上可能会发生变化,但最佳解决方案的目标值(当然)保持不变。
但是,我真的怀疑这是你的情况(值太不同),所以我会比较导出的 LP 问题,看看开发和测试机器之间是否有任何区别。

于 2012-11-25T15:40:21.360 回答