#[non_exhaustive]pub struct Snapshot {
pub sense: Sense,
pub objective_label: String,
pub columns: Vec<String>,
pub basis: Vec<usize>,
pub rows: Vec<Vec<Rational>>,
pub rhs: Vec<Rational>,
pub z: Vec<Coef>,
pub z_rhs: Coef,
}Expand description
A full copy of the tableau at one point in time.
The tableau is always expressed in the sense of the objective being optimized, as in
Taha’s textbook: the objective row holds z_j - c_j with the real costs c_j, and
z_rhs is the real objective value. A maximization tableau is optimal when every
z_j - c_j >= 0; a minimization tableau when every z_j - c_j <= 0 (see
Snapshot::is_optimal).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.sense: SenseSense of the objective in this tableau. Phase 1 of the two-phase method is always
Sense::Minimize (it minimizes r, the sum of the artificial variables).
objective_label: StringName of the objective row: "z", or "r" in phase 1 of the two-phase method.
columns: Vec<String>Column names (original variables, then slack/surplus, then artificial).
basis: Vec<usize>For each constraint row, the index of its basic column.
rows: Vec<Vec<Rational>>Constraint rows, without the right-hand side.
rhs: Vec<Rational>Right-hand side of each constraint row.
z: Vec<Coef>Objective row, z_j - c_j per column (may contain the symbolic M).
z_rhs: CoefCurrent value of the objective (may contain the symbolic M in Big-M).
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn is_optimal(&self) -> bool
pub fn is_optimal(&self) -> bool
true when no column can improve the objective: all z_j - c_j >= 0 when
maximizing, all <= 0 when minimizing.
Sourcepub fn is_feasible(&self) -> bool
pub fn is_feasible(&self) -> bool
true when every right-hand side is >= 0. Primal methods keep this at every
iteration; the dual simplex works towards it, so its intermediate tableaus are
optimal but not feasible.