Skip to content

Commit a5038f9

Browse files
committed
unify tests.
1 parent a5b38e4 commit a5038f9

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

src/plans/stopping_criterion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ function get_reason(c::StopWhenRelativeAPosterioriCostChangeLessOrEqual)
528528
end
529529
return ""
530530
end
531-
function status_summary(c::StopWhenRelativeAPosterioriCostChangeLessOrEqual; context::Symbol = short)
531+
function status_summary(c::StopWhenRelativeAPosterioriCostChangeLessOrEqual; context::Symbol = :default)
532532
(context == :short) && return repr(c)
533533
has_stopped = (c.at_iteration >= 0)
534534
s = has_stopped ? "reached" : "not reached"

test/plans/test_stopping_criteria.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,18 @@ end
403403
@test sc(prob, s, 2)
404404
@test length(get_reason(sc)) > 0
405405
@test startswith(
406-
to_display_string(sc),
407-
"StopWhenRelativeAPosterioriCostChangeLessOrEqual with threshold",
406+
Manopt.status_summary(sc),
407+
"A stopping criterion to stop when the relative posteriori cost change is less than",
408408
)
409-
@test startswith(Manopt.status_summary(sc), "(fₖ- fₖ₊₁)/max(|fₖ|, |fₖ₊₁|, 1) = ")
409+
@test startswith(Manopt.status_summary(sc; context = :inline), "(fₖ- fₖ₊₁)/max(|fₖ|, |fₖ₊₁|, 1) = ")
410410
@test !Manopt.indicates_convergence(sc)
411411
end
412412

413413
@testset "StopWhenProjectedNegativeGradientNormLess" begin
414414
sc = StopWhenProjectedNegativeGradientNormLess(1.0e-10)
415+
@test startswith(repr(sc), "StopWhenProjectedNegativeGradientNormLess(")
416+
@test startswith(Manopt.status_summary(sc), "A StoppingCriterion to stop when the negative projected gradient norm is less than")
417+
415418
M = Hyperrectangle([1.0], [2.0])
416419
prob = DefaultManoptProblem(
417420
M, ManifoldGradientObjective((M, x) -> x^2, x -> 2x)

test/solvers/test_quasi_Newton_box.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,6 @@ using RecursiveArrayTools
315315
p_opt = quasi_Newton(M, f, grad_f, p0; stopping_criterion = StopWhenProjectedNegativeGradientNormLess(1.0e-6) | StopAfterIteration(100))
316316
@test distance(M, p_opt, ArrayPartition(px, [0 2; 0 0])) < 0.1
317317
end
318-
319-
@testset "Specialised Stopping criteria" begin
320-
sc = StopWhenProjectedNegativeGradientNormLess(1.0e-9)
321-
@test startswith(repr(sc), "StopWhenProjectedNegativeGradientNormLess(1.0e-9")
322-
@test startswith(Manopt.status_summary(sc), "A StoppingCriterion to stop when the negative projected gradient norm is less than")
323-
end
324318
end
325319

326320
@testset "MaxStepsizeInDirection" begin

0 commit comments

Comments
 (0)