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: FThe (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: FThe 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>where
G: IndexDigraph,
F: Bounded + NumCast + NumAssign + PartialOrd + Copy + FromPrimitive + Signed,
impl<G, F> NetworkSimplex<G, F>where
G: IndexDigraph,
F: Bounded + NumCast + NumAssign + PartialOrd + Copy + FromPrimitive + Signed,
pub fn new(g: G) -> Self
pub fn as_graph(&self) -> &G
pub fn balance(&self, u: <G as GraphType>::Node<'_>) -> F
pub fn set_balance(&mut self, u: <G as GraphType>::Node<'_>, balance: F)
pub fn set_balances<'a, Bs>(&'a mut self, balance: Bs)
pub fn lower(&self, e: <G as GraphType>::Edge<'_>) -> F
pub fn set_lower(&mut self, e: <G as GraphType>::Edge<'_>, lb: F)
pub fn set_lowers<'a, Ls>(&'a mut self, lower: Ls)
pub fn upper(&self, e: <G as GraphType>::Edge<'_>) -> F
pub fn set_upper(&mut self, e: <G as GraphType>::Edge<'_>, ub: F)
pub fn set_uppers<'a, Us>(&'a mut self, upper: Us)
pub fn cost(&self, e: <G as GraphType>::Edge<'_>) -> F
pub fn set_cost(&mut self, e: <G as GraphType>::Edge<'_>, cost: F)
pub fn set_costs<'a, Cs>(&'a mut self, cost: Cs)
Sourcepub fn solve(&mut self) -> SolutionState
pub fn solve(&mut self) -> SolutionState
Solve the min-cost-flow problem.
Sourcepub fn solution_state(&self) -> SolutionState
pub fn solution_state(&self) -> SolutionState
Return the solution state of the latest computation.
pub fn num_iterations(&self) -> usize
Auto Trait Implementations§
impl<G, F> Freeze for NetworkSimplex<G, F>
impl<G, F> RefUnwindSafe for NetworkSimplex<G, F>where
G: RefUnwindSafe,
F: RefUnwindSafe,
impl<G, F> Send for NetworkSimplex<G, F>
impl<G, F> Sync for NetworkSimplex<G, F>
impl<G, F> Unpin for NetworkSimplex<G, F>
impl<G, F> UnwindSafe for NetworkSimplex<G, F>where
G: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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