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§
Sourcetype Variable: AsVariable
type Variable: AsVariable
variable type
Sourcetype Expression: WriteToLpFileFormat
type Expression: WriteToLpFileFormat
expression type
Sourcetype ConstraintIterator: Iterator<Item = Constraint<Self::Expression>>
type ConstraintIterator: Iterator<Item = Constraint<Self::Expression>>
Iterator over constraints
Sourcetype VariableIterator: Iterator<Item = Self::Variable>
type VariableIterator: Iterator<Item = Self::Variable>
Iterator over variables
Required Methods§
Sourcefn variables(&'a self) -> Self::VariableIterator
fn variables(&'a self) -> Self::VariableIterator
Variables of the problem
Sourcefn objective(&'a self) -> Self::Expression
fn objective(&'a self) -> Self::Expression
Target objective function
Sourcefn sense(&'a self) -> LpObjective
fn sense(&'a self) -> LpObjective
Whether to maximize or minimize the objective
Sourcefn constraints(&'a self) -> Self::ConstraintIterator
fn constraints(&'a self) -> Self::ConstraintIterator
List of constraints to apply
Provided Methods§
Sourcefn to_lp_file_format(&'a self, f: &mut Formatter<'_>) -> Result
fn to_lp_file_format(&'a self, f: &mut Formatter<'_>) -> Result
Write the problem in the lp file format to the given formatter
Sourcefn display_lp(&'a self) -> DisplayedLp<'a, Self>where
Self: Sized,
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
Sourcefn to_tmp_file(&'a self) -> Result<NamedTempFile>where
Self: Sized,
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.