Commit 3816a5b
authored
Fix linesearch skip causing solver divergence in float32 (#1162)
The linesearch early-exit check (`|derivative| < gtol`) was unreliable
in float32 because gtol (~1e-10) falls below float32 precision (~1e-7).
This caused rare solver divergence (hitting 100 iteration limit),
bottlenecking batched simulation by ~15%.
Two fixes:
- Clamp gtol to 1e-6 minimum (matching tolerance clamp in io.py)
- Require cost improvement for the early exit, preventing acceptance
of Newton steps that overshoot past the minimum1 parent fc91589 commit 3816a5b
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | | - | |
| 1034 | + | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
| |||
1164 | 1164 | | |
1165 | 1165 | | |
1166 | 1166 | | |
1167 | | - | |
1168 | | - | |
| 1167 | + | |
| 1168 | + | |
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| |||
0 commit comments