Skip to main content

VerifyError

Enum VerifyError 

Source
#[non_exhaustive]
pub enum VerifyError { LengthMismatch { expected: usize, found: usize, }, CapacityViolated { arc: usize, flow: Flow, lower: Capacity, upper: Capacity, }, ConservationViolated { node: usize, net: Objective, supply: Flow, }, NegativeReducedCost { tail: usize, head: usize, reduced_cost: Cost, }, PotentialsDoNotExist { node: usize, }, NegativeCycle { numerator: i128, denominator: i128, node: usize, }, CertifiersDisagree { dual_verdict: &'static str, cycle_verdict: &'static str, }, CycleSearchDidNotConverge { iterations: u64, }, Overflow(Overflow), }
Expand description

A certificate could not be issued: the candidate solution is not feasible, not optimal, or not a solution to this problem at all.

Each variant is a counterexample, carrying the witness that refutes the claim — the arc whose capacity is exceeded, the node whose conservation fails, the residual arc whose reduced cost is negative.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LengthMismatch

The flow vector does not have one entry per arc.

Fields

§expected: usize

Arcs in the network.

§found: usize

Entries in the candidate flow vector.

§

CapacityViolated

Feasibility: an arc’s flow is outside [lower, upper].

Fields

§arc: usize

Index of the offending arc.

§flow: Flow

The flow proposed for it.

§lower: Capacity

Its lower bound.

§upper: Capacity

Its capacity.

§

ConservationViolated

Feasibility: flow is not conserved at a node.

Fields

§node: usize

The offending node.

§net: Objective

Outflow minus inflow at the node.

§supply: Flow

The node’s declared supply.

§

NegativeReducedCost

Dual certificate: a residual arc has negative reduced cost under the recomputed potentials, so the flow admits a cheaper rerouting and is not optimal.

Fields

§tail: usize

Tail of the offending residual arc.

§head: usize

Head of the offending residual arc.

§reduced_cost: Cost

Its reduced cost c(u,v) − π(u) + π(v).

§

PotentialsDoNotExist

Dual certificate: no potential function exists, because the residual graph has a negative cycle. Detected while computing the potentials.

Fields

§node: usize

A node on or reachable from the offending cycle.

§

NegativeCycle

Cycle check: the residual graph contains a cycle of negative mean cost, which can be cancelled for a strictly cheaper flow.

Fields

§numerator: i128

Numerator of the exact minimum cycle mean.

§denominator: i128

Denominator of the exact minimum cycle mean (always positive).

§node: usize

A node lying on the offending cycle.

§

CertifiersDisagree

The two optimality proofs disagreed. Both are suspect until this is resolved — by construction they cannot both be right.

The two certifiers share no code path precisely so that this can be observed rather than silently averaged away.

Fields

§dual_verdict: &'static str

What the dual certificate concluded.

§cycle_verdict: &'static str

What negative-cycle detection concluded.

§

CycleSearchDidNotConverge

Cycle check: policy iteration exceeded its safety bound without converging.

A certifier that can spin is not a certifier, so the search is bounded; reaching the bound is reported rather than silently treated as “no negative cycle found”.

Fields

§iterations: u64

The bound that was reached.

§

Overflow(Overflow)

An intermediate quantity left integer range while verifying.

Trait Implementations§

Source§

impl Clone for VerifyError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifyError

Source§

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

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

impl Display for VerifyError

Source§

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

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

impl Eq for VerifyError

Source§

impl Error for VerifyError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Overflow> for VerifyError

Source§

fn from(source: Overflow) -> Self

Converts to this type from the input type.
Source§

impl From<VerifyError> for SolveOrVerifyError

Source§

fn from(source: VerifyError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for VerifyError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VerifyError

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.