diff --git a/BREAKING.md b/BREAKING.md index 01665b5b0..d4bd1f128 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -1,4 +1,4 @@ -# Noteworthy changes from the last version +# Noteworthy changes from v0.1 to v0.2 - clean up `active_set.jl` by renaming `compute_active_set_iterate` to `get_active_set_iterate` and merging `find_minmax_direction` and `active_set_argminmax` [PR258](https://github.com/ZIB-IOL/FrankWolfe.jl/pull/258) - change keyword argument `K` to `lazy_tolerance` in all algorithms [PR255](https://github.com/ZIB-IOL/FrankWolfe.jl/pull/255) diff --git a/src/active_set.jl b/src/active_set.jl index 8c5cb3d93..5c517769f 100644 --- a/src/active_set.jl +++ b/src/active_set.jl @@ -268,6 +268,9 @@ function active_set_argminmax(active_set::ActiveSet, direction; Φ=0.5) idxM = i end end + if idx == -1 || idxM == -1 + error("Infinite minimum $val or maximum $valM in the active set. Does the gradient contain invalid (NaN / Inf) entries?") + end return (active_set[idx]..., idx, val, active_set[idxM]..., idxM, valM, valM - val ≥ Φ) end diff --git a/test/active_set.jl b/test/active_set.jl index e1bd7daa4..ace2105dc 100644 --- a/test/active_set.jl +++ b/test/active_set.jl @@ -218,6 +218,7 @@ end FrankWolfe.active_set_argminmax(active_set::ActiveSet, [1, 1.5]) @test i_min == 1 @test i_max == 2 + @test_throws ErrorException FrankWolfe.active_set_argminmax(active_set::ActiveSet, [NaN, NaN]) end @testset "LPseparationWithScaledHotVector" begin