pub fn select_primal_pivot_row(&self, column: &SparseVector<IM::F, IM::F>) -> Option<usize> {
        debug_assert_eq!(Vector::len(column), self.nr_rows());

        // (chosen index, minimum ratio, corresponding leaving_column (for Bland's algorithm))
        let mut min_values: Option<(usize, IM::F, usize)> = None;
        for (row, xij) in column.iter_values() {
            if xij > &IM::F::zero() {
                let ratio = self.inverse_maintainer.get_constraint_value(*row) / xij;
                // Bland's anti cycling algorithm
                let leaving_column = self.inverse_maintainer.basis_column_index_for_row(*row);
                if let Some((min_index, min_ratio, min_leaving_column)) = &mut min_values {
                    if &ratio == min_ratio && leaving_column < *min_leaving_column {
                        *min_index = *row;
                        *min_leaving_column = leaving_column;
                    } else if &ratio < min_ratio {
                        *min_index = *row;
                        *min_ratio = ratio;
                        *min_leaving_column = leaving_column;
                    }
                } else {
                    min_values = Some((*row, ratio, leaving_column))
                }
            }
        }

        min_values.map(|(min_index, _, _)| min_index)
    }
/// Determine the row to pivot on.
///
/// Determine the row to pivot on, given the column. This is the row with the positive but
/// minimal ratio between the current constraint vector and the column.
///
/// When there are multiple choices for the pivot row, Bland's anti cycling algorithm
/// is used to avoid cycles.
///
/// TODO(ARCHITECTURE): Reconsider the below; should this be a strategy?
/// Because this method allows for less strategy and heuristics, it is not included in the
/// `PivotRule` trait.
///
/// # Arguments
///
/// * `column`: Problem column with respect to the current basis with length `m`.
///
/// # Return value
///
/// Index of the row to pivot on. If not found, the problem is optimal.
Determine the row to pivot on.
Determine the row to pivot on, given the column. This is the row with the positive but
minimal ratio between the current constraint vector and the column.

When there are multiple choices for the pivot row, Bland's anti cycling algorithm
is used to avoid cycles.

Reconsider the below; should this be a strategy.
Because this method allows for less strategy and heuristics, it is not included in the
`PivotRule` trait.
Determine the row to pivot on . Determine the row to pivot on given the column . This is the row with the positive but minimal ratio between the current constraint vector and the column . When there are multiple choices for the pivot row Bland ' s anti cycling algorithm is used to avoid cycles . Reconsider the below ; should this be a strategy . Because this method allows for less strategy and heuristics it is not included in the ` PivotRule ` trait .
pub fn select_primal_pivot_row(&self, column: &SparseVector<IM::F, IM::F>) -> Option<usize> {
        debug_assert_eq!(Vector::len(column), self.nr_rows());
        // (chosen index, minimum ratio, corresponding leaving_column (for Bland's algorithm))
        let mut min_values: Option<(usize, IM::F, usize)> = None;
        for (row, xij) in column.iter_values() {
            if xij > &IM::F::zero() {
                let ratio = self.inverse_maintainer.get_constraint_value(*row) / xij;
                // Bland's anti cycling algorithm
                let leaving_column = self.inverse_maintainer.basis_column_index_for_row(*row);
                if let Some((min_index, min_ratio, min_leaving_column)) = &mut min_values {
                    if &ratio == min_ratio && leaving_column < *min_leaving_column {
                        *min_index = *row;
                        *min_leaving_column = leaving_column;
                    } else if &ratio < min_ratio {
                        *min_index = *row;
                        *min_ratio = ratio;
                        *min_leaving_column = leaving_column;
                    }
                } else {
                    min_values = Some((*row, ratio, leaving_column))
                }
            }
        }
        min_values.map(|(min_index, _, _)| min_index)
    }
pub fn select_primal_pivot_row ( & self , column : & SparseVector < IM :: F , IM :: F > ) -> Option < usize > { debug_assert_eq ! ( Vector len ( column ) self nr_rows ( ) ) ; // (chosen index, minimum ratio, corresponding leaving_column (for Bland's algorithm)) let mut min_values : Option < ( usize , IM :: F , usize ) > = None ; for ( row , xij ) in column . iter_values ( ) { if xij > & IM :: F :: zero ( ) { let ratio = self . inverse_maintainer . get_constraint_value ( * row ) / xij ; // Bland's anti cycling algorithm let leaving_column = self . inverse_maintainer . basis_column_index_for_row ( * row ) ; if let Some ( ( min_index , min_ratio , min_leaving_column ) ) = & mut min_values { if & ratio == min_ratio && leaving_column < * min_leaving_column { * min_index = * row ; * min_leaving_column = leaving_column ; } else if & ratio < min_ratio { * min_index = * row ; * min_ratio = ratio ; * min_leaving_column = leaving_column ; } } else { min_values = Some ( ( * row , ratio , leaving_column ) ) } } } min_values . map ( | ( min_index , _ , _ ) | min_index ) }
Determine the row to pivot on.
Determine the row to pivot on .
&self
column
&SparseVector<IM::F, IM::F>
&self
column
&SparseVector<IM::F, IM::F>
return value
Index of the row to pivot on. If not found, the problem is optimal.
Index of the row to pivot on . If not found the problem is optimal .