如何使CBC在有时间限制时返回最佳方案?(Pyomo)

问题描述 投票:0回答:1

我试图在Pyomo上使用CBC(v2.10.3)来解决一个整数线性问题。

在执行求解器时,我目前设置了600s的时间限制。

opt = SolverFactory ("cbc")

opt.options['seconds'] =600

在这个时间限制内,求解器能够找到多个可行的解。然而,当它在600s结束时超时时,它没有返回找到的最佳整数解。相反,它返回一个非整数解。

有什么方法可以在pyomo上使用CBC在时间限制结束时返回最佳整数解?

(我知道可以设置一个优化间隙。但是,最好是在给定的时间内求解,然后返回找到的最佳解。)

Cbc0010I After 144000 nodes, 17010 on tree, 51.908959 best solution, best possible 5.2447218 (566.79 seconds)
Cbc0010I After 145000 nodes, 16985 on tree, 51.908959 best solution, best possible 5.2447218 (568.59 seconds)
Cbc0010I After 146000 nodes, 17412 on tree, 51.908959 best solution, best possible 5.2447218 (576.34 seconds)
Cbc0010I After 147000 nodes, 17433 on tree, 51.908959 best solution, best possible 5.2447218 (578.44 seconds)
Cbc0010I After 148000 nodes, 17486 on tree, 51.908959 best solution, best possible 5.2447218 (580.85 seconds)
Cbc0010I After 149000 nodes, 17542 on tree, 51.908959 best solution, best possible 5.2447218 (583.95 seconds)
Cbc0010I After 150000 nodes, 17983 on tree, 51.908959 best solution, best possible 5.2447218 (592.30 seconds)
Cbc0010I After 151000 nodes, 18070 on tree, 51.908959 best solution, best possible 5.2447218 (595.20 seconds)
Cbc0010I After 152000 nodes, 18138 on tree, 51.908959 best solution, best possible 5.2447218 (599.62 seconds)
Cbc0020I Exiting on maximum time
Cbc0005I Partial search - best objective 51.908959 (best possible 5.2447218), took 2633537 iterations and 152193 nodes (600.40 seconds)
Cbc0032I Strong branching done 27294 times (118365 iterations), fathomed 967 nodes and fixed 3958 variables
Cbc0035I Maximum depth 321, 459 variables fixed on reduced cost
0  Obj 3.5097934 Primal inf 30287.686 (125) Dual inf 3.9849334e+15 (82)
Stopped - objective value 4.7188173e+14
Cuts at root node changed objective from 5.22475 to 5.24432
Probing was tried 187648 times and created 142527 cuts of which 0 were active after adding rounds of cuts (35.562 seconds)
Gomory was tried 89556 times and created 384764 cuts of which 0 were active after adding rounds of cuts (40.036 seconds)
Knapsack was tried 361 times and created 4 cuts of which 0 were active after adding rounds of cuts (0.233 seconds)
Clique was tried 361 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.001 seconds)
MixedIntegerRounding2 was tried 89572 times and created 84177 cuts of which 0 were active after adding rounds of cuts (33.927 seconds)
FlowCover was tried 361 times and created 14 cuts of which 0 were active after adding rounds of cuts (0.473 seconds)
TwoMirCuts was tried 89556 times and created 342658 cuts of which 0 were active after adding rounds of cuts (51.857 seconds)
ZeroHalf was tried 361 times and created 136 cuts of which 0 were active after adding rounds of cuts (0.365 seconds)

Result - Stopped on time limit

Objective value:                100000000000000007629769841091887003294964970946560.00000000
Lower bound:                    5.245
Gap:                            19066788138679049496143571255167978698885048565760.00
Enumerated nodes:               152193
Total iterations:               2633537
Time (CPU seconds):             600.48
Time (Wallclock seconds):       600.48

Total time (CPU seconds):       600.50   (Wallclock seconds):       600.51

谢谢您的帮助

python optimization pyomo coin-or-cbc coin-or
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.