OpenShot Library | libopenshot 0.2.7
Hungarian.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2// Hungarian.h: Header file for Class HungarianAlgorithm.
3//
4// This is a C++ wrapper with slight modification of a hungarian algorithm implementation by Markus Buehren.
5// The original implementation is a few mex-functions for use in MATLAB, found here:
6// http://www.mathworks.com/matlabcentral/fileexchange/6543-functions-for-the-rectangular-assignment-problem
7//
8// Both this code and the orignal code are published under the BSD license.
9// by Cong Ma, 2016
10//
11
12#include <iostream>
13#include <vector>
14#include <cstdlib>
15#include <cfloat>
16#include <math.h>
17
19{
20public:
23 double Solve(std::vector<std::vector<double>> &DistMatrix, std::vector<int> &Assignment);
24
25private:
26 void assignmentoptimal(int *assignment, double *cost, double *distMatrix, int nOfRows, int nOfColumns);
27 void buildassignmentvector(int *assignment, bool *starMatrix, int nOfRows, int nOfColumns);
28 void computeassignmentcost(int *assignment, double *cost, double *distMatrix, int nOfRows);
29 void step2a(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
30 void step2b(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
31 void step3(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
32 void step4(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim, int row, int col);
33 void step5(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
34};
double Solve(std::vector< std::vector< double > > &DistMatrix, std::vector< int > &Assignment)
Definition: Hungarian.cpp:22