Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hungarian hangs for float weights when there are unassignable jobs #18

Closed
mastrof opened this issue Dec 16, 2022 · 1 comment · Fixed by #20
Closed

hungarian hangs for float weights when there are unassignable jobs #18

mastrof opened this issue Dec 16, 2022 · 1 comment · Fixed by #20

Comments

@mastrof
Copy link

mastrof commented Dec 16, 2022

I'm observing a weird behavior with the hungarian function (tested only on Julia 1.8). If weights are integers the algorithm works fine

julia> weights_int = [1 missing; missing missing]
2×2 Matrix{Union{Missing, Int64}}:
 1         missing
  missing  missing

julia> hungarian(weights_int)
([1, 0], 1)

If the weight matrix has float values instead the algorithm hangs

julia> weights_float = [1.0 missing; missing missing]
2×2 Matrix{Union{Missing, Float64}}:
 1.0       missing
  missing  missing

julia> hungarian(weights_float)

Is this expected behavior? Can it be fixed? How?

@Gnimuc
Copy link
Owner

Gnimuc commented Dec 17, 2022

MWE:

weights_int = [1.0 Inf; Inf Inf]
Hungarian.munkres(weights_int)

looks like the implementation for forbidden edges hits a corner case.

cc @dourouc05

@Gnimuc Gnimuc closed this as completed in #20 Jan 2, 2023
Gnimuc added a commit that referenced this issue Jan 2, 2023
Fix #18 by explicitly converting `Inf` to `prevfloat(Inf)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants