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

SVD Toolbox for diagnostics #1256

Merged
merged 32 commits into from
Oct 6, 2023
Merged

Conversation

andrewlee94
Copy link
Member

@andrewlee94 andrewlee94 commented Aug 30, 2023

Part of #1222

This is for the November release (v2.3)

Summary/Motivation:

This reworks the current SVD code to be part of the new diagnostics toolbox, and adds a few new methods.

Changes proposed in this PR:

  • New SVDToolbox class
  • Copy and refactor existing SVD code into SVDToolbox
  • New methods for displaying SVD results in standard form, as well as displaying links between variables and constraints
  • Link to SVDToolbox from DiagnosticsToolbox
  • Basic documentation, including placeholder for further discussion of how to interpret SVD results.

Legal Acknowledgement

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

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  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.

@andrewlee94 andrewlee94 self-assigned this Aug 30, 2023
@andrewlee94 andrewlee94 added enhancement New feature or request Priority:Normal Normal Priority Issue or PR core Issues dealing with core modeling components WIP diagnostics labels Aug 30, 2023
@andrewlee94
Copy link
Member Author

@adowling2 If you (or a student) have time to take a look at this, I have done a first pass at cleaning up Degeneracy Hunter and getting it ready to integrate with the new Diagnostics Toolbox. As part of this, I also switched the default solver to SCIP and gave the user the option to select a solver of their choice.

Copy link
Contributor

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

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

Here are some quick comments. Would you like help writing documentation?

idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
@andrewlee94
Copy link
Member Author

andrewlee94 commented Sep 7, 2023

@adowling2 Any help on writing documentation of model diagnostics would be appreciated (both specifically for Degeneracy Hunter and in general). For Degeneracy Hunter, we will definitely need some documentation on how to interpret the output and understanding what it is telling the user.

I also had a general question about the code to make sure I got the implementation right. Using your simple test problem with a duplicated equality constraint (con2 and con5), plus three inequality constraints, I get the following output:

====================================================================================
Irreducible Degenerate Sets

    Irreducible Degenerate Set 0
        nu	Constraint Name
        -1.0	con2

    Irreducible Degenerate Set 1
        nu	Constraint Name
        1.0	con5

====================================================================================

I just wanted to check to make sure that was the expected result in this case - notably the fact that con2 and con5 show up as separate irreducible degenerate sets surprised me initially. My initial assumption (not having used the tool before) was that I would get a single IDS that contained both con2 and con5 (indicating that the combination of these two constraints was degenerate).

@andrewlee94 andrewlee94 mentioned this pull request Sep 7, 2023
31 tasks
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Attention: 123 lines in your changes are missing coverage. Please review.

Comparison is base (2bc4d66) 76.74% compared to head (ca7154a) 76.66%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1256      +/-   ##
==========================================
- Coverage   76.74%   76.66%   -0.08%     
==========================================
  Files         382      382              
  Lines       61280    61615     +335     
  Branches    11310    11382      +72     
==========================================
+ Hits        47028    47237     +209     
- Misses      11815    11909      +94     
- Partials     2437     2469      +32     
Files Coverage Δ
idaes/core/util/model_diagnostics.py 68.99% <65.44%> (-2.87%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

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

Overall, this looks pretty good. Just some minor nits you might consider addressing.

idaes/core/util/model_diagnostics.py Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
idaes/core/util/model_diagnostics.py Outdated Show resolved Hide resolved
@andrewlee94
Copy link
Member Author

@jsiirola I addressed all your comments.

Copy link
Contributor

@adam-a-a adam-a-a left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewlee94 andrewlee94 enabled auto-merge (squash) October 6, 2023 17:59
@andrewlee94 andrewlee94 merged commit aa5212a into IDAES:main Oct 6, 2023
36 of 37 checks passed
@andrewlee94 andrewlee94 deleted the diagnostics_2 branch February 22, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues dealing with core modeling components diagnostics enhancement New feature or request Priority:Normal Normal Priority Issue or PR WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants