source: cpp/frams/model/similarity/hungarian/hungarian.h @ 1314

Last change on this file since 1314 was 869, checked in by Maciej Komosinski, 6 years ago

Added another, improved way of calculating dissimilarity of two creatures/models. Details and comparisons in https://doi.org/10.1007/978-3-030-16692-2_8

File size: 2.1 KB
RevLine 
[869]1//Source: https://github.com/mcximing/hungarian-algorithm-cpp/blob/master/Hungarian.h
2///////////////////////////////////////////////////////////////////////////////
3// Hungarian.h: Header file for Class HungarianAlgorithm.
4//
5// This is a C++ wrapper with slight modification of a hungarian algorithm implementation by Markus Buehren.
6// The original implementation is a few mex-functions for use in MATLAB, found here:
7// http://www.mathworks.com/matlabcentral/fileexchange/6543-functions-for-the-rectangular-assignment-problem
8//
9// Both this code and the orignal code are published under the BSD license.
10// by Cong Ma, 2016
11
12
13#ifndef HUNGARIAN_H
14#define HUNGARIAN_H
15
16class HungarianAlgorithm
17{
18public:
19        HungarianAlgorithm();
20        ~HungarianAlgorithm();
21        double Solve(double *&distMatrixIn, int *&assignment, int nRows, int nCols);
22
23private:
24        void assignmentoptimal(int *assignment, double *cost, double *distMatrix, int nOfRows, int nOfColumns);
25        void buildassignmentvector(int *assignment, bool *starMatrix, int nOfRows, int nOfColumns);
26        void computeassignmentcost(int *assignment, double *cost, double *distMatrix, int nOfRows);
27        void step2a(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
28        void step2b(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
29        void step3(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
30        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);
31        void step5(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix, bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
32};
33
34
35#endif
Note: See TracBrowser for help on using the repository browser.