Giter Club home page Giter Club logo

hungarian.jl's People

Contributors

dourouc05 avatar femtocleaner[bot] avatar francescoalemanno avatar gnimuc avatar ilyaorson avatar juliatagbot avatar staticfloat avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hungarian.jl's Issues

The implementation is extremely slow when solving some "simple" assignment problems

Here is an example:

M = kron(A,B)

using Hungarian
@time assignH, costH = hungarian(M)  
# => 44.816792 seconds (13.19 M allocations: 8.777 GB, 2.24% gc time)

using Munkres
@time assignM = munkres(M)
# =>  0.062191 seconds (20.06 k allocations: 25.378 MB, 3.27% gc time)

where A and B are tho30 data.

The optimal assignment is pretty easy to find, because M is a symmetric matrix and the elements of its diagonal are all 0.

Fail to found optimal solution in some cases when cost is of type UInt

Here is an MWE that can reproduce the failure:

A = UInt8[ 49 107  64  23 232 139  21  72 124 125 197 226  45  99 106;
     152 106  95 138 109 171  45  11 173  57 129 223   6 242 116;
     191 197  43 224 105 229  85 225 163 118  99 207 195 194  14;
     239 225 216  48 127 252 234 114   6  64  81 116 161  90  19;
     209 122  84 187 200 150 229  21 115 154 203 252 221 238 131;
     172 247 161 255 102 128 176  63  67 105 107 194 217 226 109;
       5  49  90 126  45 211 168 198 211 200  42  88 117 224 172;
     205 250 117 234  75 251  80  28 121  67  87 106 172 111  54;
     157  99 233  70  80 196 237   3  77 137  32 143 100 117 149;
     221  80 132 251 233 238  44 212 204  41 158 124 113  17 252;
     171   9 138 170  15 190 149  15 190  58 252 248  21 210 223;
      97 240  45 200  53  45  94 122  77  12 114  84 155  94  21;
       6 209 214  15  58  59  60 232  40 210  93  63  80  86  95;
      11 184 129 159 130 171 181  41 164  65 171  55 164  72 132;
      30 225 231 144 209 203  30 202 195 221  70  38 220  48 203]

using Hungarian
using Munkres

n = 15
hh = Hungarian.munkres(A)
match_h = [findfirst(hh[i,:].==Hungarian.STAR) for i = 1:n]
match_m = munkres(A)
sum_h = sum(A[ii, match_h[ii]] for ii in 1:n) |> Int    #-> 712   
sum_m = sum(A[ii, match_m[ii]] for ii in 1:n) |> Int    #-> 456

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Parallelizing step3

We're using Hungarian.jl in the https://github.com/ZIB-IOL/FrankWolfe.jl package to solve LPs over the Birkhoff polytope.

It scales well in terms of memory footprint but badly in terms of time, mostly because of step3!, where most of the time seems to be spent in this block:

    @inbounds for j in colUncoveredIdx, i in rowUncoveredIdx
        cost = costMat[i, j] + Δcol[j] + Δrow[i]
        if cost <= h
            if cost != h
                h = cost
                empty!(minLocations)
            end
            push!(minLocations, (i, j))
        end
    end

this would be non-trivial to parallelize because of the shared bound h and array minLocations but could be worth it.

`hungarian` hangs for float weights when there are unassignable jobs

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.