CPU time of first time to reach optimal solution
AnsweredDear community,
I am wondering how to get the CPU time of first time to reach optimal solution. I use python API. Use the example below, in this case, the wall clock time of first found optimal solution is 2s, which is bolded in the last column. (Because that is the time when incumbent obj (bolded in the same line as 2s) first equals to the optimal solution (bolded in the last line in the log)). I need to find out how to identify and return the CPU time corresponding to that bolded '2s'. Is there a way to do that?
Thank you in advance!
Nodes  Current Node  Objective Bounds  Work
Expl Unexpl  Obj Depth IntInf  Incumbent BestBd Gap  It/Node Time
0 0 962.31319 0 153 3556.00000 962.31319 72.9%  0s
H 0 0 3506.2900000 962.31319 72.6%  0s
H 0 0 2027.6000000 962.31319 52.5%  0s
H 0 0 1893.6000000 962.31319 49.2%  0s
0 0 1066.84729 0 187 1893.60000 1066.84729 43.7%  0s
0 0 1067.06641 0 190 1893.60000 1067.06641 43.6%  0s
0 0 1067.07736 0 189 1893.60000 1067.07736 43.6%  0s
H 0 0 1456.8136000 1067.07736 26.8%  0s
0 0 1081.89693 0 207 1456.81360 1081.89693 25.7%  0s
H 0 0 1341.1224000 1081.89693 19.3%  0s
0 0 1082.65752 0 209 1341.12240 1082.65752 19.3%  0s
0 0 1082.71346 0 206 1341.12240 1082.71346 19.3%  0s
0 0 1082.73598 0 203 1341.12240 1082.73598 19.3%  0s
0 0 1089.74294 0 181 1341.12240 1089.74294 18.7%  0s
H 0 0 1161.8648000 1089.74294 6.21%  0s
0 0 1090.82263 0 195 1161.86480 1090.82263 6.11%  0s
0 0 1091.02039 0 201 1161.86480 1091.02039 6.10%  0s
0 0 1091.03091 0 202 1161.86480 1091.03091 6.10%  0s
H 0 0 1140.1892000 1091.03091 4.31%  1s
0 0 1094.63576 0 185 1140.18920 1094.63576 4.00%  1s
H 0 0 1130.1892000 1094.63576 3.15%  1s
0 0 1095.06205 0 173 1130.18920 1095.06205 3.11%  1s
0 0 1095.19604 0 170 1130.18920 1095.19604 3.10%  1s
0 0 1095.21939 0 172 1130.18920 1095.21939 3.09%  1s
0 0 1096.37359 0 160 1130.18920 1096.37359 2.99%  1s
0 0 1096.52099 0 180 1130.18920 1096.52099 2.98%  1s
0 0 1096.56250 0 162 1130.18920 1096.56250 2.98%  1s
0 0 1096.57525 0 162 1130.18920 1096.57525 2.97%  1s
0 0 1097.26951 0 171 1130.18920 1097.26951 2.91%  1s
H 0 0 1123.3582000 1097.26951 2.32%  1s
0 0 1097.37248 0 179 1123.35820 1097.37248 2.31%  1s
0 0 1097.38406 0 194 1123.35820 1097.38406 2.31%  1s
H 0 0 1115.9332000 1097.38406 1.66%  1s
0 0 1097.87372 0 193 1115.93320 1097.87372 1.62%  1s
H 0 0 1115.8804000 1097.87372 1.61%  1s
0 0 1098.00116 0 181 1115.88040 1098.00116 1.60%  1s
0 0 1098.02149 0 179 1115.88040 1098.02149 1.60%  1s
0 0 1098.16704 0 175 1115.88040 1098.16704 1.59%  1s
0 0 1098.23884 0 177 1115.88040 1098.23884 1.58%  1s
0 0 1098.27489 0 194 1115.88040 1098.27489 1.58%  1s
0 0 1098.43485 0 197 1115.88040 1098.43485 1.56%  1s
0 0 1098.43485 0 197 1115.88040 1098.43485 1.56%  1s
0 0 1098.43485 0 82 1115.88040 1098.43485 1.56%  2s
0 0 1111.95588 0 46 1115.88040 1111.95588 0.35%  2s
H 0 0 1115.8324000 1115.83240 0.00%  2s
0 0 1115.83240 0 47 1115.83240 1115.83240 0.00%  2s
Cutting planes:
Gomory: 2
Cover: 3
Implied bound: 10
Clique: 11
MIR: 28
Flow cover: 18
Network: 4
RLT: 3
Relaxandlift: 1
Explored 1 nodes (14413 simplex iterations) in 2.27 seconds
Thread count was 8 (of 8 available processors)
Solution count 10: 1115.83 1115.88 1115.93 ... 1893.6
Optimal solution found (tolerance 1.00e04)
Best objective 1.115832400000e+03, best bound 1.115832400000e+03, gap 0.0000%

Hi,
You can use callbacks to get the information you seek. You could either use the MIPSOL callback which is called whenever a new incumbent solution is found and ask for the RUNTIME. Or you could just use the MESSAGE callback and scan for an 'H' or '*' and then ask for the RUNTIME.
Best regards,
Jaromił0 
Hi Jaromil,
It worked! Thank you so much!
Best wishes
0
Please sign in to leave a comment.
Comments
2 comments