-
Notifications
You must be signed in to change notification settings - Fork 238
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
Diagnostics tool for ill-posed constraints #1454
Merged
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
37e0fae
Working on cancellation detection
1664593
Merge branch 'main' of https://github.com/IDAES/idaes-pse into cons_m…
4d48741
Fixing typo
a1e91d2
Merge branch 'main' of https://github.com/IDAES/idaes-pse into cons_m…
33a4435
Improving efficiency
747eb7d
More efficiency and testing
707de1e
Reducing duplicated code in tests
3a6400b
Finishing testing
c3e315c
Adding additioanl tests and clean up
2ab55ca
Running pylint
2af9478
Adding constraint walker to diagnostics toolbox
b9d12ea
Merge branch 'main' into cons_mag_diagnostics
162f631
Addressing simple review comments
90d2cd3
Accumulate node rather than str(node)
152b044
Clean up some tests
81c1835
Supporting ranged expressions
849647c
Merge branch 'main' into cons_mag_diagnostics
bff77d5
Apply suggestions from code review
andrewlee94 54e87c4
Merge branch 'main' of https://github.com/IDAES/idaes-pse into cons_m…
11d3f33
Merge branch 'cons_mag_diagnostics' of https://github.com/andrewlee94…
85d1956
Regorganising and fixing pylint issues
d486e85
Fixing false positives for linking constraints
1048b32
Fixing unused variable warning
d10a493
Fixing bug related to external functions with string arguments
00a3434
Merge branch 'main' of https://github.com/IDAES/idaes-pse into cons_m…
d27de22
Merge branch 'old_scaling_bug' into cons_mag_diagnostics
6d6fe2c
Addressing comments
9dbd521
Merge branch 'main' into cons_mag_diagnostics
678caf8
removing debugging prints
47a58f4
Merge branch 'main' of https://github.com/IDAES/idaes-pse into cons_m…
1b5d1d2
Addressing more comments
18a6ff1
Merge branch 'cons_mag_diagnostics' of https://github.com/andrewlee94…
ef2e228
Debugging issue with nested external functions
70636cb
Adding todo
5d5da12
Relax test tolerance due to Windows failures
c173984
Adding catches for string arguments/values
7c03467
Test for nested external functions
21cca53
Fixing bug in walker logic for string arguments to external funcitons
ad6dd99
Merge branch 'main' into cons_mag_diagnostics
a3cde35
Merge branch 'main' into cons_mag_diagnostics
ddc8fb8
Address double counting of constraints
bd331e8
Fixing typo
b3098e1
Bumping Pyomo version
60e71cb
Adding zero tolerance
aebb118
Adding test for zero tolerance
9956286
Fixing typo
8cf3bbe
Logic to skip scaled equality constraints
34a2b58
Merge branch 'main' into cons_mag_diagnostics_2
93ef9d8
Handling mole fraction type constraints
3284d3e
Merge branch 'main' into cons_mag_diagnostics
2d5ec93
Catching negations
5ffec52
Fixing typos
161b15b
Limit of cancelling combinations
7deb640
Fixing typos
86bd61c
Displaying cancelling terms to user
9b13cb1
More detail of mismatches
6577481
Adding hooks and warnings about new config arguments
94fe8c0
Expression aware to string method
360bb39
Moving expression writer to util/misc
1fb2743
Typos and comments
628f445
Using StrEnum
1a4a1ee
Merge branch 'main' into cons_mag_diagnostics
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Regorganising and fixing pylint issues
- Loading branch information
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 is a magic number! Why 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are looking for any combination of terms which cancel, thus the minimum number of terms to consider is 2 (a single term cannot cancel with itself). I can add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this block of code does is go through combinations of terms in an expression first in groups of 2, then in groups of 3, all the way up to groups of
len(values_list)
. So if we have the sum expressiona+b+c+d
, we first iterate through(a, b), (a, c), (a, d), (b, c), (b, d), (c, d)
, then iterate through(a, b, c,), (a, b, d), (a, c, d), (b, c, d)
, then(a,b,c,d)
.However, the number of terms you're checking grows exponentially in expression size. In particular, if
len(values_list) == m
, you'll be checking2 ** m - m -1
terms. I expect that this sort of check will take an extremely long time on any model withExpressions
of any significant length, much less an extreme chonker like eNRTL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably make this more efficient by: