Git Product home page Git Product logo

hungarian-algorithm-n3's Introduction

𝓞(n³) implementation of the Hungarian algorithm,
also known as the Hungarian method, Kuhn–Munkres
algorithm or Munkres assignment.

The Hungarian algorithm solves the minmum bipartite
matching problem in 𝓞(n⁴). By implementing the priority
queue with a van Emde Boas tree the time can be
reduced to 𝓞(n³ log log n). The van Emde Boas tree
is possible to use because the elements values are
bounded within the priority queue's capacity.
However this implemention achives 𝓞(n³) by not using
a priority queue.

Edmonds and Karp, and independently Tomizawa, has
also reduced the time complexity to 𝓞(n³), but I
do not known how.

hungarian-algorithm-n3's People

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  avatar

Watchers

 avatar  avatar  avatar  avatar

hungarian-algorithm-n3's Issues

kuhn_is_done()'s return statement is for square matrix case

Unlikely most of Hungarian algorithms, this implementation do not assume that the matrix related to the problem is square or equal number of e.g. workers and tasks.

To terminate progress, the function kuhn_is_done() should be able to return true, in the following cases:
Considered two cases;

  • 4 workers with 2 tasks and two workers assigned,
  • 2 workers with 4 tasks and two workers assigned.

In both cases, there cannot be more progress possible, but for only one of them, test (count==n) shall return true.

=> the final return statement should be
return (count == MIN(n,m));
or
return (count==n)||(count==m);

portability

I should make this program portable someday…
(It was never intended for anything else than to
be translated into psuedocode.)

bitset_create() this->next array start from wrong address

The function uses a single allocation for three separate array. One array of c times BitSetLimb, and two arrays of (c+1) times size_t.

When the starting address of this->next is calculated, there are used:
c times BitSetLimb plus only c times size_t.
Now arrays this->prev and this->next are overlapping by one size_t.

I would expect that correct starting address is :
this->next = (size_t *)&this->_buf[c * sizeof(BitSetLimb) + (c+1) * sizeof(size_t)];

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.