[][src]Struct ddo::core::common::NodeInfo

pub struct NodeInfo {
    pub is_exact: bool,
    pub is_relaxed: bool,
    pub lp_len: i32,
    pub lp_arc: Option<Edge>,
    pub ub: i32,
}

The partial assignments (derived from longest paths in the MDD) form a chained structure. This structure is made of NodeInfo inter-connected by Edges. An NodeInfo keeps track of the metadata associated to a node. Namely, it is the NodeInfo which is capable of telling if the node is exact, the length of the longest path to it, etc..

Because the chained structure is reference counted, the NodeInfo + Edge representation is very efficient as it allows to pune the tree-shaped structure and forget about paths that are no longer relevant.

Fields

is_exact: bool

This flag is true iff the node owning this node-info is exact

is_relaxed: bool

This flag is true iff the node owning this node-info was created as the result of a node-merger during a relaxation step (see Relaxation.merge_nodes()).

lp_len: i32

The length of the longest path from the root node of the problem to the node owner of this NodeInfo.

lp_arc: Option<Edge>

The edge to the parent of this node along the longest path from root to here. The only case where this field should be None is at the root node of the problem. All other nodes should know their "best parent" and have a way to access it through here.

ub: i32

An upper bound on the best objective value attainable going through this node. (It is not the role of a nodeinfo to compute this value. The upper bound information is computed by the problem relaxation).

Methods

impl NodeInfo[src]

pub fn new(
    lp_len: i32,
    lp_arc: Option<Edge>,
    is_exact: bool,
    is_relaxed: bool
) -> NodeInfo
[src]

Constructor.

Creates a new node info from the longest path information (lp_len and lp_arc) along with a flag indicating if this denotes an exaxct node or not. The upper bound is set to a default value (the greatest i32)

pub fn merge(&mut self, other: Self)[src]

Merge other into this node. That is to say, it combines the information from two nodes that are logically equivalent (should be the same). Concretely, it means that it possibly updates the current node to keep the best longest path info, track the 'exactitude' of the node and keep the tightest upper bound.

Important note

This has nothing to do with the user-provided merge_* operators !

pub fn longest_path(&self) -> Vec<Decision>[src]

Returns the longest path (sequence of decisions) from the root of the problem until this node.

pub fn has_exact_best(&self) -> bool[src]

Returns true iff the parent of this node is either non existent or not a relaxed node.

Trait Implementations

impl Clone for NodeInfo[src]

impl Debug for NodeInfo[src]

impl Eq for NodeInfo[src]

impl Ord for NodeInfo[src]

NodeInfos can be ordered by considering their upper bound, the length of their longest path and their exactitude.

impl PartialEq<NodeInfo> for NodeInfo[src]

Two NodeInfo are (partially) equivalent if they are both exact, have the same longest path and upper bound.

impl PartialOrd<NodeInfo> for NodeInfo[src]

impl StructuralEq for NodeInfo[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.