Struct Problem

Source
pub struct Problem<EXPR = StrExpression, VAR = Variable> {
    pub name: String,
    pub sense: LpObjective,
    pub objective: EXPR,
    pub variables: Vec<VAR>,
    pub constraints: Vec<Constraint<EXPR>>,
}
Expand description

A concrete linear problem

Fields§

§name: String

problem name. “lp_solvers_problem” by default Write the problem in the lp file format to the given formatter

§sense: LpObjective

Whether to maximize or minimize the objective

§objective: EXPR

Target objective function

§variables: Vec<VAR>

Variables of the problem

§constraints: Vec<Constraint<EXPR>>

List of constraints to apply

Trait Implementations§

Source§

impl<'a, EXPR: 'a, VAR: 'a> LpProblem<'a> for Problem<EXPR, VAR>

Source§

type Variable = &'a VAR

variable type
Source§

type Expression = &'a EXPR

expression type
Source§

type ConstraintIterator = Box<dyn Iterator<Item = Constraint<&'a EXPR>> + 'a>

Iterator over constraints
Source§

type VariableIterator = Iter<'a, VAR>

Iterator over variables
Source§

fn name(&self) -> &str

problem name. “lp_solvers_problem” by default
Source§

fn variables(&'a self) -> Self::VariableIterator

Variables of the problem
Source§

fn objective(&'a self) -> Self::Expression

Target objective function
Source§

fn sense(&self) -> LpObjective

Whether to maximize or minimize the objective
Source§

fn constraints(&'a self) -> Self::ConstraintIterator

List of constraints to apply
Source§

fn to_lp_file_format(&'a self, f: &mut Formatter<'_>) -> Result

Write the problem in the lp file format to the given formatter
Source§

fn display_lp(&'a self) -> DisplayedLp<'_, Self>
where Self: Sized,

Return an object whose fmt::Display implementation is the problem in the .lp format
Source§

fn to_tmp_file(&'a self) -> Result<NamedTempFile>
where Self: Sized,

Write the problem to a temporary file

Auto Trait Implementations§

§

impl<EXPR, VAR> Freeze for Problem<EXPR, VAR>
where EXPR: Freeze,

§

impl<EXPR, VAR> RefUnwindSafe for Problem<EXPR, VAR>
where EXPR: RefUnwindSafe, VAR: RefUnwindSafe,

§

impl<EXPR, VAR> Send for Problem<EXPR, VAR>
where EXPR: Send, VAR: Send,

§

impl<EXPR, VAR> Sync for Problem<EXPR, VAR>
where EXPR: Sync, VAR: Sync,

§

impl<EXPR, VAR> Unpin for Problem<EXPR, VAR>
where EXPR: Unpin, VAR: Unpin,

§

impl<EXPR, VAR> UnwindSafe for Problem<EXPR, VAR>
where EXPR: UnwindSafe, VAR: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.