Пример #1
0
 def _setup_matcher(self):
     """
     1. Computes the suitability matrix, 
     2. Converts it to an n x n minimum assignment problem
     3. Starts the Hungarian algorith by subtracting the smallest value from each row 
     and starring zeros 
     """
     
     self._suitability = self.suitability_matrix()
     self._height = len(self._suitability)
     self._width = len(self._suitability[0])
     
     # Store the original suitability matrix for computing match suitability later
     self._matrix = copy.deepcopy(self._suitability)
     
     matrix_functions.augment_matrix(self._matrix)   
     matrix_functions.min_matrix(self._matrix)   
     matrix_functions.subtract_row_min(self._matrix)
     #matrix_functions.subtract_col_min(suitability)
     
     self._star_zeroes()
Пример #2
0
def setup_matrix(suitability):
    """
    1. Computes the suitability matrix, 
    2. Converts it to an n x n minimum assignment problem
    3. Starts the Hungarian algorith by subtracting the smallest value from each row 
    and starring zeros 
    """
    return star_zeroes( \
                matrix_functions.subtract_row_min( \
                    matrix_functions.min_matrix( \
                        matrix_functions.augment_matrix( \
                            suitability))))