Drastically reduce iterations for convexify for some matrices #3177
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.
Closes #2973
Convexify required many iterations for some matrices like the one provided in the test case (over 1000). Discovered that this seems to occur when the off-diagonal elements disconnects the matrix being reduced. Such matrices are perhaps not that common but they do pop up in SQP iterations.
The algorithm used to go:
Find the unreduced matrix T2 in blockdiag(T1,T2,T3) where T1 and T2 are diagonal matrices and T2 is tridiagonal.
Now it finds the first connected unreduced matrix block,
e.g. T21 in blockdiag(T1,T21,T22,T23,T3) where T1, T22, and T3 are diagonal matrices and T21 and T23 are tridiagonal.
This change significantly reduces the number of iterations required for matrices with the above structure.