More flexible regularization of Newton step#44
Merged
Conversation
…cluding lagrangian hessian regularization for games
lassepe
approved these changes
Aug 15, 2025
Collaborator
lassepe
left a comment
There was a problem hiding this comment.
LGTM modulo minor comments
| mcp.∇F_z!(∇F, x, y, s; θ, ϵ) | ||
| end | ||
|
|
||
| if regularize_linear_solve === :identity |
Collaborator
There was a problem hiding this comment.
This could be folded into a elseif of above
Member
Author
There was a problem hiding this comment.
I considered that, but thought the logic was simpler this way. Basically, for :internal mode you need to regularize ∇F directly when computed in place, and for both :identity and :none you compute it without the extra parameter. Then, for :identity only do you modify it when passing to the linear solver by adding an explicit scaled identity (if ∇F is square).
src/mcp.jl
Outdated
| """ | ||
| struct PrimalDualMCP{T1,T2,T3} | ||
| "A callable `F!(result, x, y, s; θ, ϵ)` which computes the KKT error in-place." | ||
| "A callable `F!(result, x, y, s; θ, ϵ, [η])` to the KKT error in-place." |
Collaborator
There was a problem hiding this comment.
Suggested change
| "A callable `F!(result, x, y, s; θ, ϵ, [η])` to the KKT error in-place." | |
| "A callable `F!(result, x, y, s; θ, ϵ, [η])` to compute the KKT error in-place." |
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.
Adds an additional kwarg in the solver which allows the user to specify how the Newton step computation should be regularized. Currently supports three options:
:none(no regularization):identity(adds scaled identity to the KKT Jacobian):internal(assumes that the Symbolics-generated KKT Jacobian accepts a regularization parameter directly)Also adds an example of
:internalregularization ingame.jlwhere we add a scaled identity only to the blocks of the KKT Jacobian that correspond to the Hessian of each player's Lagrangian wrt its decision variable.Also adds some minimal logic to adjust regularization strength depending upon success/failure of inner loop solves.