def linear_assignment(cost_matrix):
try:
import lap
_, x, y = lap.lapjv(cost_matrix, extend_cost=True)
return np.array([[y[i],i] for i in x if i >= 0]) #
except ImportError:
from scipy.optimize import linear_sum_assignment
x, y = linear_sum_assignment(cost_matrix)
return np.array(list(zip(x, y)))
above image is output of
import lap
_, x, y = lap.labjv(cost_matrix, extend_cost=True)
First, i understood variables as minimum_cost index of rows, cols. But, x[5]=-1, x[6]=4, y[4]=7. ?? I can't understand those values...
Second, there are differences lap.labjv with linear_sum_assignment
from scipy.optimize import linear_sum_assignment
x2, y2 = linear_sum_assignment(cost_matrix)
In
above image is output of
First, i understood variables as minimum_cost index of rows, cols. But, x[5]=-1, x[6]=4, y[4]=7. ?? I can't understand those values...
Second, there are differences
lap.labjv
withlinear_sum_assignment
Can you help me?