RMP Route Optimizer
A high-performance route optimization library for waste collection, logistics, and delivery services using Eulerian circuit algorithms.
Features
- Eulerian Circuit Optimization: Solves the Chinese Postman Problem for efficient route planning
- Geographic Awareness: Uses Haversine distance for accurate real-world routing
- Side-of-Street Routing: Supports pickup side constraints (left/right/either)
- Graph Augmentation: Automatically adds edges to make graphs Eulerian
- High Performance: Optimized Rust implementation with minimal allocations
- Zero-copy Serialization: Efficient data structures with serde support
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
Use Cases
Waste Collection
Optimize garbage truck routes to minimize fuel consumption and time:
use ;
// Define collection points
let collection_points = vec!;
// Define streets with pickup sides
let streets = vec!;
let optimizer = new;
let route = optimizer.optimize_eulerian.unwrap;
Delivery Services
Optimize package delivery routes:
// Similar setup but with delivery locations
let route = optimizer.optimize_eulerian.unwrap;
Street Sweeping
Plan efficient street cleaning routes:
// Use PickupSide::Either for street sweeping
let streets = vec!;
API Overview
Core Types
Node: Geographic location with ID, latitude, and longitudeEdge: Road segment connecting two nodes with cost and constraintsPickupSide: Enum for side-of-street constraints (Left/Right/Either)EulerianCircuit: Optimized route result with nodes, edges, and total cost
Main API
RouteOptimizer::new(nodes, edges): Create optimizer instanceoptimize_eulerian(start_node, enforce_right_side): Find optimal routehaversine_distance(node1, node2): Calculate geographic distance
Performance
Typical performance on modern hardware:
- Small graphs (10-50 nodes): <10ms
- Medium graphs (50-200 nodes): 10-100ms
- Large graphs (200-1000 nodes): 100ms-1s
- Memory usage: ~200-500MB for typical workloads
Algorithm Details
The library implements the Chinese Postman Problem solution:
- Graph Construction: Build directed/undirected graph from nodes and edges
- Eulerian Check: Verify if all vertices have even degree
- Graph Augmentation: Add minimum-weight edges to make graph Eulerian
- Circuit Finding: Use Hierholzer's algorithm to find Eulerian circuit
- Cost Calculation: Sum edge costs along the circuit
Features Flags
[]
= { = "0.1.0", = ["async", "logging"] }
async: Enable async/await support with Tokiologging: Enable tracing integration for debugging
Examples
See the examples/ directory for more:
simple_route.rs- Basic route optimizationwaste_collection.rs- Real-world waste collection scenario
Run examples:
Testing
Run the test suite:
Run with logging:
RUST_LOG=debug
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Acknowledgments
- Based on research in graph theory and the Chinese Postman Problem
- Inspired by real-world waste collection optimization needs
- Built with Rust for performance and safety
Links
Support
For questions and support:
- Open an issue on GitHub
- Email: dev@rmp.ca
- Website: https://rmp.ca