pymatgen.optimization.linear_assignment_numpy module¶
This module contains an algorithm to solve the Linear Assignment Problem. It has the same functionality as linear_assignment.pyx, but is much slower as it is vectorized in numpy rather than cython

class
LinearAssignment
(costs, epsilon=1e06)[source]¶ Bases:
object
This class finds the solution to the Linear Assignment Problem. It finds a minimum cost matching between two sets, given a cost matrix.
This class is an implementation of the LAPJV algorithm described in: R. Jonker, A. Volgenant. A Shortest Augmenting Path Algorithm for Dense and Sparse Linear Assignment Problems. Computing 38, 325340 (1987)
Parameters:  costs – The cost matrix of the problem. cost[i,j] should be the cost of matching x[i] to y[j]. The cost matrix may be rectangular
 epsilon – Tolerance for determining if solution vector is < 0

min_cost
¶ Returns the cost of the best assignment