Problem

Struct Problem 

Source
pub struct Problem<F> { /* private fields */ }
Expand description

A linear program in augmented/slack form (with only equality constraints).

Any linear program can be expressed in normal form (with only inequality constraints), slack form (with only equality constraints), or as a mixture of both. For more details on these forms, see the Wiki on linear programming. The slack form is most suited for algorithms such as the simplex algorithm and interior point methods.

To construct a slack form problem from a generic problem, use ProblemBuilder::new or Problem::target.

Variables throughout this module use the following naming convention for a slack problem:

min_x c ' x
st    A ' x == b
          x >= 0

With c the cost vector or target function, and constraints given by matrix A and vector b.

Implementations§

Source§

impl<F: Float> Problem<F>

Source

pub fn target(c: &Array1<F>) -> ProblemBuilder<'_, F>

Build a problem in slack form using the builder pattern.

Specify the cost vector c for which we will minimize c'x. Returns a ProblemBuilder object that can be further configured with equality and inequality constraints.

Source

pub fn A(&self) -> &Array2<F>

Return the constraint matrix

Source

pub fn b(&self) -> &Array1<F>

Return the constraint vector

Source

pub fn c(&self) -> &Array1<F>

Return the cost vector

Auto Trait Implementations§

§

impl<F> Freeze for Problem<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for Problem<F>
where F: RefUnwindSafe,

§

impl<F> Send for Problem<F>
where F: Send,

§

impl<F> Sync for Problem<F>
where F: Sync,

§

impl<F> Unpin for Problem<F>
where F: Unpin,

§

impl<F> UnwindSafe for Problem<F>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V