注:version 11.0.2から Gurobi Interactive Shell の利用は非推奨となりました
前へ:チュートリアル(Gurobi Interactive Shell):簡易的なモデルの変更
もう少し解くことが難しいモデル(glass4.mps)を考えてみましょう。これまでと同様にモデルを読み込んで最適化してみます。
gurobi> m = read("/opt/gurobi1001/linux64/examples/data/glass4")
Read MPS format model from file /opt/gurobi1001/linux64/examples/data/glass4.mps
Reading time = 0.00 seconds
glass4: 396 rows, 322 columns, 1815 nonzeros
gurobi> m.optimize()
Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (linux64)
CPU model: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz, instruction set [SSE2]
Thread count: 4 physical cores, 4 logical processors, using up to 4 threads
Optimize a model with 396 rows, 322 columns and 1815 nonzeros
Model fingerprint: 0x18b19fdf
Variable types: 20 continuous, 302 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 8e+06]
Objective range [1e+00, 1e+06]
Bounds range [1e+00, 8e+02]
RHS range [1e+00, 8e+06]
Presolve removed 4 rows and 5 columns
Presolve time: 0.00s
Presolved: 392 rows, 317 columns, 1815 nonzeros
Variable types: 19 continuous, 298 integer (298 binary)
Found heuristic solution: objective 3.133356e+09
Root relaxation: objective 8.000024e+08, 72 iterations, 0.00 seconds (0.00 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 8.0000e+08 0 72 3.1334e+09 8.0000e+08 74.5% - 0s
H 0 0 2.400019e+09 8.0000e+08 66.7% - 0s
H 0 0 2.220019e+09 8.0000e+08 64.0% - 0s
0 0 8.0000e+08 0 72 2.2200e+09 8.0000e+08 64.0% - 0s
H 0 0 2.200019e+09 8.0000e+08 63.6% - 0s
0 0 8.0000e+08 0 81 2.2000e+09 8.0000e+08 63.6% - 0s
0 0 8.0000e+08 0 77 2.2000e+09 8.0000e+08 63.6% - 0s
0 2 8.0000e+08 0 77 2.2000e+09 8.0000e+08 63.6% - 0s
H 307 609 2.066686e+09 8.0000e+08 61.3% 5.8 0s
H 1126 885 1.950016e+09 8.0000e+08 59.0% 6.0 0s
H 1317 983 1.900015e+09 8.0000e+08 57.9% 5.6 0s
H 1817 1173 1.900015e+09 8.0000e+08 57.9% 5.0 0s
H 2656 1796 1.900015e+09 8.0000e+08 57.9% 4.8 0s
H 8305 6287 1.900015e+09 8.0000e+08 57.9% 3.4 0s
*10878 6870 99 1.808351e+09 8.0000e+08 55.8% 3.3 0s
*12677 7866 62 1.800016e+09 8.0000e+08 55.6% 3.3 1s
*17157 10811 118 1.800015e+09 8.0000e+08 55.6% 3.2 1s
H19145 11166 1.750016e+09 8.0000e+08 54.3% 3.2 1s
H24736 14317 1.700015e+09 8.0000e+08 52.9% 3.2 1s
H24874 14315 1.700015e+09 8.0000e+08 52.9% 3.2 1s
H32097 17197 1.633347e+09 8.0665e+08 50.6% 3.2 2s
H32123 16354 1.600013e+09 8.1873e+08 48.8% 3.2 3s
32158 16378 1.6000e+09 118 110 1.6000e+09 8.4564e+08 47.1% 3.2 5s
H32215 15596 1.533346e+09 8.6063e+08 43.9% 3.3 6s
H32284 14860 1.500013e+09 8.8136e+08 41.2% 3.4 9s
32294 14867 1.2500e+09 46 93 1.5000e+09 8.8136e+08 41.2% 3.4 10s
32446 14975 1.2500e+09 52 95 1.5000e+09 9.0001e+08 40.0% 3.5 15s
Interrupt request received
Cutting planes:
Gomory: 8
Implied bound: 13
Projected implied bound: 1
MIR: 19
Flow cover: 17
Zero half: 1
RLT: 4
Relax-and-lift: 17
Explored 57196 nodes (301282 simplex iterations) in 19.00 seconds (18.42 work units)
Thread count was 4 (of 4 available processors)
Solution count 10: 1.50001e+09 1.53335e+09 1.60001e+09 ... 1.80835e+09
Solve interrupted
Best objective 1.500012666667e+09, best bound 1.000006945369e+09, gap 33.3334%
このモデルは、先ほどの coins モデルよりもかなり難しいことがすぐにわかります。このモデルの最適解は実際には1,200,000,000ですが、その解を見つけるには時間がかかります。今回はモデルを15秒間実行させた後、最適化を中断し(CTRL-Cを押すと、Interrupt request receivedというメッセージとともに中断できます。)、その他のオプションを検討していきましょう。この状態で、m.optimize()と入力すると、中断した時点から実行を再開できます。
次へ: チュートリアル(Gurobi Interactive Shell):パラメータの変更
コメント
0件のコメント
記事コメントは受け付けていません。