Preview capabilities through pyomo.__future__

This module provides a uniform interface for gaining access to future (“preview”) capabilities that are either slightly incompatible with the current official offering, or are still under development with the intent to replace the current offering.

Currently supported __future__ offerings include:

solver_factory([version])

Get (or set) the active implementation of the SolverFactory

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.factory.SolverFactoryClass object ...>

or by importing the “special” name:

>>> from pyomo.__future__ import solver_factory_v3