Matchings#
- solve_matching_matrices(matrix_1: list[list], matrix_2: list[list], length: int, inner_distance: callable) float [source]#
Computes the minimal distance between two matrices.
We assume that both matrices are square matrices of the same size with zeros on the diagonal.
- We allow reordering of the rows and columns of the second matrix, however, whenever we reorder
a row we have to reorder the corresponding column as well, and vice versa.
We use the Gurobi optimization library to solve the assignment problem.
- Parameters:
matrix_1 (list[list]) – First square matrix.
matrix_2 (list[list]) – Second square matrix.
length (int) – Length of the matrix.
inner_distance (callable) – The inner distance (like L1 or L2).
- Returns:
Objective value.
- Return type:
float