pub struct LPSolver { /* private fields */ }Expand description
Unified LP/MIP solver
Implementations§
Source§impl LPSolver
impl LPSolver
Sourcepub fn with_config(config: LPConfig) -> Self
pub fn with_config(config: LPConfig) -> Self
Create with custom configuration
Sourcepub fn set_direction(&mut self, dir: OptDir)
pub fn set_direction(&mut self, dir: OptDir)
Set optimization direction
Sourcepub fn add_variable(&mut self, var: Variable) -> VarId
pub fn add_variable(&mut self, var: Variable) -> VarId
Add a variable
Sourcepub fn new_continuous(&mut self) -> VarId
pub fn new_continuous(&mut self) -> VarId
Create and add a continuous variable
Sourcepub fn new_integer(&mut self) -> VarId
pub fn new_integer(&mut self) -> VarId
Create and add an integer variable
Sourcepub fn new_binary(&mut self) -> VarId
pub fn new_binary(&mut self) -> VarId
Create and add a binary variable
Sourcepub fn add_constraint(&mut self, constraint: Constraint) -> ConstraintId
pub fn add_constraint(&mut self, constraint: Constraint) -> ConstraintId
Add a constraint
Sourcepub fn new_constraint(
&mut self,
coeffs: impl IntoIterator<Item = (VarId, BigRational)>,
sense: ConstraintSense,
rhs: BigRational,
) -> ConstraintId
pub fn new_constraint( &mut self, coeffs: impl IntoIterator<Item = (VarId, BigRational)>, sense: ConstraintSense, rhs: BigRational, ) -> ConstraintId
Create and add a constraint
Sourcepub fn set_objective(&mut self, var: VarId, coeff: BigRational)
pub fn set_objective(&mut self, var: VarId, coeff: BigRational)
Set objective coefficient
Sourcepub fn get_variable(&self, id: VarId) -> Option<&Variable>
pub fn get_variable(&self, id: VarId) -> Option<&Variable>
Get a variable
Sourcepub fn num_variables(&self) -> usize
pub fn num_variables(&self) -> usize
Get number of variables
Sourcepub fn num_constraints(&self) -> usize
pub fn num_constraints(&self) -> usize
Get number of constraints
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LPSolver
impl RefUnwindSafe for LPSolver
impl Send for LPSolver
impl Sync for LPSolver
impl Unpin for LPSolver
impl UnsafeUnpin for LPSolver
impl UnwindSafe for LPSolver
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