123456789101112131415161718192021222324252627282930313233343536 |
- //
- // Created by lqx on 20-4-23.
- //
- #ifndef TRACK_SORT_HUNGARIAN_H_H
- #define TRACK_SORT_HUNGARIAN_H_H
- #include <iostream>
- #include <vector>
- using namespace std;
- class HungarianAlgorithm
- {
- public:
- HungarianAlgorithm();
- ~HungarianAlgorithm();
- double Solve(vector<vector<double>>& DistMatrix, vector<int>& Assignment);
- private:
- void assignmentoptimal(int *assignment, double *cost, double *distMatrix, int nOfRows, int nOfColumns);
- void buildassignmentvector(int *assignment, bool *starMatrix, int nOfRows, int nOfColumns);
- void computeassignmentcost(int *assignment, double *cost, double *distMatrix, int nOfRows);
- void step2a(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix,
- bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
- void step2b(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix,
- bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
- void step3(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix,
- bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
- 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);
- void step5(int *assignment, double *distMatrix, bool *starMatrix, bool *newStarMatrix, bool *primeMatrix,
- bool *coveredColumns, bool *coveredRows, int nOfRows, int nOfColumns, int minDim);
- };
- #endif //TRACK_SORT_HUNGARIAN_H_H
|