-
Notifications
You must be signed in to change notification settings - Fork 517
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
Add subgraph method to IncidencegraphInterface #3122
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… new error message
Robbybp
changed the title
Incidence subgraph
Add subgraph method to IncidencegraphInterface
Feb 5, 2024
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3122 +/- ##
=======================================
Coverage 88.32% 88.32%
=======================================
Files 832 832
Lines 92483 92492 +9
=======================================
+ Hits 81685 81693 +8
- Misses 10798 10799 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
blnicho
approved these changes
Feb 14, 2024
jsiirola
approved these changes
Feb 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Reduces the number of times we need to walk expression trees (e.g. to compute
AMPLRepn
s) when generating multiple different incidence graphs based on the same model.Summary/Motivation:
Using
IncidenceMethod.ampl_repn
orIncidenceMethod.standard_repn
seems to introduce significant overhead to incidence graph construction. Often, I want to work with several subgraphs based on a single model. For example, the subgraph that only includes equality constraints, or the subgraph on a particular set of variables (a particular block in a block triangularization, for instance). In these cases, constructing several incidence graphs becomes a performance bottleneck due to the effort required to determine variable-constraint incidence (edges in the graph). AnIncidenceGraphInterface.subgraph
method lets us get around this re-construction. Note that the incidence graph's data structures are copied, not modified in-place.Changes proposed in this PR:
IncidenceGraphInterface.subgraph
methodIncidenceGraphInterface
from a tuple of(nz.Graph, list[Var], list[Constraint])
extract_bipartite_subgraph
to use NetworkX'ssubgraph
andrelabel_nodes
methods, instead of re-implementing my own versions of them.Note that this builds on #3069
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: