coin-or / Cbc

COIN-OR Branch-and-Cut solver
Other
806 stars 115 forks source link

Define absolute threshold value to stop search prematurely if objective value <= threshold value? #416

Open maks-io opened 3 years ago

maks-io commented 3 years ago

I am primarily using the cbc solver via the command line interface and was wondering if there is any easy way to set an "upper bound" for the objective value (minimization problem), to prematurely stop the search - similar to the timeout. For huge problems I'd like to be able to tell the solver to either stop after 10 seconds OR as soon as the objective value is <= 5. Is it possible to set an absolute numeric value for this?

jjhforrest commented 3 years ago

Markus,

The best way is to put a modified driver into the examples directory and compile with make DRIVER=stopafter. When I put an example in xxx/Cbc/master/examples, I have to add a bit to the Makefile (as documented in that).

The attached stopafter.cpp accepts input file, stop time and value as first three parameters. Not trying very hard I used something like -

stopafter ~/miplib3/misc07 200 3000 -solve -solution $ -quit

to test.

I presumed you wanted a solution, so it only stops if there is a solution. Obviously you can now fine tune to gte more control.

John Forrest On 21/06/2021 22:52, Markus Kurzmann wrote:

I am primarily using the cbc solver via the command line interface and was wondering if there is any easy way to set an "upper bound" for the objective value (minimization problem), to prematurely stop the search - similar to the timeout. For huge problems I'd like to be able to tell the solver to either stop after 10 seconds OR as soon as the objective value is <= 5. Is it possible to set an absolute numeric value for this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/coin-or/Cbc/issues/416, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWJYHBZKZEWP5GTPNUUDRLTT6YATANCNFSM47CNMZSQ.

maks-io commented 3 years ago

Hi John,

first of all let me say I am not only sorry, but also embarrassed that i only saw your reply now, especially because you replied so quickly.

Your suggestion seems like it will solve my problem, i unfortunately don't see the attached file though, the one you are talking about in your reply. I am aware that you answered via email functionality - but also my email does not show any attachment. Could you maybe add it again? Would love to understand it in more detail.

Also, one further question: any chance the suggestion can make it into the next ready-made release? I am installing coinor-cbc via apt on my debian machine and I am simply using the command line tool as-is... would be nice if that feature would be supported natively (in case you think it's a useful addition for other users as well).

Looking forward to your reply!

Maks