Struct lp_modeler::dsl::problem::LpProblem [−][src]
Structure used for creating the model and solving a linear problem.
Examples:
use lp_modeler::dsl::*; use lp_modeler::solvers::{SolverTrait, CbcSolver, Solution}; let ref a = LpInteger::new("a"); let ref b = LpInteger::new("b"); let ref c = LpInteger::new("c"); let mut problem = LpProblem::new("One Problem", LpObjective::Maximize); problem += 10.0 * a + 20.0 * b; problem += (500*a + 1200*b + 1500*c).le(10000); problem += (a + b*2 + c).le(10); problem += (a).le(b); let solver = CbcSolver::new(); match solver.run(&problem) { Ok( solution ) => { println!("Status {:?}", solution.status); for (name, value) in solution.results.iter() { println!("value of {} = {}", name, value); } }, Err(msg) => println!("{}", msg), }
Fields
name: &'static str
unique_name: String
objective_type: LpObjective
obj_expr_arena: Option<LpExpression>
constraints: Vec<LpConstraint>
Implementations
impl LpProblem
[src]
pub fn new(name: &'static str, objective: LpObjective) -> LpProblem
[src]
Create a new problem
pub fn variables(&self) -> HashMap<String, (usize, usize)>
[src]
Trait Implementations
impl AddAssign<LpConstraint> for LpProblem
[src]
Add constraints
fn add_assign(&mut self, _rhs: LpConstraint)
[src]
impl<T> AddAssign<T> for LpProblem where
T: Into<LpExpression>,
[src]
T: Into<LpExpression>,
Add an expression as an objective function
fn add_assign(&mut self, _rhs: T)
[src]
impl Debug for LpProblem
[src]
impl LpFileFormat for LpProblem
[src]
impl Problem for LpProblem
[src]
fn add_objective_expression(&mut self, expr_arena: &mut LpExpression)
[src]
fn add_constraints(&mut self, constraint_expr: &LpConstraint)
[src]
Auto Trait Implementations
impl RefUnwindSafe for LpProblem
impl Send for LpProblem
impl Sync for LpProblem
impl Unpin for LpProblem
impl UnwindSafe for LpProblem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,