mod builders;
mod sections;
mod state;
#[cfg(test)]
mod tests;
pub mod writer;
pub use state::{extract_mps_name, parse_mps};
use crate::lexer::RawCoefficient;
use crate::model::SOSType;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) enum MpsSection {
Name,
ObjSense,
Rows,
Columns,
Rhs,
Ranges,
Bounds,
Sos,
Unsupported,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) enum RowType {
N,
L,
G,
E,
}
#[derive(Debug, Default)]
pub(super) struct BoundAccumulator {
pub(super) lower: Option<f64>,
pub(super) upper: Option<f64>,
pub(super) fixed: Option<f64>,
pub(super) free: bool,
pub(super) binary: bool,
}
pub(super) fn strip_dollar_comments<'a>(fields: &[&'a str]) -> Vec<&'a str> {
debug_assert!(!fields.is_empty(), "strip_dollar_comments called with empty fields");
let mut result = Vec::with_capacity(fields.len());
for &field in fields {
if field.starts_with('$') {
break;
}
result.push(field);
}
debug_assert!(result.len() <= fields.len(), "result cannot exceed input length");
result
}