C++ implementation of the Hungarian algorithm