Break function on time limit


#1

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.


#2

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


#3

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.


#4

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


#5

That makes sense and works! Thanks


#6

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