[][src]Struct slp::LP

pub struct LP { /* fields omitted */ }

Represents an LP instance

Methods

impl LP[src]

pub fn new_from_stdin() -> Self[src]

Input is taken from stdin.

Example input format for

max        2x1 + 3x2
subject to 2x1 +  x2 <= 18
           6x1 + 5x2 <= 60
           2x1 + 5x2 <= 40
            x1       >= 0
            x2       >= 0

is

3 2 # 3 is number of constraints and 2 is number of variables
2 3 # coefficients of objective function to be maximized: 2x1 + 3x2
2 1 18 # Constraint 1: 2x1 +  x2 <= 18
6 5 60 # Constraint 2: 6x1 + 5x2 <= 60
2 5 40 # Constraint 3: 2x1 + 5x2 <= 40
# x1 >= 0 and x2 >= 0 are always assumed

# is used for comments.

pub fn new_from_file(input_file: &str) -> Self[src]

Input is taken from a file.

See new_from_stdin function for input format.

pub fn new_from_buf_reader<F>(reader: &mut F) -> LP where
    F: BufRead
[src]

Input is taken from a reader that implements std::io::BufRead.

See new_from_stdin function for input format.

pub fn solve(&mut self) -> Solution[src]

Solves the LP.

Uses naive version of simplex method.

Returns a solution.

Auto Trait Implementations

impl Send for LP

impl Sync for LP

impl Unpin for LP

impl RefUnwindSafe for LP

impl UnwindSafe for LP

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]