diff --git a/src/plans/bundle_plan.jl b/src/plans/bundle_plan.jl index 1222fefc79..59085132eb 100644 --- a/src/plans/bundle_plan.jl +++ b/src/plans/bundle_plan.jl @@ -121,7 +121,7 @@ mutable struct StopWhenLagrangeMultiplierLess{ end function get_reason(sc::StopWhenLagrangeMultiplierLess) if (sc.at_iteration >= 0) - if isnothing(sc.sumbols) + if isnothing(sc.symbols) tol_str = join( ["$ai < $bi" for (ai, bi) in zip(sc.values, sc.tolerances)], ", " ) @@ -134,7 +134,7 @@ function get_reason(sc::StopWhenLagrangeMultiplierLess) ", ", ) end - return "After $(c.at_iteration) iterations the algorithm reached an approximate critical point with tolerances $tol_str.\n" + return "After $(sc.at_iteration) iterations the algorithm reached an approximate critical point with tolerances $tol_str.\n" end return "" end diff --git a/test/plans/test_stopping_criteria.jl b/test/plans/test_stopping_criteria.jl index 46a763ad6c..926d1b1a1a 100644 --- a/test/plans/test_stopping_criteria.jl +++ b/test/plans/test_stopping_criteria.jl @@ -187,6 +187,10 @@ struct DummyStoppingCriterion <: StoppingCriterion end @test s3.κ == 0.5 update_stopping_criterion!(s3, :ResidualPower, 0.5) @test s3.θ == 0.5 + @test get_reason(s3) == "" + # Trigger manually + s3.at_iteration = 1 + @test length(get_reason(s3)) > 0 end @testset "Stop with step size" begin diff --git a/test/solvers/test_particle_swarm.jl b/test/solvers/test_particle_swarm.jl index dc8019a5de..90a78fc49d 100644 --- a/test/solvers/test_particle_swarm.jl +++ b/test/solvers/test_particle_swarm.jl @@ -70,5 +70,10 @@ using Random @testset "Specific Stopping criteria" begin sc = StopWhenSwarmVelocityLess(1.0) @test startswith(repr(sc), "StopWhenSwarmVelocityLess") + @test get_reason(sc) == "" + # Trigger manually + sc.at_iteration = 2 + sc.velocity_norms = [0.001, 0.001] + @test length(get_reason(sc)) > 0 end end diff --git a/test/solvers/test_proximal_bundle_method.jl b/test/solvers/test_proximal_bundle_method.jl index 9505a16f86..316b5a8786 100644 --- a/test/solvers/test_proximal_bundle_method.jl +++ b/test/solvers/test_proximal_bundle_method.jl @@ -14,10 +14,18 @@ import Manopt: proximal_bundle_method_subsolver, proximal_bundle_method_subsolve @test startswith( repr(sc1), "StopWhenLagrangeMultiplierLess([1.0e-8]; mode=:estimate)\n" ) + @test get_reason(sc1) == "" + # Trigger manually + sc1.at_iteration = 2 + @test length(get_reason(sc1)) > 0 sc2 = StopWhenLagrangeMultiplierLess([1e-8, 1e-8]; mode=:both) @test startswith( repr(sc2), "StopWhenLagrangeMultiplierLess([1.0e-8, 1.0e-8]; mode=:both)\n" ) + @test get_reason(sc2) == "" + # Trigger manually + sc2.at_iteration = 2 + @test length(get_reason(sc2)) > 0 end @testset "Allocating Subgradient" begin f(M, q) = distance(M, q, p) diff --git a/test/solvers/test_truncated_cg.jl b/test/solvers/test_truncated_cg.jl index 73b08ee796..835db782f6 100644 --- a/test/solvers/test_truncated_cg.jl +++ b/test/solvers/test_truncated_cg.jl @@ -17,6 +17,10 @@ using Manifolds, Manopt, ManifoldsBase, Test str1 = Manopt.status_summary(str) @test str1 == "Trust region exceeded:\tnot reached" @test repr(str) == "StopWhenTrustRegionIsExceeded()\n $(str1)" + @test get_reason(str) == "" + # Trigger manually + str.at_iteration = 1 + @test length(get_reason(str)) > 0 scn = StopWhenCurvatureIsNegative() scn1 = Manopt.status_summary(scn) @test scn1 == "Curvature is negative:\tnot reached"