Skip to main content

LpSolversCompat

Struct LpSolversCompat 

Source
pub struct LpSolversCompat<'a> { /* private fields */ }
Expand description

A validated wrapper that guarantees compatibility with lp-solvers.

Implementations§

Source§

impl<'a> LpSolversCompat<'a>

Source

pub fn try_new(problem: &'a LpProblem) -> Result<Self, LpSolversCompatError>

Try to create a compatible wrapper from an LpProblem.

§Errors

Returns an error if:

  • The Problem has multiple objectives
  • The Problem has no objectives
  • Any constraint uses strict inequalities (< or >)
§Panics

Panics if the problem has exactly one objective but it cannot be accessed (internal error)

Source

pub fn warnings(&self) -> &[LpSolversCompatWarning]

Returns any warnings generated during validation.

Source

pub fn is_fully_compatible(&self) -> bool

Returns true if there are no warnings.

Trait Implementations§

Source§

impl<'a> Debug for LpSolversCompat<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> LpProblem<'a> for LpSolversCompat<'a>

Source§

type Variable = VariableAdapter<'a>

variable type
Source§

type Expression = ExpressionAdapter<'a>

expression type
Source§

type ConstraintIterator = ConstraintIterator<'a>

Iterator over constraints
Source§

type VariableIterator = VariableIterator<'a>

Iterator over variables
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
Source§

fn name(&self) -> &str

problem name. “lp_solvers_problem” by default
Source§

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

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, Error>
where Self: Sized,

Write the problem to a temporary file

Auto Trait Implementations§

§

impl<'a> Freeze for LpSolversCompat<'a>

§

impl<'a> RefUnwindSafe for LpSolversCompat<'a>

§

impl<'a> Send for LpSolversCompat<'a>

§

impl<'a> Sync for LpSolversCompat<'a>

§

impl<'a> Unpin for LpSolversCompat<'a>

§

impl<'a> UnsafeUnpin for LpSolversCompat<'a>

§

impl<'a> UnwindSafe for LpSolversCompat<'a>

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.