Skip to content

Commit f55b042

Browse files
authored
Merge pull request #3526 from mrmundt/solver-docs
Update missing future solver interfaces docs
2 parents 2d05305 + c929d64 commit f55b042

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

doc/OnlineDocs/explanation/experimental/solvers.rst

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ with existing interfaces).
5151
* - Gurobi (direct)
5252
- ``gurobi_direct``
5353
- ``gurobi_direct_v2``
54+
* - HiGHS
55+
- ``highs``
56+
- ``highs``
5457

5558
Using the new interfaces through the legacy interface
5659
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

doc/OnlineDocs/reference/topical/appsi/appsi.rst

+17-8
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ example of using an APPSI solver interface.
2424

2525
.. code-block:: python
2626
27-
>>> import pyomo.environ as pe
27+
>>> import pyomo.environ as pyo
2828
>>> from pyomo.contrib import appsi
2929
>>> import numpy as np
3030
>>> from pyomo.common.timing import HierarchicalTimer
31-
>>> m = pe.ConcreteModel()
32-
>>> m.x = pe.Var()
33-
>>> m.y = pe.Var()
34-
>>> m.p = pe.Param(mutable=True)
35-
>>> m.obj = pe.Objective(expr=m.x**2 + m.y**2)
36-
>>> m.c1 = pe.Constraint(expr=m.y >= pe.exp(m.x))
37-
>>> m.c2 = pe.Constraint(expr=m.y >= (m.x - m.p)**2)
31+
>>> m = pyo.ConcreteModel()
32+
>>> m.x = pyo.Var()
33+
>>> m.y = pyo.Var()
34+
>>> m.p = pyo.Param(mutable=True)
35+
>>> m.obj = pyo.Objective(expr=m.x**2 + m.y**2)
36+
>>> m.c1 = pyo.Constraint(expr=m.y >= pyo.exp(m.x))
37+
>>> m.c2 = pyo.Constraint(expr=m.y >= (m.x - m.p)**2)
3838
>>> opt = appsi.solvers.Ipopt()
3939
>>> timer = HierarchicalTimer()
4040
>>> for p_val in np.linspace(1, 10, 100):
@@ -44,6 +44,15 @@ example of using an APPSI solver interface.
4444
>>> print(res.best_feasible_objective)
4545
>>> print(timer)
4646
47+
Alternatively, you can access the APPSI solvers through the classic
48+
``SolverFactory`` using the pattern ``appsi_solvername``.
49+
50+
.. code-block:: python
51+
52+
>>> import pyomo.environ as pyo
53+
>>> opt_ipopt = pyo.SolverFactory('appsi_ipopt')
54+
>>> opt_highs = pyo.SolverFactory('appsi_highs')
55+
4756
Extra performance improvements can be made if you know exactly what
4857
changes will be made in your model. In the example above, only
4958
parameter values are changed, so we can setup the

0 commit comments

Comments
 (0)