pub fn is_probably_equal_to(&self, other: &Self, min_equal: f64) -> bool {
        if !(self.objective_value == other.objective_value) {
            return false;
        }

        if !(self.solution_values.len() == other.solution_values.len()) {
            return false;
        }

        let this_map = self.solution_values.iter().cloned().collect::<HashMap<_, _>>();
        let other_map = other.solution_values.iter().cloned().collect::<HashMap<_, _>>();

        if !{
            this_map.len() == other_map.len() && this_map.keys().all(|k| other_map.contains_key(k))
        } {
            return false;
        }

        let nr_total = self.solution_values.len();
        if nr_total < 10 {
            return true;
        }

        let mut nr_equal = 0;
        for name in this_map.keys() {
            if this_map.get(name) == other_map.get(name) {
                nr_equal += 1;
            }
        }

        nr_equal as f64 / nr_total as f64 > min_equal // At least a few solution values should be equal
    }
/// Heuristic method to test whether a linear program that has multiple equivalent solutions
/// has been solved correctly.
///
/// # Arguments
///
/// * `other`: `Solution` to compare to.
/// * `min_equal`: Minimum fraction of solution values that are equal across all variables.
Heuristic method to test whether a linear program that has multiple equivalent solutions
has been solved correctly.
Heuristic method to test whether a linear program that has multiple equivalent solutions has been solved correctly .
pub fn is_probably_equal_to(&self, other: &Self, min_equal: f64) -> bool {
        if !(self.objective_value == other.objective_value) {
            return false;
        }
        if !(self.solution_values.len() == other.solution_values.len()) {
            return false;
        }
        let this_map = self.solution_values.iter().cloned().collect::<HashMap<_, _>>();
        let other_map = other.solution_values.iter().cloned().collect::<HashMap<_, _>>();
        if !{
            this_map.len() == other_map.len() && this_map.keys().all(|k| other_map.contains_key(k))
        } {
            return false;
        }
        let nr_total = self.solution_values.len();
        if nr_total < 10 {
            return true;
        }
        let mut nr_equal = 0;
        for name in this_map.keys() {
            if this_map.get(name) == other_map.get(name) {
                nr_equal += 1;
            }
        }
        nr_equal as f64 / nr_total as f64 > min_equal // At least a few solution values should be equal
    }
pub fn is_probably_equal_to ( & self , other : & Self , min_equal : f64 ) -> bool { if ! ( self . objective_value == other . objective_value ) { return false ; } if ! ( self . solution_values . len ( ) == other . solution_values . len ( ) ) { return false ; } let this_map = self . solution_values . iter ( ) . cloned ( ) . collect :: < HashMap < _ , _ > > ( ) ; let other_map = other . solution_values . iter ( ) . cloned ( ) . collect :: < HashMap < _ , _ > > ( ) ; if ! { this_map . len ( ) == other_map . len ( ) && this_map . keys ( ) . all ( | k | other_map . contains_key ( k ) ) } { return false ; } let nr_total = self . solution_values . len ( ) ; if nr_total < 10 { return true ; } let mut nr_equal = 0 ; for name in this_map . keys ( ) { if this_map . get ( name ) == other_map . get ( name ) { nr_equal += 1 ; } } nr_equal as f64 / nr_total as f64 > min_equal // At least a few solution values should be equal }
Heuristic method to test whether a linear program that has multiple equivalent solutions
has been solved correctly.
Heuristic method to test whether a linear program that has multiple equivalent solutions has been solved correctly .
&self
other
&Self
min_equal
f64
&self
other
&Self
min_equal
f64