Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set MIP termination gap with PySCIPOpt

I cannot figure out how to set a MIP gap threshold such that the solver will terminate when the relative difference between the primal and dual solutions is within some value. I am using PySCIPOpt to interact with SCIP.

I am sure there is a simple way (for example if I were using Gurobi's python interface it is just m.Params.MIPGap = x, where m is the model instance).

Any help is greatly appreciated!

like image 280
kenl Avatar asked Sep 19 '25 14:09

kenl


1 Answers

The MIP gap is a parameter in SCIP (and also PySCIPOpt) and can be set like any other:

m = pyscipopt.Model()
m.setRealParam('limits/gap', 0.1)

For the complete list of available parameters either check the SCIP documentation or run this Python code:

m.writeParams('default.set', onlychanged=False)

To set a paramter you always need to specify the appropriate type in the function call, i.e., Bool, Int, Longint, Real, Char, or String.

like image 66
mattmilten Avatar answered Sep 22 '25 02:09

mattmilten