fn bound_compare_and_update<OF>(
    variable: usize,
    direction: BoundDirection,
    new: OF,
    existing: &OF,
    bounds: &mut HashMap<(usize, BoundDirection), OF>,
) -> BoundChange<OF>
where
    OF: OrderedField,
    for<'r> &'r OF: OrderedFieldRef<OF>,
{
    if match direction {
        BoundDirection::Lower => &new > existing,
        BoundDirection::Upper => &new < existing,
    } {
        let difference = &new - existing;
        bounds.insert((variable, direction), new);

        BoundChange::BoundShift(difference)
    } else {
        BoundChange::None
    }
}
/// Helper function to update bounds.
///
/// Compares with an existing bound if there is one, and updates if the new bound is tighter.
///
/// # Arguments
///
/// * `variable`: Index of the variable who's bound might be changed.
/// * `direction`: Whether an upper or lower bound might be changed.
/// * `new`: New bound value
/// * `existing`: Existing value to compare with
/// * `bounds`: Collection to add the new bound to in case it is tighter.
Helper function to update bounds.
Compares with an existing bound if there is one, and updates if the new bound is tighter.
Helper function to update bounds . Compares with an existing bound if there is one and updates if the new bound is tighter .
fn bound_compare_and_update<OF>(
    variable: usize,
    direction: BoundDirection,
    new: OF,
    existing: &OF,
    bounds: &mut HashMap<(usize, BoundDirection), OF>,
) -> BoundChange<OF>
where
    OF: OrderedField,
    for<'r> &'r OF: OrderedFieldRef<OF>,
{
    if match direction {
        BoundDirection::Lower => &new > existing,
        BoundDirection::Upper => &new < existing,
    } {
        let difference = &new - existing;
        bounds.insert((variable, direction), new);
        BoundChange::BoundShift(difference)
    } else {
        BoundChange::None
    }
}
fn bound_compare_and_update < OF > ( variable : usize , direction : BoundDirection , new : OF , existing : & OF , bounds : & mut HashMap < ( usize , BoundDirection ) , OF > , ) -> BoundChange < OF > where OF : OrderedField , for < ' r > & ' r OF : OrderedFieldRef < OF > , { if match direction { BoundDirection :: Lower => & new > existing , BoundDirection :: Upper => & new < existing , } { let difference = & new - existing ; bounds . insert ( ( variable , direction ) , new ) ; BoundChange :: BoundShift ( difference ) } else { BoundChange :: None } }
Helper function to update bounds.
Helper function to update bounds .
variable
usize
direction
BoundDirection
new
OF
existing
&OF
bounds
&mut HashMap<(usize, BoundDirection), OF>
variable
usize
direction
BoundDirection
new
OF
existing
&OF
bounds
&mut HashMap<(usize, BoundDirection), OF>