coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
117 stars 25 forks source link

How can I specify solver options in Pyomo? #148

Closed damdaepark closed 2 years ago

damdaepark commented 2 years ago

Couldn't find a solution to specify solver options in Pyomo on the documentation.

Does anyone know how to?

chemrgineer commented 2 years ago

You can pass solver options two way. If you specify few options:

from pyomo.environ import *
solver = SolverFactory("SHOT")
solver.options["Subsolver.Ipopt.LinearSolver"] = 4
solver.options["Subsolver.Ipopt.MaxIterations"] = 3e3

Alternative method, you can create option file and pass to solver. solver.options["--opt"]="SHOT.opt" here SHOT.opt file contains your options. All options and explanations is here: https://shotsolver.dev/shot/using-shot/solver-options

damdaepark commented 2 years ago

Thank you @chemrgineer.