pub struct LinearProgram { /* private fields */ }Expand description
A linear program (see the module docs). Build with LinearProgram::new and the with_*
methods.
Implementations§
Source§impl LinearProgram
impl LinearProgram
Sourcepub fn new(objective: Vec<f64>) -> Self
pub fn new(objective: Vec<f64>) -> Self
A problem with the given objective coefficients and 0 <= x bounds on every variable.
Sourcepub fn with_less_equal(self, row: Vec<f64>, rhs: f64) -> Self
pub fn with_less_equal(self, row: Vec<f64>, rhs: f64) -> Self
Adds the constraint row · x <= rhs.
Sourcepub fn with_greater_equal(self, row: Vec<f64>, rhs: f64) -> Self
pub fn with_greater_equal(self, row: Vec<f64>, rhs: f64) -> Self
Adds the constraint row · x >= rhs.
Sourcepub fn with_equal(self, row: Vec<f64>, rhs: f64) -> Self
pub fn with_equal(self, row: Vec<f64>, rhs: f64) -> Self
Adds the constraint row · x = rhs.
Sourcepub fn with_bounds(self, index: usize, lower: f64, upper: f64) -> Self
pub fn with_bounds(self, index: usize, lower: f64, upper: f64) -> Self
Sets the bounds of variable index.
Sourcepub fn with_free_variable(self, index: usize) -> Self
pub fn with_free_variable(self, index: usize) -> Self
Makes variable index unrestricted in sign.
Sourcepub fn solve(&self) -> Result<LpSolution, ErrorsJSL>
pub fn solve(&self) -> Result<LpSolution, ErrorsJSL>
Solves the program. Infeasible and unbounded programs are reported through
LpSolution::status; an error means invalid input, or (only conceivably, through
rounding) that 50 000 pivots passed without termination, which used to be reported as
optimal.
Trait Implementations§
Source§impl Clone for LinearProgram
impl Clone for LinearProgram
Auto Trait Implementations§
impl Freeze for LinearProgram
impl RefUnwindSafe for LinearProgram
impl Send for LinearProgram
impl Sync for LinearProgram
impl Unpin for LinearProgram
impl UnsafeUnpin for LinearProgram
impl UnwindSafe for LinearProgram
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