libshell
libshell copied to clipboard
Newton solver with PD projection
In this PR, I've made the following changes:
-
Added a Newton solver with line search: See the
Optimization
folder.- Included a mechanism to switch between a positive definite (PD) Hessian and the actual Hessian (
H + λI
, withλ -> 0
) to improve convergence when a small gradient (~1e-6) is required. This switch is based on empirical observation and lacks theoretical proof.
- Included a mechanism to switch between a positive definite (PD) Hessian and the actual Hessian (
-
Implemented PD projection for the local Hessian: Two options are available:
- kMaxZero: Zero out all negative eigenvalues of the Hessian matrix.
- kAbs: Use the Absolute Eigenvalue Filtering method introduced in the paper Stable Neo-Hookean Simulation: Absolute Eigenvalue Filtering for Projected Newton (take the absolute value of all the negative eigen values).
- It is not the case that kAbs is better than the first one kMaxZero. Actually, for the example case, without switch to the actual hessian after 100 iteration, the kMaxZero's gradient norm is about 2.2e-05, and the kAbs is about 1.3e-04. I will send the emails to Honglin (the author) to report my observation.
-
Switched from the libigl viewer to the Polyscope viewer for enhanced visualization.
The code has been tested on a MacOS M2 chip.