Skip to content
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

LD-SDA Documentation #3539

Merged
merged 16 commits into from
Apr 2, 2025
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
58 changes: 58 additions & 0 deletions doc/OnlineDocs/explanation/solvers/gdpopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,63 @@ To use the GDPopt-LBB solver, define your Pyomo GDP model as usual:
>>> print([value(m.y1.indicator_var), value(m.y2.indicator_var)])
[True, False]

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

The GDPopt-LDSDA solver exploits the ordered Boolean variables in the disjunctions to solve the GDP model.
It requires an **exclusive OR (XOR) logical constraint** to ensure that exactly one disjunct is active in each disjunction.
The solver also requires a **starting point** for the discrete variables and allows users to choose between two **direction norms**, `'L2'` and `'Linf'`, to guide the search process.

To use the GDPopt-LDSDA solver, define your Pyomo GDP model as usual:

.. doctest::
:skipif: not baron_available

Required imports
>>> from pyomo.environ import *
>>> from pyomo.gdp import Disjunct, Disjunction

Create a simple model
>>> m = ConcreteModel()

Define sets
>>> I = [1, 2, 3, 4, 5]
>>> J = [1, 2, 3, 4, 5]

Define variables
>>> m.a = Var(bounds=(-0.3, 0.2))
>>> m.b = Var(bounds=(-0.9, -0.5))

Define disjuncts for Y1
>>> m.Y1_disjuncts = Disjunct(I)
>>> for i in I:
... m.Y1_disjuncts[i].y1_constraint = Constraint(expr=m.a == -0.3 + 0.1 * (i - 1))

Define disjuncts for Y2
>>> m.Y2_disjuncts = Disjunct(J)
>>> for j in J:
... m.Y2_disjuncts[j].y2_constraint = Constraint(expr=m.b == -0.9 + 0.1 * (j - 1))

Define disjunctions
>>> m.y1_disjunction = Disjunction(expr=[m.Y1_disjuncts[i] for i in I])
>>> m.y2_disjunction = Disjunction(expr=[m.Y2_disjuncts[j] for j in J])

Logical constraints to enforce exactly one selection
>>> m.Y1_limit = LogicalConstraint(expr=exactly(1, [m.Y1_disjuncts[i].indicator_var for i in I]))
>>> m.Y2_limit = LogicalConstraint(expr=exactly(1, [m.Y2_disjuncts[j].indicator_var for j in J]))

Define objective function
>>> m.obj = Objective(
... expr=4 * m.a**2 - 2.1 * m.a**4 + (1 / 3) * m.a**6 + m.a * m.b - 4 * m.b**2 + 4 * m.b**4,
... sense=minimize
... )

Invoke the GDPopt-LDSDA solver
>>> results = SolverFactory('gdpopt.ldsda').solve(m,
... starting_point=[1,1],
... logical_constraint_list=[m.Y1_limit, m.Y2_limit],
... direction_norm='Linf',
... )
GDPopt implementation and optional arguments
--------------------------------------------

Expand All @@ -204,4 +261,5 @@ GDPopt implementation and optional arguments
~pyomo.contrib.gdpopt.gloa.GDP_GLOA_Solver
~pyomo.contrib.gdpopt.ric.GDP_RIC_Solver
~pyomo.contrib.gdpopt.branch_and_bound.GDP_LBB_Solver
~pyomo.contrib.gdpopt.ldsda.GDP_LDSDA_Solver

Loading