Fix OptimizationManopt reporting MaxIters even when converged - #1258
Draft
SebastianM-C wants to merge 1 commit into
Draft
Fix OptimizationManopt reporting MaxIters even when converged#1258SebastianM-C wants to merge 1 commit into
SebastianM-C wants to merge 1 commit into
Conversation
Passing `maxiters`/`maxtime` without an explicit `abstol` fully replaced Manopt's own per-solver default stopping criterion with just StopAfterIteration/StopAfter, which never indicate convergence per Manopt's has_converged semantics. That made ReturnCode.MaxIters structurally unavoidable regardless of whether the solve had actually converged (see #1034, which the retcode-mapping fix in #1169 exposed but never actually resolved). Add a per-optimizer fallback tolerance, used only when maxiters/maxtime is set without abstol, mirroring each solver's own real Manopt default so genuine convergence can still be reported as Success. Also fix the Karcher-mean docs example, which never actually used the Frank-Wolfe optimizer or closed-form subsolver it claims to (opt was never reassigned from the earlier GradientDescentOptimizer, so Manopt silently dropped the unrecognized sub_problem kwarg), and adjust the Manopt 0.6 sub_problem calling convention (InplaceEvaluation) plus maxiters budgets across all three docs examples so each one now reports Success. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__map_optimizer_args!fully replaced Manopt's own per-solver defaultstopping_criterionwith justStopAfterIteration/StopAfterwhenevermaxiters/maxtimewas given without an explicitabstol. Since those criteria never indicate convergence (Manopt'shas_convergedsemantics), this madeReturnCode.MaxItersstructurally unavoidable regardless of whether the solve had actually converged. Fixes the underlying issue behind Improve return codes from OptimizationManopt #1034, which Improve return codes from OptimizationManopt #1169's retcode-mapping fix exposed but never actually resolved._default_fallback_abstol), used only whenmaxiters/maxtimeis set withoutabstol, mirroring each solver's own real Manopt default so genuine convergence is still reported asSuccess. Optimizers whose real default is a composite criterion (NelderMead,CMAES,ConvexBundle) opt out and keep prior behavior.optfrom the earlierGradientDescentOptimizer— Manopt silently warned and dropped the unrecognizedsub_problemkwarg, so it silently ran plain gradient descent instead.sub_problemcalling-convention change (now needsevaluation = Manopt.InplaceEvaluation()for the mutating closed-form style) and bumpedmaxitersbudgets across all three docs examples to values confirmed sufficient for them to reachSuccess.Manopt.check_gradientthat the two examples without an explicitabstol(Rosenbrock/Euclidean and Rayleigh quotient/Sphere) have correct gradients — theirMaxIterswas genuinely insufficient default iteration budget, not a gradient bug.Test plan
Pkg.test()inlib/OptimizationManopt— all 16 tests pass, including the pre-existing Quasi-Newton/ARC/TrustRegions testssuccessful_retcodefor amaxiters-only (noabstol) gradient-descent rundocs/src/optimization_packages/manopt.mdexamples end-to-end; each now reportsretcode = Successwith the expected minimizer/objective🤖 Generated with Claude Code