pub fn new(general_form: &'a GeneralForm<OF>) -> Self {
        let rows: Sparse<_, _, _> = Sparse::from_column_major_ordered_matrix_although_this_is_expensive(
            &general_form.constraints,
        );

        Self {
            constraint: (0..general_form.nr_active_constraints())
                .map(|i| rows.data[i].len())
                .collect(),
            variable: (0..general_form.nr_active_variables())
                .map(|j| general_form.constraints.data[j].len())
                .collect(),
            activity: rows.iter_rows().map(|row| {
                row.iter()
                    .map(|&(j, coefficient)| {
                        let (lower, upper) =  (&general_form.variables[j].lower_bound, &general_form.variables[j].upper_bound);
                        match NonZeroSign::from(coefficient) {
                            NonZeroSign::Positive => (lower, upper),
                            NonZeroSign::Negative => (upper, lower),
                        }
                    })
                    .fold((0, 0), |(lower_total, upper_total), (lower, upper)| {
                        let is_missing = |option: &Option<_>| match option.as_ref() {
                            Some(_) => 0,
                            None => 1,
                        };
                        (lower_total + is_missing(lower), upper_total + is_missing(upper))
                    })
            }).collect(),

            rows,
            general_form,
        }
    }
/// Create a new instance.
///
/// Create a row major representation of the problem, which is expensive. Doing this once allows
/// quick iteration over rows, which is helpful for interacting with the constraints.
///
/// # Arguments
///
/// * `general_form`: Problem being presolved.
///
/// # Return value
///
/// A new instance.
Create a new instance.
Create a row major representation of the problem, which is expensive. Doing this once allows
quick iteration over rows, which is helpful for interacting with the constraints.
Create a new instance . Create a row major representation of the problem which is expensive . Doing this once allows quick iteration over rows which is helpful for interacting with the constraints .
pub fn new(general_form: &'a GeneralForm<OF>) -> Self {
        let rows: Sparse<_, _, _> = Sparse::from_column_major_ordered_matrix_although_this_is_expensive(
            &general_form.constraints,
        );
        Self {
            constraint: (0..general_form.nr_active_constraints())
                .map(|i| rows.data[i].len())
                .collect(),
            variable: (0..general_form.nr_active_variables())
                .map(|j| general_form.constraints.data[j].len())
                .collect(),
            activity: rows.iter_rows().map(|row| {
                row.iter()
                    .map(|&(j, coefficient)| {
                        let (lower, upper) =  (&general_form.variables[j].lower_bound, &general_form.variables[j].upper_bound);
                        match NonZeroSign::from(coefficient) {
                            NonZeroSign::Positive => (lower, upper),
                            NonZeroSign::Negative => (upper, lower),
                        }
                    })
                    .fold((0, 0), |(lower_total, upper_total), (lower, upper)| {
                        let is_missing = |option: &Option<_>| match option.as_ref() {
                            Some(_) => 0,
                            None => 1,
                        };
                        (lower_total + is_missing(lower), upper_total + is_missing(upper))
                    })
            }).collect(),
            rows,
            general_form,
        }
    }
pub fn new ( general_form : & ' a GeneralForm < OF > ) -> Self { let rows : Sparse < _ , _ , _ > = Sparse :: from_column_major_ordered_matrix_although_this_is_expensive ( & general_form . constraints , ) ; Self { constraint : ( 0 .. general_form . nr_active_constraints ( ) ) . map ( | i | rows . data [ i ] . len ( ) ) . collect ( ) , variable : ( 0 .. general_form . nr_active_variables ( ) ) . map ( | j | general_form . constraints . data [ j ] . len ( ) ) . collect ( ) , activity : rows . iter_rows ( ) . map ( | row | { row . iter ( ) . map ( | & ( j , coefficient ) | { let ( lower , upper ) = ( & general_form . variables [ j ] . lower_bound , & general_form . variables [ j ] . upper_bound ) ; match NonZeroSign :: from ( coefficient ) { NonZeroSign :: Positive => ( lower , upper ) , NonZeroSign :: Negative => ( upper , lower ) , } } ) . fold ( ( 0 , 0 ) , | ( lower_total , upper_total ) , ( lower , upper ) | { let is_missing = | option : & Option < _ > | match option . as_ref ( ) { Some ( _ ) => 0 , None => 1 , } ; ( lower_total + is_missing ( lower ) , upper_total + is_missing ( upper ) ) } ) } ) . collect ( ) , rows , general_form , } }
Create a new instance.
Create a new instance .
general_form
&'a GeneralForm<OF>
general_form
&'a GeneralForm<OF>
return value
A new instance.
A new instance .