Trait UserProblem

Source
pub trait UserProblem<LabelMeta: Meta, NodeWeight, EdgeWeight, BranchFilter> {
    // Required methods
    fn create_graph(&mut self) -> ProblemGraph<NodeWeight, EdgeWeight>;
    fn is_dominating(
        label_a: &Label<'_, LabelMeta>,
        label_b: &Label<'_, LabelMeta>,
        active_filters: &[BranchFilter],
    ) -> bool;
    fn extend_label<'arena>(
        &self,
        existing_label: &'arena Label<'arena, LabelMeta>,
        edge: &EdgeReference<'_, EdgeWeight>,
        source: &NodeWeight,
        target: &NodeWeight,
        active_filters: &[BranchFilter],
        sink: NodeIndex,
    ) -> Option<Label<'arena, LabelMeta>>;
}
Expand description

Main trait to implement that holds the user implementation of the problem.

Generics to implement:

  • LabelMeta : Data to be stored in labels
  • NodeWeight: Node attributes
  • EdgeWeight: Edge attributes
  • BranchFilter: Constraints made available during label extension

Required Methods§

Source

fn create_graph(&mut self) -> ProblemGraph<NodeWeight, EdgeWeight>

build your problem graph and return it

is called once during initialization of solver and then stored

Source

fn is_dominating( label_a: &Label<'_, LabelMeta>, label_b: &Label<'_, LabelMeta>, active_filters: &[BranchFilter], ) -> bool

Dominance function called in labeling algorithm. return true if label_a domiates label_b

Source

fn extend_label<'arena>( &self, existing_label: &'arena Label<'arena, LabelMeta>, edge: &EdgeReference<'_, EdgeWeight>, source: &NodeWeight, target: &NodeWeight, active_filters: &[BranchFilter], sink: NodeIndex, ) -> Option<Label<'arena, LabelMeta>>

Label extension function

Receives previous label, edge, node weights, branching filters, and reference to the sink node Return None if extension infeasible, otherwise return new Label.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§