-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension of non-square matrix with all negative values in lapjv #21
Comments
Hi, the cost matrix must be non-negative. Do you see the error with cost + 30? |
Oh ok, sorry, I didn't realise :) |
And yep, it gives the correct solution for the positive cost matrix. |
This should definitely be mentioned in the docs. If you have some time, please, send a PR. |
Maybe it would be better to also raise an exception if one of the costs is negative, or subtract the minimum? But are you sure it doesn't work with negative costs? It seems to give the correct result, although I haven't tested it extensively. (The modification that I proposed in #22 was only to fix an issue with the extension to a square cost matrix when all of the costs were negative.) |
@jvlmdr You are right, my bad, lack of sleep, lack of time... It is the dual where the reduced costs have to be non-negative, so no issue in the algorithm itself, the extension is wrong. |
And your patch #22 is sound. The only question that remains is what has a better runtime: extend the way you do, or shift the costs to zero first and extend as before? |
Hey, I think there is a bug in the code for extending a non-square matrix to a square matrix.
Consider the all-negative cost matrix
with values in the range [-30, -20].
The minimal cost should be 2 + 2 + -30 * 2 = -56 but lapjv returns 0. The indices of the solution are all -1.
The text was updated successfully, but these errors were encountered: