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

[contrib] Add plot method to IncidenceGraphInterface #2716

Merged
merged 6 commits into from
Feb 14, 2023

Conversation

Robbybp
Copy link
Contributor

@Robbybp Robbybp commented Feb 1, 2023

EDIT: Dependence of #2715, #2716, #2723, and #2727

In summary, merging #2727 will incorporate all the others, but they are broken up to be easier to review.

Summary/Motivation:

@michaelbynum wrote a nice method for plotting the incidence graph of a Pyomo model in #2251, so I shamelessly stole it and added it as a method on IncidenceGraphInterface.

Changes proposed in this PR:

  • add plot method to IncidenceGraphInterface

Note that this PR depends on #2715.

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.

@mrmundt
Copy link
Contributor

mrmundt commented Feb 2, 2023

@Robbybp - Does this build on/include #2715 ?

EDIT: Ignore me - you put that in the comments. That being said, I'm going to wait to review this until someone else chimes in on #2715.

@Robbybp Robbybp changed the title [contrib] Add plot method to IncidenceGraphInterface [WIP][contrib] Add plot method to IncidenceGraphInterface Feb 3, 2023
@Robbybp
Copy link
Contributor Author

Robbybp commented Feb 3, 2023

Marking as WIP until #2715 is merged.

@Robbybp Robbybp changed the title [WIP][contrib] Add plot method to IncidenceGraphInterface [contrib] Add plot method to IncidenceGraphInterface Feb 13, 2023
@blnicho blnicho mentioned this pull request Feb 13, 2023
Comment on lines +586 to +588
def plot(self, variables=None, constraints=None, title=None, show=True):
"""Plot the bipartite incidence graph of variables and constraints
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoop!

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Base: 87.05% // Head: 86.99% // Decreases project coverage by -0.06% ⚠️

Coverage data is based on head (4763aa4) compared to base (48cafd2).
Patch coverage: 97.77% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2716      +/-   ##
==========================================
- Coverage   87.05%   86.99%   -0.06%     
==========================================
  Files         771      771              
  Lines       86257    86301      +44     
==========================================
- Hits        75091    75080      -11     
- Misses      11166    11221      +55     
Flag Coverage Δ
linux 84.16% <97.77%> (+<0.01%) ⬆️
osx 73.63% <97.77%> (+0.01%) ⬆️
other 84.34% <97.77%> (+<0.01%) ⬆️
win 81.52% <97.77%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
pyomo/contrib/incidence_analysis/interface.py 98.23% <97.77%> (-0.10%) ⬇️
pyomo/util/subsystems.py 89.13% <0.00%> (-8.70%) ⬇️
...ontrib/appsi/utils/collect_vars_and_named_exprs.py 93.75% <0.00%> (-6.25%) ⬇️
pyomo/core/base/external.py 95.43% <0.00%> (-3.16%) ⬇️
pyomo/contrib/appsi/writers/nl_writer.py 84.39% <0.00%> (-2.32%) ⬇️
pyomo/repn/plugins/ampl/ampl_.py 81.40% <0.00%> (-1.86%) ⬇️
pyomo/core/expr/compare.py 96.52% <0.00%> (-1.74%) ⬇️
pyomo/contrib/appsi/solvers/ipopt.py 88.51% <0.00%> (-0.34%) ⬇️
pyomo/repn/plugins/nl_writer.py 93.60% <0.00%> (-0.32%) ⬇️
pyomo/contrib/appsi/base.py 84.94% <0.00%> (-0.26%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mrmundt mrmundt merged commit e49b973 into Pyomo:main Feb 14, 2023
@Robbybp Robbybp deleted the igraph-plot branch February 14, 2023 15:46
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.

6 participants