Skip to content

Commit 00ebb73

Browse files
committed
Renewed the documentation of the LBB example code.
1 parent 99d6efb commit 00ebb73

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

doc/OnlineDocs/explanation/solvers/gdpopt.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,25 @@ To use the GDPopt-LBB solver, define your Pyomo GDP model as usual:
160160
:skipif: not baron_available
161161

162162
Required imports
163-
>>> from pyomo.environ import *
163+
>>> import pyomo.environ as pyo
164164
>>> from pyomo.gdp import Disjunct, Disjunction
165165

166166
Create a simple model
167-
>>> m = ConcreteModel()
168-
>>> m.x1 = Var(bounds = (0,8))
169-
>>> m.x2 = Var(bounds = (0,8))
170-
>>> m.obj = Objective(expr=m.x1 + m.x2, sense=minimize)
167+
>>> m = pyo.ConcreteModel()
168+
>>> m.x1 = pyo.Var(bounds = (0,8))
169+
>>> m.x2 = pyo.Var(bounds = (0,8))
170+
>>> m.obj = pyo.Objective(expr=m.x1 + m.x2, sense=pyo.minimize)
171171
>>> m.y1 = Disjunct()
172172
>>> m.y2 = Disjunct()
173-
>>> m.y1.c1 = Constraint(expr=m.x1 >= 2)
174-
>>> m.y1.c2 = Constraint(expr=m.x2 >= 2)
175-
>>> m.y2.c1 = Constraint(expr=m.x1 >= 3)
176-
>>> m.y2.c2 = Constraint(expr=m.x2 >= 3)
173+
>>> m.y1.c1 = pyo.Constraint(expr=m.x1 >= 2)
174+
>>> m.y1.c2 = pyo.Constraint(expr=m.x2 >= 2)
175+
>>> m.y2.c1 = pyo.Constraint(expr=m.x1 >= 3)
176+
>>> m.y2.c2 = pyo.Constraint(expr=m.x2 >= 3)
177177
>>> m.djn = Disjunction(expr=[m.y1, m.y2])
178178

179179
Invoke the GDPopt-LBB solver
180180

181-
>>> results = SolverFactory('gdpopt.lbb').solve(m)
181+
>>> results = pyo.SolverFactory('gdpopt.lbb').solve(m)
182182
WARNING: 09/06/22: The GDPopt LBB algorithm currently has known issues. Please
183183
use the results with caution and report any bugs!
184184

@@ -188,7 +188,7 @@ To use the GDPopt-LBB solver, define your Pyomo GDP model as usual:
188188
>>> print(results.solver.termination_condition)
189189
optimal
190190

191-
>>> print([value(m.y1.indicator_var), value(m.y2.indicator_var)])
191+
>>> print([pyo.value(m.y1.indicator_var), pyo.value(m.y2.indicator_var)])
192192
[True, False]
193193

194194
Logic-based Discrete-Steepest Descent Algorithm (LD-SDA)

0 commit comments

Comments
 (0)