Stop Julia at certain optimiality gap and return decision variables


I have a MILP problem and I am trying to solve it using CPLEX package through JuMP in Julia Language. However, the problem takes a long time to be solved. Is there a way to stop the program and return decision variables when the optimality gap reaches for example 10%. Thank you.


I haven’t used CPLEX, but I believe you can do:

m = Model(solver=CplexSolver(CPX_PARAM_EPGAP=1e-2))


setsolver(m, CplexSolver(CPX_PARAM_EPGAP=1e-2))


(the above assumes you are using CPLEX through JuMP, which I just realized you didn’t actually say).


Thank you, it works.


Yes, I am using CPLEX through JuMP.
Sorry for not mentioning it.