$ show reinterpretcat/vrp
This repository is a comprehensive Vehicle Routing Problem (VRP) solver implemented in Rust, organized as a multi-crate workspace. It provides a command-line interface (vrp-cli), a core optimization library (vrp-core), a hyper-heuristic framework (rosomaxa), and format-specific crates for pragmatic JSON and scientific benchmarks (Solomon, Li&Lim, TSPLIB). The solver supports a wide range of VRP variants including capacity, time windows, skills, breaks, reloads, recharges, multi-depot, multi-trip, and route balancing. It employs advanced metaheuristics: ruin-and-recreate, local search (including LKH and SWAP*), and a custom evolutionary algorithm called ROSOMAXA that uses Growing Self-Organizing Maps (GSOM) for population diversity and Thompson sampling for dynamic operator selection. The codebase is highly modular with a trait-based feature system for composing constraints and objectives, type-safe dimension macros, and extensive test coverage including property-based tests. While primarily an application/library, it also contains research experiments (heuristic visualization, GPT-based encoding) and scientific benchmark integration. The project is actively maintained but explicitly labeled as 'permanently experimental' with limited support, and the API may introduce breaking changes in minor versions.
The LLM identified 5 files worth highlighting for reuse:
Defines the core trait system for VRP features: FeatureConstraint, FeatureObjective, FeatureState, and FeatureBuilder. This pattern allows composing arbitrary constraints and objectives into a GoalContext, enabling extensible VRP variant support. The design is clean, generic, and reusable for any combinatorial optimization problem requiring pluggable constraints and objectives.
Implements a generic multi-armed bandit using Thompson sampling with Normal-Inverse-Gamma conjugate prior for non-stationary rewards. Used for dynamic operator selection in the hyper-heuristic. The implementation is self-contained, well-documented, and can be extracted for any RL-based selection problem.
Implements a Growing Self-Organizing Map (GSOM) network with node insertion, weight adjustment, error distribution, and min-max normalization. Used in the Rosomaxa population algorithm to maintain diversity. The implementation is isolated, generic, and reusable for any unsupervised clustering or dimensionality reduction task.
Provides macros like custom_dimension!, custom_solution_state!, custom_tour_state!, and custom_activity_state! that generate type-safe accessor functions for storing arbitrary metadata on domain objects (jobs, routes, solutions). This pattern eliminates string-keyed maps and provides compile-time safety, reusable in any Rust project needing extensible property storage.
Provides parallel iteration utilities (map_reduce, parallel_into_collect, parallel_collect, parallel_foreach_mut) with a WASM-compatible fallback using single-threaded execution. The abstraction is clean, reusable, and solves the common problem of writing parallel code that works both on native and WebAssembly targets.