@@ -24,17 +24,17 @@ example of using an APPSI solver interface.
24
24
25
25
.. code-block :: python
26
26
27
- >> > import pyomo.environ as pe
27
+ >> > import pyomo.environ as pyo
28
28
>> > from pyomo.contrib import appsi
29
29
>> > import numpy as np
30
30
>> > 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 )
38
38
>> > opt = appsi.solvers.Ipopt()
39
39
>> > timer = HierarchicalTimer()
40
40
>> > for p_val in np.linspace(1 , 10 , 100 ):
@@ -44,6 +44,15 @@ example of using an APPSI solver interface.
44
44
>> > print (res.best_feasible_objective)
45
45
>> > print (timer)
46
46
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
+
47
56
Extra performance improvements can be made if you know exactly what
48
57
changes will be made in your model. In the example above, only
49
58
parameter values are changed, so we can setup the
0 commit comments