Skip to content

Commit ebd66eb

Browse files
SebastianM-Cclaude
andcommitted
fix: only add convergence criterion when abstol is explicitly set
Don't inject a default 1e-8 convergence criterion — let Manopt's own per-solver defaults handle stopping. Each solver has tailored defaults (e.g., GD uses StopWhenGradientNormLess(1e-8), ParticleSwarm uses StopWhenChangeLess(1e-4), CMA-ES has multiple specialized criteria). When no stopping criteria are specified at all, don't pass stopping_criterion to the solver, letting Manopt use its built-in defaults entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ec63927 commit ebd66eb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

lib/OptimizationManopt/src/OptimizationManopt.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ function __map_optimizer_args!(
3737
push!(criteria, Manopt.StopAfter(maxtime))
3838
end
3939

40-
tol = isnothing(abstol) ? 1e-8 : abstol
41-
push!(criteria, _default_convergence_criterion(opt, manifold, tol))
40+
if !isnothing(abstol)
41+
push!(criteria, _default_convergence_criterion(opt, manifold, abstol))
42+
end
4243

4344
if !isnothing(reltol)
4445
@SciMLMessage(
@@ -366,15 +367,15 @@ function SciMLBase.__solve(cache::OptimizationCache{O}) where {O <: AbstractMano
366367
hessF = build_hessF(cache.f)
367368
end
368369

369-
if haskey(solver_kwarg, :stopping_criterion)
370-
stopping_criterion = Manopt.StopWhenAny(solver_kwarg.stopping_criterion...)
370+
stopping_kwarg = if haskey(solver_kwarg, :stopping_criterion)
371+
(; stopping_criterion = Manopt.StopWhenAny(solver_kwarg.stopping_criterion...))
371372
else
372-
stopping_criterion = Manopt.StopAfterIteration(500)
373+
(;)
373374
end
374375

375376
opt_res = call_manopt_optimizer(
376377
manifold, cache.opt, _loss, gradF, cache.u0;
377-
solver_kwarg..., stopping_criterion = stopping_criterion, hessF
378+
solver_kwarg..., stopping_kwarg..., hessF
378379
)
379380

380381
asc = get_stopping_criterion(opt_res.options)

0 commit comments

Comments
 (0)