pub(super) fn update_bound(
        &mut self,
        variable: usize,
        direction: BoundDirection,
        new: OF,
    ) -> BoundChange<OF> {
        debug_assert!(self.removed_variables.iter().all(|&(j, _)| j != variable));

        // The bounds in `self.bounds` are disjoint from the bounds in `self.activity_bounds`.
        let compare_with = match self.bounds.get(&(variable, direction)) {
            None => {
                match self.activity_bounds.remove(&(variable, direction)) {
                    None => {
                        let original = &self.general_form.variables[variable];
                        let original = match direction {
                            BoundDirection::Lower => &original.lower_bound,
                            BoundDirection::Upper => &original.upper_bound,
                        };
                        match original {
                            None => {
                                self.bounds.insert((variable, direction), new);
                                return BoundChange::NewBound
                            },
                            Some(original) => original,
                        }
                    },
                    Some(existing_activity) => {
                        self.bounds.insert((variable, direction), existing_activity);
                        self.bounds.get(&(variable, direction)).unwrap()
                    }
                }
            },
            Some(existing) => existing,
        };
        // TODO(ARCHITECTURE): Avoid this clone
        let compare_with = compare_with.clone();

        // We add to the `self.bounds` struct in every case
        bound_compare_and_update(variable, direction, new, &compare_with, &mut self.bounds)
    }
/// Update a variable bound.
///
/// This is the type of bound that should always be exported, because other changes might depend
/// on it.
///
/// # Arguments
///
/// * `variable`: Index of the variable to be changed.
/// * `direction`: Whether the lower or upper bound should be changed.
/// * `new`: New value for the bound.
///
/// # Return value
///
/// Type of change made: none, a shift, or added a new bound.
Update a variable bound.
This is the type of bound that should always be exported, because other changes might depend
on it.
Update a variable bound . This is the type of bound that should always be exported because other changes might depend on it .
pub(super) fn update_bound(
        &mut self,
        variable: usize,
        direction: BoundDirection,
        new: OF,
    ) -> BoundChange<OF> {
        debug_assert!(self.removed_variables.iter().all(|&(j, _)| j != variable));
        // The bounds in `self.bounds` are disjoint from the bounds in `self.activity_bounds`.
        let compare_with = match self.bounds.get(&(variable, direction)) {
            None => {
                match self.activity_bounds.remove(&(variable, direction)) {
                    None => {
                        let original = &self.general_form.variables[variable];
                        let original = match direction {
                            BoundDirection::Lower => &original.lower_bound,
                            BoundDirection::Upper => &original.upper_bound,
                        };
                        match original {
                            None => {
                                self.bounds.insert((variable, direction), new);
                                return BoundChange::NewBound
                            },
                            Some(original) => original,
                        }
                    },
                    Some(existing_activity) => {
                        self.bounds.insert((variable, direction), existing_activity);
                        self.bounds.get(&(variable, direction)).unwrap()
                    }
                }
            },
            Some(existing) => existing,
        };
        // TODO(ARCHITECTURE): Avoid this clone
        let compare_with = compare_with.clone();
        // We add to the `self.bounds` struct in every case
        bound_compare_and_update(variable, direction, new, &compare_with, &mut self.bounds)
    }
pub ( super ) fn update_bound ( & mut self , variable : usize , direction : BoundDirection , new : OF , ) -> BoundChange < OF > { debug_assert ! ( self removed_variables iter ( ) all ( ( j ) j variable ) ) ; // The bounds in `self.bounds` are disjoint from the bounds in `self.activity_bounds`. let compare_with = match self . bounds . get ( & ( variable , direction ) ) { None => { match self . activity_bounds . remove ( & ( variable , direction ) ) { None => { let original = & self . general_form . variables [ variable ] ; let original = match direction { BoundDirection :: Lower => & original . lower_bound , BoundDirection :: Upper => & original . upper_bound , } ; match original { None => { self . bounds . insert ( ( variable , direction ) , new ) ; return BoundChange :: NewBound } , Some ( original ) => original , } } , Some ( existing_activity ) => { self . bounds . insert ( ( variable , direction ) , existing_activity ) ; self . bounds . get ( & ( variable , direction ) ) . unwrap ( ) } } } , Some ( existing ) => existing , } ; // TODO(ARCHITECTURE): Avoid this clone let compare_with = compare_with . clone ( ) ; // We add to the `self.bounds` struct in every case bound_compare_and_update ( variable , direction , new , & compare_with , & mut self . bounds ) }
Update a variable bound.
Update a variable bound .
&mut self
variable
usize
direction
BoundDirection
new
OF
&mut self
variable
usize
direction
BoundDirection
new
OF
return value
Type of change made: none, a shift, or added a new bound.
Type of change made : none a shift or added a new bound .