cheind / py-lapsolver

Fast linear assignment problem (LAP) solvers for Python based on c-extensions
MIT License
154 stars 24 forks source link

How can I get Cost of the solution? #16

Closed JohnPekl closed 3 years ago

JohnPekl commented 3 years ago

I can only get row and column index from this statement rids, cids = solve_dense(costs). How can I get the cost for these output row and column indexes?

I think the cost can be obtained by

`sum=0
 for i in rids:
    sum = sum+costs[i, cids [i]]`
jvlmdr commented 3 years ago

That will work. The canonical technique is costs[rids, cids].sum()