Skip to content

Update missing future solver interfaces docs #3526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/OnlineDocs/explanation/experimental/solvers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ with existing interfaces).
* - Gurobi (direct)
- ``gurobi_direct``
- ``gurobi_direct_v2``
* - HiGHS
- ``highs``
- ``highs``

Using the new interfaces through the legacy interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
25 changes: 17 additions & 8 deletions doc/OnlineDocs/reference/topical/appsi/appsi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ example of using an APPSI solver interface.

.. code-block:: python

>>> import pyomo.environ as pe
>>> import pyomo.environ as pyo
>>> from pyomo.contrib import appsi
>>> import numpy as np
>>> from pyomo.common.timing import HierarchicalTimer
>>> m = pe.ConcreteModel()
>>> m.x = pe.Var()
>>> m.y = pe.Var()
>>> m.p = pe.Param(mutable=True)
>>> m.obj = pe.Objective(expr=m.x**2 + m.y**2)
>>> m.c1 = pe.Constraint(expr=m.y >= pe.exp(m.x))
>>> m.c2 = pe.Constraint(expr=m.y >= (m.x - m.p)**2)
>>> m = pyo.ConcreteModel()
>>> m.x = pyo.Var()
>>> m.y = pyo.Var()
>>> m.p = pyo.Param(mutable=True)
>>> m.obj = pyo.Objective(expr=m.x**2 + m.y**2)
>>> m.c1 = pyo.Constraint(expr=m.y >= pyo.exp(m.x))
>>> m.c2 = pyo.Constraint(expr=m.y >= (m.x - m.p)**2)
>>> opt = appsi.solvers.Ipopt()
>>> timer = HierarchicalTimer()
>>> for p_val in np.linspace(1, 10, 100):
Expand All @@ -44,6 +44,15 @@ example of using an APPSI solver interface.
>>> print(res.best_feasible_objective)
>>> print(timer)

Alternatively, you can access the APPSI solvers through the classic
``SolverFactory`` using the pattern ``appsi_solvername``.

.. code-block:: python

>>> import pyomo.environ as pyo
>>> opt_ipopt = pyo.SolverFactory('appsi_ipopt')
>>> opt_highs = pyo.SolverFactory('appsi_highs')

Extra performance improvements can be made if you know exactly what
changes will be made in your model. In the example above, only
parameter values are changed, so we can setup the
Expand Down
Loading