Skip to content

Commit 62cff20

Browse files
Include scale-invariant damped newton descent in tests
1 parent 64913c1 commit 62cff20

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

optimistix/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
NonlinearCGDescent as NonlinearCGDescent,
7777
OptaxMinimiser as OptaxMinimiser,
7878
polak_ribiere as polak_ribiere,
79+
ScaledDampedNewtonDescent as ScaledDampedNewtonDescent,
7980
SteepestDescent as SteepestDescent,
8081
)
8182

optimistix/_solver/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
IndirectDampedNewtonDescent as IndirectDampedNewtonDescent,
2626
IndirectLevenbergMarquardt as IndirectLevenbergMarquardt,
2727
LevenbergMarquardt as LevenbergMarquardt,
28+
ScaledDampedNewtonDescent as ScaledDampedNewtonDescent,
2829
)
2930
from .limited_memory_bfgs import AbstractLBFGS as AbstractLBFGS, LBFGS as LBFGS
3031
from .nelder_mead import NelderMead as NelderMead

tests/helpers.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ class BFGSDampedNewton(optx.AbstractBFGS):
126126
verbose: frozenset[str] = frozenset()
127127

128128

129+
class BFGSScaledDampedNewton(optx.AbstractBFGS):
130+
"""BFGS Hessian + direct Levenberg Marquardt update."""
131+
132+
rtol: float
133+
atol: float
134+
norm: Callable = optx.max_norm
135+
use_inverse: bool = False
136+
search: optx.AbstractSearch = optx.ClassicalTrustRegion()
137+
descent: optx.AbstractDescent = optx.ScaledDampedNewtonDescent()
138+
verbose: frozenset[str] = frozenset()
139+
140+
129141
class BFGSIndirectDampedNewton(optx.AbstractBFGS):
130142
"""BFGS Hessian + indirect Levenberg Marquardt update."""
131143

@@ -198,6 +210,18 @@ class DFPDampedNewton(optx.AbstractDFP):
198210
verbose: frozenset[str] = frozenset()
199211

200212

213+
class DFPScaledDampedNewton(optx.AbstractDFP):
214+
"""DFP Hessian + direct Levenberg Marquardt update."""
215+
216+
rtol: float
217+
atol: float
218+
norm: Callable = optx.max_norm
219+
use_inverse: bool = False
220+
search: optx.AbstractSearch = optx.ClassicalTrustRegion()
221+
descent: optx.AbstractDescent = optx.ScaledDampedNewtonDescent()
222+
verbose: frozenset[str] = frozenset()
223+
224+
201225
class DFPIndirectDampedNewton(optx.AbstractDFP):
202226
"""DFP Hessian + indirect Levenberg Marquardt update."""
203227

@@ -264,10 +288,12 @@ class DFPClassicalTrustRegionHessian(optx.AbstractDFP):
264288
BFGSClassicalTrustRegionHessian(rtol, atol),
265289
BFGSLinearTrustRegionHessian(rtol, atol),
266290
BFGSLinearTrustRegion(rtol, atol),
291+
BFGSScaledDampedNewton(rtol, atol),
267292
optx.DFP(rtol, atol, use_inverse=False),
268293
optx.DFP(rtol, atol, use_inverse=True),
269294
DFPDampedNewton(rtol, atol),
270295
DFPIndirectDampedNewton(rtol, atol),
296+
DFPScaledDampedNewton(rtol, atol),
271297
# Tighter tolerance needed to have DFPDogleg pass the JVP test.
272298
DFPDogleg(1e-10, 1e-10),
273299
DFPClassicalTrustRegionHessian(rtol, atol),

0 commit comments

Comments
 (0)