fn transform_variables(&mut self) {
        // After this call, all active variables have at least one bound.
        self.split_free_variables();
        debug_assert!(is_consistent(&self));

        for j in 0..self.variables.len() {
            let variable = &mut self.variables[j];

            // Flip such that there is at least a lower bound.
            if let (None, Some(upper)) = (&variable.lower_bound, &variable.upper_bound) {
                variable.flipped = !variable.flipped;
                variable.shift *= -OF::one();
                variable.cost *= -OF::one();

                variable.lower_bound = Some(-upper);
                variable.upper_bound = None;

                for (_, coefficient) in &mut self.constraints.data[j] {
                    *coefficient *= -OF::one();
                }
            };

            // Shift such that any lower bound is zero.
            if let Some(ref mut lower) = variable.lower_bound {
                variable.shift -= &*lower;
                if let Some(ref mut upper) = variable.upper_bound {
                    *upper -= &*lower;
                }

                self.fixed_cost += &*lower * &variable.cost;
                // Update the bounds
                for (i, coefficient) in &self.constraints.data[j] {
                    self.b[*i] -= coefficient * &*lower;
                }

                *lower = OF::zero();
            }
        }

        debug_assert!(is_consistent(&self));
    }
/// Split free variables and shift all variables, such that the lower bound is zero.
///
/// This allows the removal of those lower bounds afterwards; this lower bound is the only lower
/// bound for problems in standard form. When working with a simplex tableau, this form allows
/// us to eliminate all rows which describe a lower bound.
///
/// If later on, such as during branch and bound, an extra lower bound needs to be inserted,
/// this information can be stored regardless in a separate data structure.
Split free variables and shift all variables, such that the lower bound is zero.
This allows the removal of those lower bounds afterwards; this lower bound is the only lower
bound for problems in standard form. When working with a simplex tableau, this form allows
us to eliminate all rows which describe a lower bound.

If later on, such as during branch and bound, an extra lower bound needs to be inserted,
this information can be stored regardless in a separate data structure.
Split free variables and shift all variables such that the lower bound is zero . This allows the removal of those lower bounds afterwards ; this lower bound is the only lower bound for problems in standard form . When working with a simplex tableau this form allows us to eliminate all rows which describe a lower bound . If later on such as during branch and bound an extra lower bound needs to be inserted this information can be stored regardless in a separate data structure .
fn transform_variables(&mut self) {
        // After this call, all active variables have at least one bound.
        self.split_free_variables();
        debug_assert!(is_consistent(&self));
        for j in 0..self.variables.len() {
            let variable = &mut self.variables[j];
            // Flip such that there is at least a lower bound.
            if let (None, Some(upper)) = (&variable.lower_bound, &variable.upper_bound) {
                variable.flipped = !variable.flipped;
                variable.shift *= -OF::one();
                variable.cost *= -OF::one();
                variable.lower_bound = Some(-upper);
                variable.upper_bound = None;
                for (_, coefficient) in &mut self.constraints.data[j] {
                    *coefficient *= -OF::one();
                }
            };
            // Shift such that any lower bound is zero.
            if let Some(ref mut lower) = variable.lower_bound {
                variable.shift -= &*lower;
                if let Some(ref mut upper) = variable.upper_bound {
                    *upper -= &*lower;
                }
                self.fixed_cost += &*lower * &variable.cost;
                // Update the bounds
                for (i, coefficient) in &self.constraints.data[j] {
                    self.b[*i] -= coefficient * &*lower;
                }
                *lower = OF::zero();
            }
        }
        debug_assert!(is_consistent(&self));
    }
fn transform_variables ( & mut self ) { // After this call, all active variables have at least one bound. self . split_free_variables ( ) ; debug_assert ! ( is_consistent ( self ) ) ; for j in 0 .. self . variables . len ( ) { let variable = & mut self . variables [ j ] ; // Flip such that there is at least a lower bound. if let ( None , Some ( upper ) ) = ( & variable . lower_bound , & variable . upper_bound ) { variable . flipped = ! variable . flipped ; variable . shift *= - OF :: one ( ) ; variable . cost *= - OF :: one ( ) ; variable . lower_bound = Some ( - upper ) ; variable . upper_bound = None ; for ( _ , coefficient ) in & mut self . constraints . data [ j ] { * coefficient *= - OF :: one ( ) ; } } ; // Shift such that any lower bound is zero. if let Some ( ref mut lower ) = variable . lower_bound { variable . shift -= & * lower ; if let Some ( ref mut upper ) = variable . upper_bound { * upper -= & * lower ; } self . fixed_cost += & * lower * & variable . cost ; // Update the bounds for ( i , coefficient ) in & self . constraints . data [ j ] { self . b [ * i ] -= coefficient * & * lower ; } * lower = OF :: zero ( ) ; } } debug_assert ! ( is_consistent ( self ) ) ; }
Split free variables and shift all variables, such that the lower bound is zero.
Split free variables and shift all variables such that the lower bound is zero .
&mut self
&mut self