I'm using COIN-OR Cbc via its cbc
command line tool and need to abort some computations if they take too long.
I'm aware that I could write a controlling process around cbc to kill it after the timeout expires. I'm also aware that I could use cbc as C++ library. Both seem so be quite cumbersome, I'm looking for a simpler, direct solution.
Is this possible directly via the cbc
command line tool?
If not, is there a simple way using cbc as C++ library? (read an *.lp
file, apply timeout, create *.soln
file)
Yes. Use the -sec
command-line option. The full command line would be:
cbc -sec 10 -import inputfile.lp -solve
This is equivalent to running an interactive session by typing only cbc
on the command line, then entering the following commands:
sec 10
import inputfile.lp
solve