The Hungarian algorithm is used to find the optimal choices for a given 'cost matrix' e.g. going from the output of the Hungarian algorithm
J1 J2 J3 J4
W1 7 8 0 2
W2 40 0 18 40
W3 0 58 0 60
W4 0 1 96 0
to the input
J1 J2 J3 J4
W1 82 83 69 92
W2 77 37 49 92
W3 11 69 5 86
W4 8 9 98 23
(or a variation of the matrix that will give the same output)
I've tried just applying the steps in reverse (covering the zeroes using lines and taking away the double lines and adding to the single lines and adding numbers to both the rows and columns)
but it seems to return a different matrix or one that can be instantly solved by just taking away the lowest number from the roes and columns, instead of needing to do the step of covering up the zeroes eith lines
P.S. this is the method of the hungairan algorithm i am using
Step 1: Subtract row minima
For each row, find the lowest element and subtract it from each element in that row.
Step 2: Subtract column minima
Similarly, for each column, find the lowest element and subtract it from each element in that column.
Step 3: Cover all zeros with a minimum number of lines
Cover all zeros in the resulting matrix using a minimum number of horizontal and vertical lines. If n lines are required, an optimal assignment exists among the zeros. The algorithm stops.
If less than n lines are required, continue with Step 4.
Step 4: Create additional zeros
Find the smallest element (call it k) that is not covered by a line in Step 3. Subtract k from all uncovered elements, and add k to all elements that are covered twice.
from: [https://www.hungarianalgorithm.com/examplehungarianalgorithm.php]