pub fn compute_full_solution_with_reduced_solution<G>(
        self,
        mut reduced_solution: SparseVector<G, G>,
    ) -> Solution<G>
    where
        // TODO: Find a suitable trait alias to avoid this many trait bounds.
        G: Sum + Neg<Output=G> + AddAssign<OF> + PartialEq<OF> + LinearAlgebraElement<G> + From<OF> + Eq + Ord + Zero,
        for<'r> G: Add<&'r OF, Output=G>,
        for<'r> &'r G: Neg<Output=G> + Mul<&'r OF, Output=G> + Add<&'r OF, Output=G> + Sub<&'r G, Output=G>,
    {
        debug_assert_eq!(reduced_solution.len(), self.variables.len());

        let cost = reduced_solution.iter_values()
            .map(|(j, v)| v * &self.variables[*j].cost)
            .sum::<G>() + &self.fixed_cost;
        self.reshift_solution(&mut reduced_solution);

        // To avoid recomputations, we store all computed intermediate values in this collection.
        let mut new_solutions = vec![None; self.original_variables.len()];
        for j in 0..self.original_variables.len() {
            self.compute_solution_value_with_bfs::<G>(j, &mut new_solutions, &reduced_solution);
        }
        debug_assert!(new_solutions.iter().all(Option::is_some));

        Solution::new(
            cost,
            self.original_variables.into_iter().zip(new_solutions.into_iter())
                .map(|((name, _), value)| (name, value.unwrap()))
                .collect(),
        )
    }
/// Extend a reduced solution with already known values.
///
/// Presolving might have determined variables explicitly or as a function of others. This
/// method augments the solution of the open part of the problem to a complete solution.
///
/// # Arguments
///
/// * `reduced_solution`: A value for each of the variables in this general form that are still
/// marked as unsolved (in the `original_variables` field).
///
/// # Returns
///
/// A complete solution.
Extend a reduced solution with already known values.
Presolving might have determined variables explicitly or as a function of others. This
method augments the solution of the open part of the problem to a complete solution.
Extend a reduced solution with already known values . Presolving might have determined variables explicitly or as a function of others . This method augments the solution of the open part of the problem to a complete solution .
pub fn compute_full_solution_with_reduced_solution<G>(
        self,
        mut reduced_solution: SparseVector<G, G>,
    ) -> Solution<G>
    where
        // TODO: Find a suitable trait alias to avoid this many trait bounds.
        G: Sum + Neg<Output=G> + AddAssign<OF> + PartialEq<OF> + LinearAlgebraElement<G> + From<OF> + Eq + Ord + Zero,
        for<'r> G: Add<&'r OF, Output=G>,
        for<'r> &'r G: Neg<Output=G> + Mul<&'r OF, Output=G> + Add<&'r OF, Output=G> + Sub<&'r G, Output=G>,
    {
        debug_assert_eq!(reduced_solution.len(), self.variables.len());
        let cost = reduced_solution.iter_values()
            .map(|(j, v)| v * &self.variables[*j].cost)
            .sum::<G>() + &self.fixed_cost;
        self.reshift_solution(&mut reduced_solution);
        // To avoid recomputations, we store all computed intermediate values in this collection.
        let mut new_solutions = vec![None; self.original_variables.len()];
        for j in 0..self.original_variables.len() {
            self.compute_solution_value_with_bfs::<G>(j, &mut new_solutions, &reduced_solution);
        }
        debug_assert!(new_solutions.iter().all(Option::is_some));
        Solution::new(
            cost,
            self.original_variables.into_iter().zip(new_solutions.into_iter())
                .map(|((name, _), value)| (name, value.unwrap()))
                .collect(),
        )
    }
pub fn compute_full_solution_with_reduced_solution < G > ( self , mut reduced_solution : SparseVector < G , G > , ) -> Solution < G > where // TODO: Find a suitable trait alias to avoid this many trait bounds. G : Sum + Neg < Output = G > + AddAssign < OF > + PartialEq < OF > + LinearAlgebraElement < G > + From < OF > + Eq + Ord + Zero , for < ' r > G : Add < & ' r OF , Output = G > , for < ' r > & ' r G : Neg < Output = G > + Mul < & ' r OF , Output = G > + Add < & ' r OF , Output = G > + Sub < & ' r G , Output = G > , { debug_assert_eq ! ( reduced_solution len ( ) self variables len ( ) ) ; let cost = reduced_solution . iter_values ( ) . map ( | ( j , v ) | v * & self . variables [ * j ] . cost ) . sum :: < G > ( ) + & self . fixed_cost ; self . reshift_solution ( & mut reduced_solution ) ; // To avoid recomputations, we store all computed intermediate values in this collection. let mut new_solutions = vec ! [ None self original_variables len ( ) ] ; for j in 0 .. self . original_variables . len ( ) { self . compute_solution_value_with_bfs :: < G > ( j , & mut new_solutions , & reduced_solution ) ; } debug_assert ! ( new_solutions iter ( ) all ( Option is_some ) ) ; Solution :: new ( cost , self . original_variables . into_iter ( ) . zip ( new_solutions . into_iter ( ) ) . map ( | ( ( name , _ ) , value ) | ( name , value . unwrap ( ) ) ) . collect ( ) , ) }
Extend a reduced solution with already known values.
Extend a reduced solution with already known values .
self
reduced_solution
SparseVector<G, G>
A complete solution.
A complete solution .
self
reduced_solution
SparseVector<G, G>