Liking cljdoc? Tell your friends :D

Munkres

The Hungarian method is a combinatorial optimization algorithm that solves the assignment problem O(N^3). This library wraps java code from Algorithms for use from Clojure

Usage

Add this to your project.clj :dependencies

[munkres "0.5.0"]

Require it from your source code

(ns my-ns
  (:require [munkres :as m]))

And call it like so:

(m/minimize-weight [[2 1] [3 4]]
                   [:agent1 :agent2]
                   [:task1 :task2])

Which will result in the assignments:

{:assignments {:agent1 :task2
               :agent2 :task1}
 :weight 4.0}

See the docstrings for minimize-weight for further details.

Building

Install Leiningen then

lein javac && lein jar

Deploying

lein release (or lein deploy clojars if you already have the correct version number set)

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close