Break function on time limit


Is there a way to break a function after a time limit?
I don’t have any access to the function.
FYI (if it helps) I want to break a JuMP solve after some seconds without knowing which solver performs the task.
(the solver is chosen by the user)

The best would be to have try catch block where I can somehow specify the time limit in.


You can use setparameters! to set a time limit on a MathProgBase solver (not all have this implemented, however).


Thanks. If I build the model using JuMP and the solver doesn’t have internalmodel implemented I have no access to the MathProgBase level right? :confused: Seems like GLPK has the setparameters! function but not the internalmodel.


You can call setparameters! on the solver object before you give it to JuMP.


That makes sense and works! Thanks


Don’t know whether this might still be reasonable in general for all function calls.