Giter VIP home page Giter VIP logo

hungarian-on3's Introduction

hungarian-on3

The hungarian (Kuhn-Munkres) algorithm solved in O(n^3) time Algorithm based on: https://github.com/KevinStern/software-and-algorithms/blob/master/src/main/java/blogspot/software_and_algorithms/stern_library/optimization/HungarianAlgorithm.java

Solves an assignment problem really fast. Benchmarked against other JS solutions, a 1000x1000 matrix took about 26 seconds. With this, it takes 2 seconds.

  • The primary speed up comes from using the O(n^3) algorithm instead of the O(n^4) algorithm that you probably use when you solve by hand.
  • Additionally, it reduces the search space by removing rows that have no feasible column match.
  • For max speed, make sure your BIG_M is <= 2^30 (otherwise the optimizing compiler bails out because it has to rewrap the function in a double)

##Installation npm install hungarian-on3

##How to use

var hungarian = require('./hungarian-on3');
var data = [[400, 150, 400],[400, 450, 600],[300, 225, 300]];
var results = hungarian(data);
//results: [[0, 1], [1, 0], [2, 2]]

##License MIT

hungarian-on3's People

Contributors

mattkrick avatar

Watchers

 avatar

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.