Skip to content

Conversation

@Robbybp
Copy link
Contributor

@Robbybp Robbybp commented Mar 28, 2022

Summary/Motivation:

Often when analyzing an incidence matrix/graph, we are interested in the structure of equations and variables, and would like to exclude inequality constraints from the analysis. This can be done right now by passing equality constraints directly to the methods one wants to use, e.g. maximum_matching, but this is cumbersome. This PR adds an include_inequality flag to the constructor that, when False, only considers constraints whose expressions are instances of EqualityExpression.

Opened this PR as it has come to my attention that this might be useful. Marked WIP for now I haven't included a test for this functionality yet.

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.

Copy link
Contributor

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

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

Thanks @Robbybp!

@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #2350 (e844049) into main (30a60e0) will decrease coverage by 1.97%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2350      +/-   ##
==========================================
- Coverage   85.83%   83.85%   -1.98%     
==========================================
  Files         617      617              
  Lines       75949    75952       +3     
==========================================
- Hits        65191    63693    -1498     
- Misses      10758    12259    +1501     
Flag Coverage Δ
linux 79.02% <100.00%> (-3.62%) ⬇️
osx 72.85% <100.00%> (+<0.01%) ⬆️
other 79.19% <100.00%> (-3.63%) ⬇️
win 79.69% <100.00%> (+<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.20% <100.00%> (+0.03%) ⬆️
pyomo/contrib/pynumero/examples/parallel_matvec.py 0.00% <0.00%> (-96.43%) ⬇️
...o/contrib/pynumero/examples/parallel_vector_ops.py 0.00% <0.00%> (-95.84%) ⬇️
pyomo/contrib/pynumero/examples/mumps_example.py 15.00% <0.00%> (-82.50%) ⬇️
pyomo/contrib/pynumero/sparse/mpi_block_matrix.py 0.00% <0.00%> (-81.24%) ⬇️
pyomo/contrib/pynumero/sparse/mpi_block_vector.py 0.00% <0.00%> (-74.97%) ⬇️
pyomo/contrib/benders/benders_cuts.py 18.72% <0.00%> (-69.87%) ⬇️
pyomo/contrib/pynumero/linalg/mumps_interface.py 17.42% <0.00%> (-66.67%) ⬇️
...o/contrib/interior_point/linalg/mumps_interface.py 21.95% <0.00%> (-54.88%) ⬇️
pyomo/contrib/parmest/mpi_utils.py 47.42% <0.00%> (-27.84%) ⬇️
... and 6 more

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 30a60e0...e844049. Read the comment docs.

@Robbybp Robbybp changed the title [WIP] Ignore inequality constraints in IncidenceGraphInterface Ignore inequality constraints in IncidenceGraphInterface Apr 5, 2022
@Robbybp Robbybp changed the title Ignore inequality constraints in IncidenceGraphInterface Add option to ignore inequality constraints in IncidenceGraphInterface Apr 5, 2022
@Robbybp
Copy link
Contributor Author

Robbybp commented Apr 5, 2022

Removed WIP label. Ready for review/merge, assuming tests pass.

Comment on lines +190 to +193
if include_inequality:
self.incidence_matrix = nlp.evaluate_jacobian()
else:
self.incidence_matrix = nlp.evaluate_jacobian_eq()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This changes behavior. Previously the nlp interface would always ignore inequalities, and the model interface would never ignore inequalities. This patch makes the two interfaces consistent (by default, include inequalities) and adds the option to ignore inequalities, which applies to both interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not too worried about this because (a) this is contrib and (b) I'm not aware of anybody using the NLP interface.

@Robbybp Robbybp requested a review from blnicho April 5, 2022 17:28
@jsiirola jsiirola merged commit 26bec25 into Pyomo:main Apr 11, 2022
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.

5 participants