pub fn lp_from_str(text: &str) -> Result<LpProblem, GeomError>Expand description
Parses a linear program from text.
The grammar is deliberately tiny:
max 3x + 5y
subject to
x <= 4
2y <= 12
3x + 2y <= 18
bounds
y >= 1
free zThe first line gives the sense and the objective. Everything after
subject to (or st, or s.t.) is a constraint row until an optional
bounds section, where single-variable lines set bounds rather than adding
rows and free x removes a variable’s lower bound. Blank lines and #
comments are ignored, coefficients may be omitted, and variables are
numbered in order of first appearance.
§Errors
Returns GeomError::InvalidArgument naming the first thing that could
not be read.