pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

[WIP] Pyomo Model Plot

Open michaelbynum opened this issue 3 years ago • 2 comments

Summary/Motivation:

This PR adds a function to create a Plotly plot of the graph of a pyomo model. It is "interactive" in the sense that you get information about a component if you hover over the corresponding node.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

michaelbynum avatar Jan 12 '22 21:01 michaelbynum

Codecov Report

Merging #2251 (782ea93) into main (dbd4fae) will increase coverage by 0.01%. The diff coverage is 96.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2251      +/-   ##
==========================================
+ Coverage   83.07%   83.09%   +0.01%     
==========================================
  Files         607      608       +1     
  Lines       77018    77100      +82     
==========================================
+ Hits        63984    64063      +79     
- Misses      13034    13037       +3     
Flag Coverage Δ
linux 80.37% <96.34%> (+0.01%) :arrow_up:
osx 70.69% <96.34%> (+0.01%) :arrow_up:
other 80.34% <96.34%> (+0.01%) :arrow_up:
win 77.48% <96.34%> (+0.02%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/util/graph.py 96.34% <96.34%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dbd4fae...782ea93. Read the comment docs.

codecov[bot] avatar Jan 12 '22 23:01 codecov[bot]

There was some discussion at the developers meeting about whether this belongs in pyomo.util or pyomo.contrib. There is some concern about introducing yet another implementation of "Pyomo model --> graph representation" functionality and a strong desire to develop a common solution for this that could be shared by this plotting utility, pyomo.contrib.community_detection, and pyomo.contrib.incidence_analysis.

blnicho avatar Jan 20 '22 22:01 blnicho

Closing this for now. This PR inspired some great discussion around standardizing graph representations of Pyomo models in #2272 but we don't currently have the resources to get those ideas implemented in this PR like we wanted. This plotting functionality has been incorporated in pyomo.contrib.incidence_analysis in PR #2716.

blnicho avatar Feb 13 '23 23:02 blnicho