solver_factory

(function from pyomo.future)

pyomo.future.solver_factory(version=None)[source]

Get (or set) the active implementation of the SolverFactory

This allows users to query / set the current implementation of the SolverFactory that should be used throughout Pyomo. Valid options are:

  • 1: the original Pyomo SolverFactory

  • 2: the SolverFactory from APPSI

  • 3: the SolverFactory from pyomo.contrib.solver

The current active version can be obtained by calling the method with no arguments

>>> from pyomo.__future__ import solver_factory
>>> solver_factory()
1

The active factory can be set either by passing the appropriate version to this function:

>>> solver_factory(3)
<pyomo.contrib.solver.common.factory.SolverFactoryClass object ...>

or by importing the “special” name:

>>> from pyomo.__future__ import solver_factory_v3