Skip to main content

Module algorithm

Module algorithm 

Source
Expand description

Route-finding algorithms. Includes MostLiquidAlgorithm, algorithm::BellmanFordAlgorithm, PathFrankWolfeAlgorithm, algorithm::WaterFillAlgorithm, and the pluggable Algorithm trait. Route-finding algorithms.

This module defines the Algorithm trait and built-in implementations. New algorithms can be added by implementing the trait.

Algorithms are generic over their preferred graph type, allowing them to use different graph crates (petgraph, custom, etc.) and leverage built-in algorithms.

§Adding a New Algorithm

External: Implement the Algorithm trait in your own crate and plug it into a WorkerPoolBuilder via with_algorithm. No changes to fynd-core required. See the custom_algorithm example.

Built-in: To add an algorithm to the built-in registry:

  1. Create a new module with your algorithm implementation
  2. Implement the Algorithm trait
  3. Register it in worker_pool/registry.rs

From outside this crate: implement the trait and bring it in with AlgorithmRegistry; no change here is needed.

Re-exports§

pub use bellman_ford::BellmanFordAlgorithm;
pub use most_liquid::MostLiquidAlgorithm;
pub use path_frank_wolfe::PathFrankWolfeAlgorithm;
pub use registry::AlgorithmRegistry;
pub use registry::RegisterAlgorithmError;
pub use request::SolveParts;
pub use request::SolveRequest;
pub use water_fill::WaterFillAlgorithm;

Modules§

bellman_ford
Bellman-Ford algorithm with SPFA optimization for simulation-driven routing.
most_liquid
Most Liquid algorithm implementation.
path_frank_wolfe
Path-based Frank-Wolfe split-routing algorithm.
paths
Enumerating and simulating routes between two tokens. Finding, ranking and simulating routes that name a pool for every leg.
registry
Custom Algorithm implementations, held by name.
request
What an algorithm is given to solve one order. What an algorithm is given to solve one order.
sim_meter
Measurement of the simulation work one solve does.
split_primitives
Shared machinery for algorithms that divide an order across several paths.
swap_cache
Remembers what a pool paid, so one solve asks it once per amount.
water_fill
Water-fill split-routing algorithm (water_fill).

Structs§

AlgorithmConfig
Configuration for an Algorithm instance.

Enums§

AlgorithmError
Errors that can occur during route finding.
NoPathReason
Reason why no path was found between tokens.

Traits§

Algorithm
Trait for route-finding algorithms.