protected void greedyMatch ( ) { for ( int w = 0 ; w < dim ; w ++ ) { for ( int j = 0 ; j < dim ; j ++ ) { if ( matchJobByWorker [ w ] == - 1 && matchWorkerByJob [ j ] == - 1 && costMatrix [ w ] [ j ] - labelByWorker [ w ] - labelByJob [ j ] == 0 ) { match ( w , j ) ; } } } }
Find a valid matching by greedily selecting among zero - cost matchings . This is a heuristic to jump - start the augmentation algorithm .