routik-solver 0.1.0

Core VRP solver (CVRPTW): data model, cost-matrix trait, Clarke-Wright construction, local search, and simulated annealing.
Documentation
//! # routik-solver
//!
//! Pure VRP core (no I/O) for the capacitated VRP with time windows (CVRPTW).
//! It holds the data model, the [`CostMatrix`] abstraction, the Clarke-Wright
//! savings construction, the local-search neighbourhoods, and a simulated-
//! annealing metaheuristic ([`solve`]).
//!
//! The solver depends on the [`CostMatrix`] trait **only** — distances and
//! times come from behind it, never from a baked-in map engine. Implementations
//! are [`HaversineMatrix`] (straight-line + a configurable speed) and
//! [`EuclideanMatrix`] (planar, unit speed — the Solomon-benchmark convention).
//!
//! Hard constraints (capacity, time windows) are always respected;
//! [`solve`] never returns a worse solution than the construction baseline
//! under the configured [`Objective`], and is deterministic for a given seed.
//!
//! ```
//! use routik_solver::{solve, Coord, HaversineMatrix, Problem, SolverConfig, Stop, StopId, Vehicle, VehicleId};
//!
//! let problem = Problem {
//!     depot: Coord::new(48.8566, 2.3522),
//!     stops: vec![Stop {
//!         id: StopId(1),
//!         coord: Coord::new(48.8606, 2.3376),
//!         demand: 10,
//!         time_window: None,
//!         service_time: 0.1,
//!     }],
//!     vehicles: vec![Vehicle { id: VehicleId(1), capacity: 50 }],
//!     depot_window: None,
//! };
//! let matrix = HaversineMatrix::from_problem(&problem, 50.0);
//! let solution = solve(&problem, &matrix, &SolverConfig::default()).expect("feasible");
//! assert!(solution.feasible);
//! ```

pub mod anneal;
pub mod clarke_wright;
mod feasibility;
pub mod matrix;
pub mod model;
pub mod objective;
mod search;

/// Property-test / fuzz support: an independent invariant oracle and an
/// `arbitrary`-driven instance builder. Compiled for the crate's own tests and,
/// behind the `fuzzing` feature, for the external cargo-fuzz crate.
#[cfg(any(test, feature = "fuzzing"))]
pub mod testkit;

#[cfg(test)]
mod proptest_suite;

pub use anneal::{Budget, SolveStats, SolverConfig, solve, solve_with_stats};
pub use clarke_wright::{SolveError, clarke_wright};
pub use matrix::{CostMatrix, EuclideanMatrix, HaversineMatrix, MatrixError, ProvidedMatrix};
pub use model::{
    Coord, LocationId, Problem, Route, Solution, Stop, StopId, TimeWindow, Unassigned,
    UnassignedCode, Vehicle, VehicleId,
};
pub use objective::Objective;