Struct lp_modeler::dsl::problem::LpProblem[][src]

pub struct LpProblem {
    pub name: &'static str,
    pub unique_name: String,
    pub objective_type: LpObjective,
    pub obj_expr_arena: Option<LpExpression>,
    pub constraints: Vec<LpConstraint>,

Structure used for creating the model and solving a linear problem.


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 {
Ok( solution ) => {
    println!("Status {:?}", solution.status);
        for (name, value) in solution.results.iter() {
            println!("value of {} = {}", name, value);
    Err(msg) => println!("{}", msg),


name: &'static strunique_name: Stringobjective_type: LpObjectiveobj_expr_arena: Option<LpExpression>constraints: Vec<LpConstraint>


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

impl<T> AddAssign<T> for LpProblem where
    T: Into<LpExpression>, 

Add an expression as an objective function

impl Debug for LpProblem[src]

impl LpFileFormat for LpProblem[src]

impl Problem for LpProblem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.