I am looking for a C/C++ implementation of the Hungarian method for solving the linear assignment problem with real-valued cost matrix.

Some implementation I found, such as this one, only work for integer costs :(

Any suggestions are very appreciated!

Thank you in advance!

  • 1
    $\begingroup$ Wouldn't it work to multiply your cost by a big constant and take the integer part of it ? so that you could directly use the link mentioned in the question, at the expense of loosing a little bit of precision, if you can afford it. $\endgroup$
    – BrunoLevy
    Nov 7, 2015 at 10:15
  • $\begingroup$ Go to CRAN and download the "clue" package source. The LSAP code contains a C implementation of the Hungarian method. $\endgroup$ Nov 7, 2015 at 19:36

1 Answer 1


This one seems to work great for me:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.