Add hungarian file
[trackerpp.git] / include / hungarian.h
diff --git a/include/hungarian.h b/include/hungarian.h
new file mode 100644 (file)
index 0000000..64b8596
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _HUNGARIAN_H_
+#define _HUNGARIAN_H_
+#include <eigen3/Eigen/Dense>
+
+// C++ version of linear_sum_assignment() in python scipy
+// https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.optimize.linear_sum_assignment.html
+// http://csclab.murraystate.edu/~bob.pilgrim/445/munkres.html
+//
+
+// @param cost_matrix The cost matrix
+// @param row_ind, col_ind an array of row indices and one of corresponding column indices giving the optimal assignment.
+// @return the cost of the assignment
+int linear_sum_assignment(const Eigen::MatrixXi& cost_matrix, Eigen::VectorXi& row_ind, Eigen::VectorXi& col_ind);
+
+#endif // _HUNGARIAN_H_