Wrapping a solution for the Assignment Problem, Hungarian Method (Munkres) O(N^3)
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
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.
Install Leiningen then
lein javac && lein jar
lein release
(or lein deploy clojars
if you already have the correct version number set)