KKT Transform Code Refactor#3881
Merged
blnicho merged 50 commits intoPyomo:mainfrom Apr 29, 2026
Merged
Conversation
Co-authored-by: Bethany Nicholson <blnicho@users.noreply.github.com>
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
…'vars_in_kkt_cons'.
Co-authored-by: John Siirola <jsiirola@users.noreply.github.com>
…mo into kkt-transform need to fix merge conflicts.
jsiirola
approved these changes
Apr 2, 2026
emma58
approved these changes
Apr 27, 2026
Contributor
emma58
left a comment
There was a problem hiding this comment.
Apologies for the much-delayed review. This looks really good! I have a few minor nits, and then one (perhaps more controversial) naming question.
|
|
||
| active_objs[0].deactivate() | ||
|
|
||
| def get_object_from_multiplier(self, model, multiplier_var): |
Contributor
There was a problem hiding this comment.
I would prefer this be named get_constraint_from_multiplier even though it could return a Var if it is a multiplier on bounds. But I'm open to being argued with.
Member
There was a problem hiding this comment.
I have to admit that I would prefer object (for consistency with component_data_objects) or component (for the same reason).
Contributor
There was a problem hiding this comment.
I was afraid you would say that! :P OK, let's leave it then.
| f"The KKT multiplier: {multiplier_var.name}, does not exist on {model.name}." | ||
| ) | ||
|
|
||
| def get_multiplier_from_object(self, model, component): |
Contributor
There was a problem hiding this comment.
Same naming thought as above
Co-authored-by: Emma Johnson <12833636+emma58@users.noreply.github.com>
…trize_wrt' to 'parameterize_wrt' to ensure consistency with rest of Pyomo
This file contains hidden or 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
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 # .
Summary/Motivation:
This PR refactors the KKT transformation code (see PR #3860) to make it more efficient. In the original PR, it was suggested by @jsiirola that the order of operations be reversed to avoid repeated work and the use of unintuitive data structures.
Changes proposed in this PR:
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: