Skip to content

Conversation

@Robbybp
Copy link
Collaborator

@Robbybp Robbybp commented Oct 31, 2025

When exploring a new model, I like doing a limited-depth BFS starting from the variables, constraints, or objective that I care about. This PR adds methods for a limited-depth BFS. Here's an example:

import PGLib
import PowerModels
import MathProgIncidence as MPIN
import JuMP
data = PGLib.pglib("14")
pm = PowerModels.instantiate_model(data, PowerModels.ACPPowerModel, PowerModels.build_opf)
tree = MPIN.limited_bfs(JuMP.objective_function(pm.model); depth = 2, include_inequality = true)
println(tree)
2326.9494 0_pg[2] + 792.0951 0_pg[1]
├ 0_pg[2]
│ ├ -0_pg[2] + 0_p[(5, 2, 5)] + 0_p[(3, 2, 3)] + 0_p[(4, 2, 4)] + 0_p[(1, 2, 1)] = -0.217
│ ├ 0_pg[2] ≥ 0
│ └ 0_pg[2] ≤ 0.59
└ 0_pg[1]
│ ├ -0_pg[1] + 0_p[(1, 1, 2)] + 0_p[(2, 1, 5)] = 0
│ ├ 0_pg[1] ≥ 0
│ └ 0_pg[1] ≤ 3.4

TODO

  • Tests
  • Maybe slightly better printing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant