Skip to main content

rmp_route_optimizer/
lib.rs

1//! # RMP Route Optimizer
2//!
3//! A high-performance route optimization library for waste collection, logistics,
4//! and delivery services using Eulerian circuit algorithms.
5//!
6//! ## Features
7//!
8//! - **Eulerian Circuit Optimization**: Solves the Chinese Postman Problem for efficient route planning
9//! - **Geographic Awareness**: Uses Haversine distance for accurate real-world routing
10//! - **Side-of-Street Routing**: Supports pickup side constraints (left/right/either)
11//! - **Graph Augmentation**: Automatically adds edges to make graphs Eulerian
12//! - **High Performance**: Optimized Rust implementation with minimal allocations
13//!
14//! ## Example
15//!
16//! ```rust
17//! use rmp_route_optimizer::{RouteOptimizer, Node, Edge, PickupSide};
18//!
19//! // Create nodes (locations)
20//! let nodes = vec![
21//!     Node { id: 1, lat: 40.7128, lon: -74.0060 },
22//!     Node { id: 2, lat: 40.7138, lon: -74.0070 },
23//!     Node { id: 3, lat: 40.7148, lon: -74.0080 },
24//! ];
25//!
26//! // Create edges (roads)
27//! let edges = vec![
28//!     Edge { from: 1, to: 2, cost: 100.0, oneway: false, side: PickupSide::Either },
29//!     Edge { from: 2, to: 3, cost: 100.0, oneway: false, side: PickupSide::Either },
30//!     Edge { from: 3, to: 1, cost: 100.0, oneway: false, side: PickupSide::Either },
31//! ];
32//!
33//! // Optimize route
34//! let optimizer = RouteOptimizer::new(nodes, edges);
35//! let circuit = optimizer.optimize_eulerian(1, false).unwrap();
36//!
37//! println!("Optimized route: {:?}", circuit.nodes);
38//! println!("Total cost: {}", circuit.total_cost);
39//! ```
40
41pub mod error;
42pub mod optimizer;
43pub mod types;
44
45pub use error::{OptimizationError, Result};
46pub use optimizer::RouteOptimizer;
47pub use types::{Edge, EulerianCircuit, Node, PickupSide};
48
49/// Library version
50pub const VERSION: &str = env!("CARGO_PKG_VERSION");