int Munkres::step3(void) { /* Main Zero Search 1. Find an uncovered Z in the distance matrix and prime it. If no such zero exists, go to Step 5 2. If No Z* exists in the row of the Z', go to Step 4. 3. If a Z* exists, cover this row and uncover the column of the Z*. Return to Step 3.1 to find a new Z */ if ( find_uncovered_in_matrix(0, saverow, savecol) ) { mask_matrix(saverow,savecol) = PRIME; // prime it. } else { return 5; } for ( unsigned int ncol = 0 ; ncol < matrix.cols ; ncol++ ) { if ( mask_matrix(saverow,ncol) == STAR ) { row_mask[saverow] = true; //cover this row and col_mask[ncol] = false; // uncover the column containing the starred zero return 3; // repeat } } return 4; // no starred zero in the row containing this primed zero }
/*! Main Zero Search 1. Find an uncovered Z in the distance matrix and prime it. If no such zero exists, go to Step 5 2. If No Z* exists in the row of the Z', go to Step 4. 3. If a Z* exists, cover this row and uncover the column of the Z*. Return to Step 3.1 to find a new Z */ int Munkres::step3(void) { if ( find_uncovered_in_matrix(0, saverow, savecol) ) { mask_matrix(saverow,savecol) = Z_PRIME; // prime it. } else { return 5; } for ( unsigned ncol = 0 ; ncol < matrix.columns() ; ncol++ ) if ( mask_matrix(saverow,ncol) == Z_STAR ) { row_mask[saverow] = true; //cover this row and col_mask[ncol] = false; // uncover the column containing the starred zero return 3; // repeat } return 4; // no starred zero in the row containing this primed zero }