-
Notifications
You must be signed in to change notification settings - Fork 318
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
[Lagrangian] Add regularization term in lagrangian constraints #5299
Open
bakpaul
wants to merge
11
commits into
sofa-framework:master
Choose a base branch
from
bakpaul:25_02_add_regularization_term_in_lagrangian_constraints
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Lagrangian] Add regularization term in lagrangian constraints #5299
bakpaul
wants to merge
11
commits into
sofa-framework:master
from
bakpaul:25_02_add_regularization_term_in_lagrangian_constraints
+318
−6
Conversation
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
…, might need to modify api of MatrixLinearSolver to be able to add it in buildComplianceMatrix
Wow wow wow, nice @bakpaul |
hugtalbot
reviewed
Feb 28, 2025
...rrection/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp
Outdated
Show resolved
Hide resolved
...ion/src/sofa/component/constraint/lagrangian/correction/LinearSolverConstraintCorrection.inl
Outdated
Show resolved
Hide resolved
...tion/src/sofa/component/constraint/lagrangian/correction/PrecomputedConstraintCorrection.inl
Outdated
Show resolved
Hide resolved
...agrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp
Outdated
Show resolved
Hide resolved
...nt/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/LCPConstraintSolver.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Hugo <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
pr: new feature
Implement a new feature
pr: status to review
To notify reviewers to review this pull-request
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.
This PR adds a way to add a regularization term (defined by a scalar$$r$$ ) during the "inversion" of $$\mathbf{W}$$ by the Gauss-Seidel by computing $$\mathbf{W}_{r} = \mathbf{W}+r\mathbf{I}$$ .
This helps in configuration where the constraint set in unsolvable. It might also help for the convergence of the GS. The only thing to keep in mind is that it relaxes the equality meaning that now the constraints are not necessary solved entirely. This will cause issues when using generic collision detection because 0 interpenetration is not guaranteed (requires more skinning). It is better to use volume-based collision definition such as LDI for instance.
This PR adds a data named
regularizationTerm
to two types of objects :ConstraintSolvers
:GenericConstraintSolver
LCPConstraintSolver
ConstraintCorrection
:GenericConstraintCorrection
LinearSolverConstraintCorrection
PrecomputedConstraintCorrection
I made sure that it also works for unbuilt version of both solvers.
It would have been sufficient to add it only for either the constraint solvers or the corrections. But this way we have the possibility to define a global regularization or a local one (see examples)
We could potentially also want to add this parameter to the component
BilateralLagrangianConstraint
and even to theCollisionModels
because we might want to treat differently constraints applied on the same object. This is not a good idea, it comes from the current API that enables multiples ways of defining constraints, if all of the constraints where defined by only one unified pipeline we could do this by only having one version of the data in one level of the API.An example of unsolvable constraint set is given in
BilateralLagrangianConstraint_with_regularization_unsolvable.scn
. The points of one face of a cube are attached to two different set of points:We can see that with the regularization, the solver finds the best compromise (in the middle), without it it never converges and you get the last configuration. When run apart, the regularized version runs at 689.44 FPS whereas the unregularized one runs at 94 FPS.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if