coin-or / Clp

COIN-OR Linear Programming Solver
Other
396 stars 82 forks source link

Stop CLP after a given amount of time #185

Closed jhmgoossens closed 3 years ago

jhmgoossens commented 3 years ago

I would like to see a way to stop CLP after a given amount of time (clock time or CPU time) has elapsed, and return with the best solution so far and a status indicating that CLP ran out of time. We use Clp in a production environment, with a periodic calibration run that does thousands of similar but independent LPs, usually scheduled for a weekend and taking all available cores (~ 100). Most of the LPs solve in under 2 minutes but several take over half an hour of computation to return a solution. Today I killed one LP that was still running after using over 10 hours of CPU time without returning from the call to CLP Simplex solver. Solving this particular LP with the Barrier method returned a solution in under 5 minutes. Currently the only way I see of implementing this time limit is by imposing an external CPU time limit on the process performing the computation and then detecting that the operating system killed the process when it has used up its time quota. This is not an ideal (portable) solution. Portability is highly desired, since this mission-critical application is over 30 years old and has survived porting across 4 different CPU architectures (currently running on x86-64-bit Linux). It started using CLP as the solver around 8 years ago.

Originally posted by @ralacroix in https://github.com/coin-or/Clp/discussions/168#discussioncomment-577340