PYTHIA  8.312
Public Member Functions | List of all members
HungarianAlgorithm Class Reference

#include <MathTools.h>

Public Member Functions

double solve (vector< vector< double > > &distMatrix, vector< int > &assignment)
 Function wrapper for solving assignment problem. More...
 

Detailed Description

Class for the "Hungarian" pairing algorithm. Adapted for Vincia from an implementation by M. Buehren and C. Ma, see notices below. This is a C++ wrapper with slight modification of a hungarian algorithm implementation by Markus Buehren. The original implementation is a few mex-functions for use in MATLAB, found here: http:///www.mathworks.com/matlabcentral/fileexchange/ 6543-functions-for-the-rectangular-assignment-problem

Both this code and the orignal code are published under the BSD license. by Cong Ma, 2016.

Copyright (c) 2014, Markus Buehren All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Member Function Documentation

double solve ( vector< vector< double > > &  distMatrix,
vector< int > &  assignment 
)

Function wrapper for solving assignment problem.

Class for the "Hungarian" pairing algorithm.

A single function wrapper for solving assignment problem.

Fill in the distMatrixIn. Mind the index is "i + nRows * j". Here the cost matrix of size MxN is defined as a double precision array of N*M elements. In the solving functions matrices are seen to be saved MATLAB-internally in row-order. (i.e. the matrix [1 2; 3 4] will be stored as a vector [1 3 2 4], NOT [1 2 3 4]).

Call solving function.


The documentation for this class was generated from the following files: