fn compute_activity_bound_if_needed(
        &mut self,
        constraint: usize,
        direction: BoundDirection,
    ) -> &OF {
        debug_assert_eq!(match direction {
            BoundDirection::Lower => self.counters.activity[constraint].0,
            BoundDirection::Upper => self.counters.activity[constraint].1,
        }, 0);

        // Relevant activity counter.
        let bound = match direction {
            BoundDirection::Lower => &mut self.activity_bounds[constraint].0,
            BoundDirection::Upper => &mut self.activity_bounds[constraint].1,
        };

        // If there is no bound, compute it.
        if bound.is_none() {
            let updates = &self.updates;
            *bound = Some(
                self.counters.iter_active_row(constraint)
                    .map(|(variable, coefficient)| {
                        let bound_direction = direction * NonZeroSign::from(coefficient);
                        let bound = updates.variable_bound(variable, bound_direction).unwrap();
                        coefficient * bound
                    })
                    .sum()
            );
        }

        // We unwrap because we just computed it.
        bound.as_ref().unwrap()
    }
/// If no value is known for one of the activity bounds, compute them.
///
/// This is a helper method for `presolve_constraint_by_domain_propagation`.
///
/// # Arguments
///
/// * `constraint`: Index of the constrain being checked.
///
/// # Return value
///
/// A tuple with a (lower, upper) activity bound. Can be `None` if not all of the relevant
/// lower or upper bounds are known.
If no value is known for one of the activity bounds, compute them.
This is a helper method for `presolve_constraint_by_domain_propagation`.
If no value is known for one of the activity bounds compute them . This is a helper method for ` presolve_constraint_by_domain_propagation ` .
fn compute_activity_bound_if_needed(
        &mut self,
        constraint: usize,
        direction: BoundDirection,
    ) -> &OF {
        debug_assert_eq!(match direction {
            BoundDirection::Lower => self.counters.activity[constraint].0,
            BoundDirection::Upper => self.counters.activity[constraint].1,
        }, 0);
        // Relevant activity counter.
        let bound = match direction {
            BoundDirection::Lower => &mut self.activity_bounds[constraint].0,
            BoundDirection::Upper => &mut self.activity_bounds[constraint].1,
        };
        // If there is no bound, compute it.
        if bound.is_none() {
            let updates = &self.updates;
            *bound = Some(
                self.counters.iter_active_row(constraint)
                    .map(|(variable, coefficient)| {
                        let bound_direction = direction * NonZeroSign::from(coefficient);
                        let bound = updates.variable_bound(variable, bound_direction).unwrap();
                        coefficient * bound
                    })
                    .sum()
            );
        }
        // We unwrap because we just computed it.
        bound.as_ref().unwrap()
    }
fn compute_activity_bound_if_needed ( & mut self , constraint : usize , direction : BoundDirection , ) -> & OF { debug_assert_eq ! ( match direction { BoundDirection Lower self counters activity [ constraint ] 0 BoundDirection Upper self counters activity [ constraint ] 1 } 0 ) ; // Relevant activity counter. let bound = match direction { BoundDirection :: Lower => & mut self . activity_bounds [ constraint ] . 0 , BoundDirection :: Upper => & mut self . activity_bounds [ constraint ] . 1 , } ; // If there is no bound, compute it. if bound . is_none ( ) { let updates = & self . updates ; * bound = Some ( self . counters . iter_active_row ( constraint ) . map ( | ( variable , coefficient ) | { let bound_direction = direction * NonZeroSign :: from ( coefficient ) ; let bound = updates . variable_bound ( variable , bound_direction ) . unwrap ( ) ; coefficient * bound } ) . sum ( ) ) ; } // We unwrap because we just computed it. bound . as_ref ( ) . unwrap ( ) }
If no value is known for one of the activity bounds, compute them.
If no value is known for one of the activity bounds compute them .
&mut self
constraint
usize
direction
BoundDirection
&mut self
constraint
usize
direction
BoundDirection
return value
A tuple with a (lower, upper) activity bound. Can be `None` if not all of the relevant
lower or upper bounds are known.
A tuple with a ( lower upper ) activity bound . Can be ` None ` if not all of the relevant lower or upper bounds are known .