Code source de l'algorithme de correspondance hongrois

Code source de l'algorithme de correspondance hongrois

Remarque : les étapes de la méthode dans les commentaires sont légèrement différentes des étapes du code source.

Pour calculer la fonction principale correspondante, reportez-vous à la fonction main()

Les fonctions et étapes impliquées dans le fichier d'en-tête sont : Code source de l'algorithme de correspondance hongrois

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);
};

Lien disque réseau :

链接:https://pan.baidu.com/s/141tcPcVfxABeERDvk853RQ 

Je suppose que tu aimes

Origine blog.csdn.net/qq_42835363/article/details/131520419
conseillé
Classement