Skip to content

Commit

Permalink
better error (#422)
Browse files Browse the repository at this point in the history
* better error

* harsher error on index

* test behavior

* dimension
  • Loading branch information
matbesancon authored Sep 9, 2023
1 parent 219f425 commit d7be106
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion BREAKING.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/active_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions test/active_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d7be106

Please sign in to comment.