1
$\begingroup$

I am using Pyomo. I got successes in setting up options for Cbc and scip solvers as shown below. But I am unable to figure out how to set up TIME LIMIT and MIP Relative Gap limit for GLPK solver after my researches. Does anyone know how to set those options up for GLPK in Pyomo such that when either of these limits reached, we can still get the best solutions out?

import pyomo.environ as pe

opt = pe.SolverFactory(Pyomo_Solver)

if (Pyomo_Solver == 'cbc'):

 opt.options ={ 'sec':60, 'ratio': 0.0001  }

elif (Pyomo_Solver == 'scip'):

 opt.options ={ 'limits/time':60,  'limits/gap': 0.0001 }

elif (Pyomo_Solver == 'glpk'):

 opt.options ={ ????}

results = opt.solve(model, tee=True, symbolic_solver_labels=True )

$\endgroup$

1 Answer 1

1
$\begingroup$

You can see all the options by running, at a command prompt: glpsol --help

The time limit and mip gap options are tmlim and mipgap respectively.

$\endgroup$
1
  • $\begingroup$ Your answer works. Thank you very much! So the option for GLPK solver is: elif (Pyomo_Solver == 'glpk'): opt.options ={ 'tmlim':60, 'mipgap': 0.0001 } $\endgroup$ Oct 25, 2022 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.