Skip to content

Commit

Permalink
Use @test_broken instead of skipping
Browse files Browse the repository at this point in the history
This also fixes one failure in L-BFGS that causes CI to fail.
  • Loading branch information
timholy committed Oct 25, 2024
1 parent 0a04aa0 commit 5d1f90d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 1 addition & 3 deletions test/multivariate/solvers/first_order/cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
run_optim_tests(ConjugateGradient(),
skip=skip,
convergence_exceptions = (("Powell", 1), ("Powell", 2), ("Polynomial", 1),
("Extended Rosenbrock", 1),
("Extended Powell", 1),
("Extended Powell", 2)),
minimum_exceptions = (("Paraboloid Diagonal", 1)),
minimizer_exceptions = (("Paraboloid Diagonal", 1),
("Extended Powell", 1),
minimizer_exceptions = (("Extended Powell", 1),
("Extended Powell", 2)),
f_increase_exceptions = (("Hosaki"),),
iteration_exceptions = (("Paraboloid Diagonal", 10000),),
Expand Down
6 changes: 1 addition & 5 deletions test/multivariate/solvers/first_order/l_bfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# Trigonometric gets stuck in a local minimum?
skip = ("Trigonometric",)

if Sys.WORD_SIZE == 32
iteration_exceptions = (("Extended Powell", 2000),)
else
iteration_exceptions = ()
end
iteration_exceptions = (("Extended Powell", 2000),)

run_optim_tests(LBFGS(),
f_increase_exceptions = ("Extended Rosenbrock",),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"Trigonometric", "Penalty Function I", "Beale","Paraboloid Random Matrix")
run_optim_tests(MomentumGradientDescent(),
skip = skip,
convergence_exceptions = (("Large Polynomial",1), ("Himmelblau",1),
("Fletcher-Powell", 1),("Fletcher-Powell", 2),
("Powell", 1)),
minimum_exceptions = (("Large Polynomial", 1), ("Large Polynomial", 2)),
convergence_exceptions = (("Fletcher-Powell", 2),),
iteration_exceptions = (("Paraboloid Diagonal", 10000),
("Powell", 10000)),
f_increase_exceptions = ("Exponential", "Polynomial",
Expand Down
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,22 @@ function run_optim_tests(method; convergence_exceptions = (),
printstyled(name, " did not converge with i = ", i, "\n", color=:red)
printstyled(results, "\n", color=:red)
end
else
@test_broken Optim.converged(results)
end
if !((name, i) in minimum_exceptions)
@test Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
else
@test_broken Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
end
if !((name, i) in minimizer_exceptions)
@test norm(Optim.minimizer(results) - prob.solutions) < 1e-2
else
@test_broken norm(Optim.minimizer(results) - prob.solutions) < 1e-2
end
end
else
@test_broken false # marked skipped tests as broken
debug_printing && printstyled("Skipping $name\n", color=:blue)
end
end
Expand Down Expand Up @@ -216,14 +223,21 @@ function run_optim_tests_constrained(method; convergence_exceptions = (),
printstyled(name, "did not converge\n", color=:red)
printstyled(results, "\n", color=:red)
end
else
@test_broken Optim.converged(results)
end
if !(name in minimum_exceptions)
@test Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
else
@test_broken Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
end
if !(name in minimizer_exceptions)
@test norm(Optim.minimizer(results) - prob.solutions) < 1e-2
else
@test_broken norm(Optim.minimizer(results) - prob.solutions) < 1e-2
end
else
@test_broken false
debug_printing && printstyled("Skipping $name\n", color=:blue)
end
end
Expand Down

0 comments on commit 5d1f90d

Please sign in to comment.