NetworkSimplex

Struct NetworkSimplex 

Source
pub struct NetworkSimplex<G, F> {
    pub pricing: Pricing,
    pub zero: F,
    pub artificial_cost: Option<F>,
    pub infinite: F,
    /* private fields */
}
Expand description

A primal network simplex algorithm.

Fields§

§pricing: Pricing§zero: F

The (flow) value to be considered zero. Defaults to F::zero().

§artificial_cost: Option<F>

The artificial cost value.

Should be larger than the value of any augmenting cycle. If None (the default) the artificial cost is set to (max(max(cost), 0) + 1) * n, which should be large enough.

§infinite: F

The infinite flow value.

Capacities greater than or equal to this are considered unbounded and flows are considered infinite. The default is F::max_value(). For floating-point types F::infinity() can be used as well.

Implementations§

Source§

impl<G, F> NetworkSimplex<G, F>

Source

pub fn new(g: G) -> Self

Source

pub fn as_graph(&self) -> &G

Source

pub fn balance(&self, u: <G as GraphType>::Node<'_>) -> F

Source

pub fn set_balance(&mut self, u: <G as GraphType>::Node<'_>, balance: F)

Source

pub fn set_balances<'a, Bs>(&'a mut self, balance: Bs)
where Bs: Fn(<G as GraphType>::Node<'a>) -> F,

Source

pub fn lower(&self, e: <G as GraphType>::Edge<'_>) -> F

Source

pub fn set_lower(&mut self, e: <G as GraphType>::Edge<'_>, lb: F)

Source

pub fn set_lowers<'a, Ls>(&'a mut self, lower: Ls)
where Ls: Fn(<G as GraphType>::Edge<'a>) -> F,

Source

pub fn upper(&self, e: <G as GraphType>::Edge<'_>) -> F

Source

pub fn set_upper(&mut self, e: <G as GraphType>::Edge<'_>, ub: F)

Source

pub fn set_uppers<'a, Us>(&'a mut self, upper: Us)
where Us: Fn(<G as GraphType>::Edge<'a>) -> F,

Source

pub fn cost(&self, e: <G as GraphType>::Edge<'_>) -> F

Source

pub fn set_cost(&mut self, e: <G as GraphType>::Edge<'_>, cost: F)

Source

pub fn set_costs<'a, Cs>(&'a mut self, cost: Cs)
where Cs: Fn(<G as GraphType>::Edge<'a>) -> F,

Source

pub fn value(&self) -> F

Return the value of the latest computed flow value.

Source

pub fn flow(&self, a: <G as GraphType>::Edge<'_>) -> F

The flow of an Edge.

Source

pub fn solve(&mut self) -> SolutionState

Solve the min-cost-flow problem.

Source

pub fn solution_state(&self) -> SolutionState

Return the solution state of the latest computation.

Source

pub fn num_iterations(&self) -> usize

Auto Trait Implementations§

§

impl<G, F> Freeze for NetworkSimplex<G, F>
where G: Freeze, F: Freeze,

§

impl<G, F> RefUnwindSafe for NetworkSimplex<G, F>

§

impl<G, F> Send for NetworkSimplex<G, F>
where G: Send, F: Send,

§

impl<G, F> Sync for NetworkSimplex<G, F>
where G: Sync, F: Sync,

§

impl<G, F> Unpin for NetworkSimplex<G, F>
where G: Unpin, F: Unpin,

§

impl<G, F> UnwindSafe for NetworkSimplex<G, F>
where G: UnwindSafe, F: UnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.