Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #496 +/- ##
=======================================
Coverage 54.22% 54.22%
=======================================
Files 1 1
Lines 225 225
=======================================
Hits 122 122
Misses 103 103 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Purpose
For problems with only linear constraints, pySNOPT converted the first row into a nonlinear constraint since supplying only linear constraints did not work (this was added in commit 1a8df3c). This fake row always took the first constraint, in the order that it was added (
jacIndices = [0]). But the bounds and Jacobian rows passed to SNOPT are reordered and come fromgetOrdering(["ne", "ni", "le", "li"]), which puts linear equalities before linear inequalities. If a linear inequality was added before a linear equality, SNOPT's first row got the inequality's value but the equality's bounds.TestSNOPTBug.test_opt_all_linear_inequality_before_equalityreproduces this bug.However, instead of fixing this bug directly, I realized that we probably didn't actually need this fake nonlinear constraint in the first place. SNOPT does in fact allow only linear constraints, you just have to pass
nnCon = 0,nnJac=0, andneGcon = 0. We still need size-1 return from_user_fg_wrapbecause of how f2py callbacks are set up, but it's fine. The separate dummy row for fully unconstrained problems (optProb.dummyConstraint) is unchanged, that one is still required.Expected time until merged
No rush, should probably wait for #495 to be merged first. A follow-on PR will add Lagrange multipliers for the linear constraints (with the previous hacky fix, the first row of linear constraints at least got the Lagrange multipliers).
Type of change
Testing
Checklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable