I'm using cvxpy to solve an integer programming problem. For feasible solutions, the .solve() method for cvxpy returns in a few tenths of a second. For infeasible solutions, it can take 30+ seconds for cvxpy to return "infeasible". Questions:
1) Is there a way to pass a timeout value to the solve() method? If no, what is the recommended way to call cvxpy from a python program where I don't want to wait indefinitely?
2) Is it typical that cvxpy will take 30+ seconds to return infeasible?
The answer to this question is dependent on the solver you are using. This page has a a summary of options for different solvers.
You can see that CBC (Coin-or branch and cut) has a maximumSeconds
option, but most solvers don't have a similar option.
However, most solvers allow you to specify a maximum number of iterations, which in practice will allow you some control to bound the computational time required for the solver to halt.