LpProblem

Trait LpProblem 

Source
pub trait LpProblem<'a>: Sized {
    type Variable: AsVariable;
    type Expression: WriteToLpFileFormat;
    type ConstraintIterator: Iterator<Item = Constraint<Self::Expression>>;
    type VariableIterator: Iterator<Item = Self::Variable>;

    // Required methods
    fn variables(&'a self) -> Self::VariableIterator;
    fn objective(&'a self) -> Self::Expression;
    fn sense(&'a self) -> LpObjective;
    fn constraints(&'a self) -> Self::ConstraintIterator;

    // Provided methods
    fn name(&self) -> &str { ... }
    fn to_lp_file_format(&'a self, f: &mut Formatter<'_>) -> Result { ... }
    fn display_lp(&'a self) -> DisplayedLp<'a, Self>
       where Self: Sized { ... }
    fn to_tmp_file(&'a self) -> Result<NamedTempFile>
       where Self: Sized { ... }
}
Expand description

Implemented by type that can be formatted as an lp problem

Required Associated Types§

Source

type Variable: AsVariable

variable type

Source

type Expression: WriteToLpFileFormat

expression type

Source

type ConstraintIterator: Iterator<Item = Constraint<Self::Expression>>

Iterator over constraints

Source

type VariableIterator: Iterator<Item = Self::Variable>

Iterator over variables

Required Methods§

Source

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

Variables of the problem

Source

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

Target objective function

Source

fn sense(&'a self) -> LpObjective

Whether to maximize or minimize the objective

Source

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

List of constraints to apply

Provided Methods§

Source

fn name(&self) -> &str

problem name. “lp_solvers_problem” by default

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<'a, 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§