From heuristic baselines to a DDQN agent on an isotropic H3 grid over the Mediterranean Sea
International shipping accounts for approximately 3% of global greenhouse gas emissions. The IMO's 2023 revised strategy targets net-zero emissions by 2050, with an interim 20–30% reduction by 2030 relative to 2008 levels. Voyage optimisation — choosing the safest, most fuel-efficient route through dynamic, weather-varying ocean conditions — is one of the most tractable near-term levers available to fleet operators today.
Classical methods (A*, Dijkstra, Tabu Search) are fast and interpretable, but static: they plan once and cannot adapt to evolving weather mid-voyage. Reinforcement learning agents, by contrast, learn a policy that can be continuously updated online as new forecasts arrive.
Latinopoulos et al. (JMSE, 2025) is the state of the art: DDQN and DDPG agents on a uniform 0.25° lat/lon grid, achieving 8.7–12.6% fuel savings over a shortest-path baseline on a real Mediterranean route. It is a strong result — and it was this paper that motivated this project. But it has two structural limitations:
Before training any neural network, a full suite of heuristic pathfinding algorithms was implemented on the same routes, mirroring the baseline comparison in Latinopoulos et al.
| Route | Distance | Challenge |
|---|---|---|
| Port Torres ↔ Marseille | 371 km | Open water, Sardinia–France |
| Cagliari ↔ Marseille | 552 km | Longer, coastal navigation |
| Piraeus ↔ Marseille | 1,647 km | Greece–France via Corinth Canal |
| Method | Description |
|---|---|
| Searoute API | Industry maritime routing service (reference baseline) |
| Dijkstra (H3 graph) | Optimal shortest path on hexagonal grid |
| A* (H3 graph) | Haversine heuristic, 20 kt cruise speed |
| Tabu Search | Meta-heuristic, 500 iterations, avoids cycling; best heuristic fuel performance (−13.8% vs baseline) |
Combined effect: given the same seed, two training runs produce identical environment transitions. Variance in results reflects only policy learning, not environment noise.
Uniform 28 km per cell everywhere. Aligns with ERA5 data. But: diagonal step = √2 × cardinal step = 1.41× longer. 8 actions with two distinct step lengths. Q-values encode a geometric artefact. Straits <28 km inaccessible. Corinth Canal: teleportation shortcut.
All 6 neighbours equidistant — always. 6 actions, all equal cost. Q(s,"move NE") = Q(s,"move N") under same progress. Reward shaping geometrically unambiguous. Coastal resolution 3.7 km. Straits and canals navigable.
| Zone | Resolution | Cell size | Purpose |
|---|---|---|---|
| Open ocean | Res-5 | ~9.85 km edge / ~28 km c-to-c | Matches Latinopoulos. Efficient BFS. |
| Within 40 km of coast | Res-6 | ~3.7 km edge / ~10 km c-to-c | Straits, canal approaches, harbours become navigable corridors |
The adaptive boundary is computed automatically: any res-5 water cell adjacent to a land cell is replaced by its 7 res-6 children, each independently classified by polygon land-fraction (threshold ≥ 0.20 → excluded). This is a polygon-level check, not a centroid check. Result: 10,937 water/coastal cells across the Mediterranean.
The 6.3 km wide, 6 km long Corinth Canal connects the Aegean to the Ionian. Rather than teleporting the agent, we model it as a navigable res-6 hex corridor extracted from OpenStreetMap geometry:
The agent learns to enter, traverse, and exit the canal as part of its policy — no special-case logic in the reward or step function. Other straits handled automatically by res-6 refinement: Bonifacio (~12 km), Gibraltar (~14 km), Messina (~3 km, borderline).
| Dim | Feature | Range |
|---|---|---|
| φ̂ | Normalised latitude | [0, 1] |
| λ̂ | Normalised longitude | [0, 1] |
| d̂BFS | BFS hops to goal / initial hops | [0, 1] |
| d̂hav | Haversine dist / initial dist | [0, 1] |
| tfrac | Step count / max steps | [0, 1] |
| ψ̂ | Last action bearing / 360° | [0, 1] |
| Δd̂ | Progress this step (normalised) | [−1, 1] |
| v̂ | Visit count at current hex (norm) | [0, 1] |
Action space: 7 discrete actions — 6 H3 ring-1 neighbours sorted clockwise from North + STAY. Binary action mask m ∈ {0,1}⁷ prevents stepping onto land; computed once and cached per hex.
Failure on Piraeus: reward rose from −773 → +315/episode over 1,500 episodes while success rate stayed at exactly 0%. Agent farmed the progress signal through oscillation. The non-Markovian step-efficiency term violated the MDP assumption entirely.
| Hyperparameter | Value |
|---|---|
| Optimizer | Adam, lr = 5×10⁻⁴ |
| Replay buffer | 1,000,000 transitions (numpy ring buffer) |
| Mini-batch | 128 transitions, sampled uniformly |
| Gradient clip | ‖∇θ‖₂ ≤ 1.0 |
| Exploration | ε-greedy, ε: 1.0 → 0.01 (×0.995/ep) |
| Soft update | τ = 0.001, every 5 gradient steps |
| Discount γ | 0.99 |
The reward function has 13 interacting parameters. Manual grid search is infeasible. Optuna's TPE sampler (Tree-structured Parzen Estimator) was run in parallel on NVIDIA L4 GPUs via Modal cloud compute (~$50 / 50 trials). Search space: progress_scale [8–30], goal_reward [20–100], land_penalty, ping-pong/loop3 coefficients, revisit_multiplier, time_penalty, gamma [0.93–0.999], clip bounds.
Fitness: success_rate − 0.2×clipping_rate − 0.05×orbit_rate. H3 grid built once per worker; only env.reset() between trials.
Cold-start problem: random-walk exploration covers ≈√500 ≈ 22 hops in a 500-step episode; the goal is 107 hops away — effectively invisible.
| Stage | Segment | Steps | Episodes | Threshold |
|---|---|---|---|---|
| 1 | Origin → Midpoint | 150 | 200 | 80% |
| 2 | Midpoint → Destination | 150 | 200 | 80% |
| …N | Segment pairs combined | ↑ | ↑ | 80% |
| Final | Full route | 300 | 400 | 70% |
BFS-seeded replay buffer pre-populates with optimal trajectories, bootstrapping Q-values before exploration begins.
| Feature | Latinopoulos (2025) | This Work |
|---|---|---|
| Grid type | Orthogonal lat/lon | H3 hexagonal |
| Resolution | 0.25° uniform (~28 km) | Adaptive res-5/6 (10–28 km) |
| Coastal resolution | 28 km everywhere | 3.7 km near coastline |
| Canal handling | Teleportation shortcut | Explicit corridor + BFS |
| Neighbour distances | 8 dirs, unequal | 6 dirs, always equal |
| Action space | 285 (speed × heading) | 7 discrete directions |
| Routes validated | 1 route | 2 routes (100%, 99%) |
| DDQN fuel saving | −8.7% vs baseline | To be evaluated |
Data: ECMWF ERA5 (Copernicus CDS) — 10m wind (U,V), significant wave height, mean wave direction & period, SST, MSLP. Resolution: 0.25°×0.25°, 3-hourly. Coverage: 34°N–46°N, −6°E–30°E. Processing: WeatherProcessor — load GRIB, spatial interpolation onto H3 nodes, temporal interpolation for ship ETA at each hex, cache as NetCDF.
Integration plan: (1) Add weather features to 8D state vector; (2) Wave-heading penalty; (3) Validate weather-aware vs weather-agnostic agent; (4) Online fine-tuning every 6 hours (Latinopoulos: ~15 min GPU update — viable for operational shipping).
Current limitation (shared with Latinopoulos): fuel modelled with fixed analytical formula. Real ships burn non-linearly as a function of sea state, heading, loading, and hull fouling. Proposed: MLP or LSTM trained on AIS voyage logs + ERA5 (no proprietary data required). Inputs: trim, speed, currents, wave height/direction/period, SST. Output: L/hour. Integration: replace r_fuel = fixed × distance with r_fuel = FOC_model(state, action, weather) × Δt — closing the loop so the agent directly optimises real predicted fuel burn.