-
Notifications
You must be signed in to change notification settings - Fork 340
[BuiltConstraintSolver] Add SVD based regularization strategy #5722
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
base: master
Are you sure you want to change the base?
[BuiltConstraintSolver] Add SVD based regularization strategy #5722
Conversation
…info in GenericCosntraintSolver data that are dependent on the method type. Need to find a way of setting the solving method by adding a component in the scene.
…ritance. Now the constraintProblem is only a container
… still being used
…_constraint_solver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments and suggestions for this very useful PR
| { | ||
| if (regularization>std::numeric_limits<SReal>::epsilon()) | ||
| { | ||
| auto * FullW = dynamic_cast<sofa::linearalgebra::LPtrFullMatrix<SReal> * >(&W); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this cast is ensured by how the ComplianceWrapper sets the matrix type in BuiltConstraintSolver. Still, you could add a check for nullptr if anything changes in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do !
| int nullSpaceBegin = -1; | ||
| for(size_t i=0; i<problemSize; i++) | ||
| { | ||
| if (fabs(svd.singularValues()(i)) < fabs(svd.singularValues()(0))/100.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to add the 1% criterion as a parameter so that the user can limit/expand the filter.
In a more complex problem, wouldn't it be possible that constraint feasibility is not so clearly separated and you end up with over-regularization. Or on the contrary being too strict with the criterion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is highly probable. But in that case, if no singular value is smaller than the rest, then all the problem should be regularized in my mind.
On the parameter side yes, I also wanted to do that. But I dislike adding new parameters that only apply if another parameter is true. LEt's discuss this in the sofa-dev-meeting
|
[ci-build][with-all-tests] |
Based on #5666
This PR adds a regularization strategy that uses SVD to explore the NullSpace of the matrix to only add regularization to constraints that have antagonists constraints.
meaningful commit: 30f81e4
Introduced example
The added example shows a beam attached at both sides and which center is constrained in two different positions, meaning that two antagonists constraints are imposed to the center. The idea is that, because the fixations are not faulty, then we want them to be fully solved and we don't want to perturb them while still releasing the constraints on the antagonists ones.
With SVD
Without SVD
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