pub struct Row {
pub basic_var: VarId,
pub constant: BigRational,
pub coeffs: FxHashMap<VarId, BigRational>,
}Expand description
A row in the simplex tableau represents: basic_var = constant + sum(coeff_i * nonbasic_var_i).
Fields§
§basic_var: VarIdThe basic variable for this row.
constant: BigRationalThe constant term.
coeffs: FxHashMap<VarId, BigRational>Coefficients for non-basic variables: var_id -> coefficient.
Implementations§
Source§impl Row
impl Row
Sourcepub fn from_expr(
basic_var: VarId,
constant: BigRational,
coeffs: FxHashMap<VarId, BigRational>,
) -> Self
pub fn from_expr( basic_var: VarId, constant: BigRational, coeffs: FxHashMap<VarId, BigRational>, ) -> Self
Create a row representing: basic_var = constant + sum(coeffs).
Sourcepub fn eval(
&self,
non_basic_values: &FxHashMap<VarId, BigRational>,
) -> BigRational
pub fn eval( &self, non_basic_values: &FxHashMap<VarId, BigRational>, ) -> BigRational
Get the value of the basic variable given values of non-basic variables.
Sourcepub fn add_row(&mut self, multiplier: &BigRational, other: &Row)
pub fn add_row(&mut self, multiplier: &BigRational, other: &Row)
Add a multiple of another row to this row. self += multiplier * other
Sourcepub fn scale(&mut self, scalar: &BigRational)
pub fn scale(&mut self, scalar: &BigRational)
Multiply the row by a scalar.
Sourcepub fn substitute(&mut self, var: VarId, row: &Row)
pub fn substitute(&mut self, var: VarId, row: &Row)
Substitute a non-basic variable using another row. If var appears in this row, replace it using: var = row.constant + sum(row.coeffs).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Row
impl RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnwindSafe for Row
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more