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