GAMS likes to display marginals on MIP models. It does this by solving an LP with all integers fixed at their current values. This final solve can be very expensive. Here is an example:
--- 31,617 rows 92,289 columns 276,386 non-zeroes … Root relaxation solution time = 8.08 sec. Nodes Cuts/ 0 0 154.2800 3 154.2800 45818 Iteration log . . . Iteration: 54455 Dual objective = 151.954457 Iteration: 54694 Dual objective = 153.771165 Iteration: 54911 Dual objective = 153.771165 Elapsed time = 188.09 sec. (55000 iterations). Iteration: 55190 Dual objective = 153.771165 Iteration: 55452 Dual objective = 154.280180 Removing perturbation. Fixed MIP status(1): optimal Final LP: time not displayed but estimated at > 188 sec |
So we have approximately:
- Root LP: 8 sec
- B&B: 1 sec
- Final LP: 188 sec
If we are not interested in duals (for most MIP models this is the case), the last step be omitted with an option (SOLVEFINAL=0). That would reduce the total solution time from 200 seconds to 10 seconds.
Only the root time is displayed, so I had to guess the other times.
The last LP solve should use the optimal MIP solution as a hotstart and not start all over again as it obviously does.
ReplyDeleteI think they just leave that up to Cplex: i.e. change Cplex problem type to fixed and resolve.
ReplyDeleteThey should use primal to do that final solve, not dual.
ReplyDeleteAs a GAMS user I think I cannot do that with the current Cplex link. I have passed on the model to the GAMS people so they can have a look.
ReplyDeleteActually there is an undocumented GAMS option to use a option file for the fixed model. I.e. we can use:
ReplyDelete$onecho > cplex.opt
startalg 1
mipsearch 1
*solvefinal 0
fixoptfile fix.opt
$offecho
$onecho > fix.opt
lpmethod 1
$offecho
This solves the final LP very fast.
In the mean time the problem has been passed on to the Cplex people to see if something needs to be done inside Cplex to do this better automatically.