Forecast
Each obstacle’s velocity is extrapolated over a horizon of h = 3 steps with specular reflection at the walls, giving predicted cells p̂o(t+τ).
Anticipating obstacle movement instead of reacting to the present. APGRP forecasts where every obstacle will be, prices that forecast into A*’s edge costs, and raises navigation success from 46% to 78% in 100-obstacle dynamic swarms.
A* is optimal on the graph it is given. Among moving obstacles the graph it is given is a snapshot of the present, and by the time the agent takes its first step that snapshot is wrong.
Running live: real 8-connected A*, recomputed from scratch on every timestep. Replanning is not the issue — even a perfect replanner is steering by where obstacles are, never where they are going.
The planner freezes the world, searches it, and returns a path. The obstacles then move. Every edge the path depends on was costed against positions that no longer hold.
A gap that is open at planning time can be sealed by two obstacles converging on it. The agent is already committed and walks into the closure.
With 100 obstacles on a 50×50 grid the number of corridors that can close within the planning horizon rises sharply. Vanilla A* drops to 46.0% ± 15.2 success, with 54% of episodes ending in collision.
Forbidding every predicted-occupied cell is the obvious patch, and in a dense swarm it eliminates every corridor at once — the planner simply reports failure. The fix has to be softer than that.
APGRP projects obstacle occupancy forward, accumulates it into a spatial risk field, and adds that field to A*’s edge costs. A likely-occupied cell becomes expensive — never blocked — so a path always exists, merely a costly one.
Each obstacle’s velocity is extrapolated over a horizon of h = 3 steps with specular reflection at the walls, giving predicted cells p̂o(t+τ).
Each forecast deposits mass through an 8-neighbour kernel — 1.0 at the predicted cell, 0.25 on the ring — decayed by λτ−1 so imminent hazards dominate.
The field enters A*’s edge cost directly. The heuristic stays Euclidean, which remains admissible for 8-connected motion, so the search is still optimal with respect to the new costs.
Wpred appears in both Eq. (1) and Eq. (3), so the effective penalty on predicted occupancy is 64× per unit kernel mass. The double application was not intentional in the original design, and it is the configuration every number on this page was produced under — reported as such rather than silently rescaled. At this setting the planner is biased strongly toward detours.
Height is accumulated risk. Ghost markers are forecast positions at τ = 1–3. The planner does not route around a wall — it routes around a hill, and will cross a low shoulder if the detour would cost more. The surface uses a smooth falloff for legibility; the implementation uses the discrete kernel of Eq. (2).
Every predicted-occupied cell removed from the graph. In a dense swarm the predicted footprints overlap until no corridor survives the horizon.
Predicted occupancy raises the price of a cell. The graph stays fully connected, so the search always returns something — the cheapest compromise available.
This is the design decision the whole result rests on. Treating prediction as a price rather than a prohibition is what lets the planner keep operating at a density where a hard predictive constraint would deadlock it.
Both planners below are driving through the identical obstacle field on the identical timeline. The only thing that differs is whether A*’s edge costs include the risk field. Watch the right-hand agent commit to detours before the gap closes.
Costs are distance only. No forecast is used.
Violet heat is the risk field; white pips are forecasts at τ = 1–3.
What you are watching. This is the actual algorithm, not a scripted animation: constant-velocity forecasting, the decayed 8-neighbour kernel of Eq. (1)–(2), and 8-connected A* over the risk-inflated costs of Eq. (3), with Wpred applied twice exactly as in the implementation — including the quirk that random-walking obstacles are extrapolated linearly, so prediction is wrong for precisely the least predictable ones. It runs at reduced scale to hold framerate (22×22 with 20 obstacles against the paper’s 50×50 with 100) but at the same ~4% obstacle density and the same motion mix of three linear patterns plus roughly a quarter random walkers at 1–2 cells per step. Over 400 headless episodes that calibration reproduces the benchmark regime closely: 47% against 75% here, 46% against 78% in the paper. The counters above are nonetheless live output from your browser, not measurements — the measured results are in the next section.
Both controllers evaluated on the same episodes, with the same seeds, through the same evaluation code path. The only thing that varies is whether the risk field is active.
| Metric | Vanilla A* | Predictive A* | Change |
|---|---|---|---|
| Success rate | 0.460 ± 0.152 | 0.780 ± 0.135 | +32.0 pp |
| Collision rate | 0.540 ± 0.152 | 0.220 ± 0.135 | −32.0 pp |
| Close encounters per step | 1.001 ± 0.093 | 0.590 ± 0.028 | −41% |
| Mean min. clearance (cells) | 0.50 ± 0.13 | 1.01 ± 0.28 | 2.0× |
| Timeout rate | 0.000 | 0.000 | — |
| Mean episode length (steps) | 14.45 ± 2.18 | 40.76 ± 7.65 | see note |
Encounters per step is the normalized safety metric and the one to read: raw cumulative counts reward simply surviving longer, which is survivorship bias in an environment where collision truncates the episode. Episode length is longer for predictive A* for exactly that reason — vanilla A*’s episodes are short because 54% of them end in a crash, not because it is faster.
| Condition | Vanilla A* | Predictive A* | Difference | Verdict |
|---|---|---|---|---|
| Static Sparse 0 moving obstacles | 1.000 ± 0.000 | 1.000 ± 0.000 | 0.000 | no effect — nothing to forecast |
| Dynamic Sparse 5 moving obstacles | 0.920 ± 0.045 | 0.990 ± 0.022 | +0.070 | right sign, p = 0.080, underpowered |
| Dynamic Dense 100 moving obstacles | 0.460 ± 0.152 | 0.780 ± 0.135 | +0.320 | significant, Holm p = 0.021 |
This is a targeted method, not a universal improvement, and the table is here to say so plainly. With no moving obstacles the risk field is identically zero and changes nothing. With five it helps by seven points, consistent in sign but not significant at five seeds. The method is built for density, and density is where it pays: the sparser the scene, the less there is to anticipate.
Per-step timings for the full control loop in the dense condition, measured on an Intel Core i7-12650H class mobile CPU over 400 warmed repetitions, single-threaded.
| Component | Median | Mean | p90 |
|---|---|---|---|
| Predictive risk field | 6.07 ms | 7.02 ms | 11.69 ms |
| Risk-aware A*, per call | 29.96 ms | 30.32 ms | 42.64 ms |
| Full environment step | 11.07 ms | 22.04 ms | 58.99 ms |
| End-to-end control loop | 13.03 ms | 23.60 ms | 61.36 ms |
The loop costs less than the risk field plus a full A* call because path-index caching means A* does not run on every step; the heavy tail is the steps on which it does. This is an unoptimized pure-Python reference implementation — the risk field is a triple-nested loop over obstacles, horizons and the 3×3 kernel with no vectorization — so these figures bound the cost of this code, not of the algorithm. A vectorized field would be a small fraction of this.
The risk field sits inside a larger architecture that also carries a reactive PPO policy and a context-driven weight αt that chooses between the two each step. It is included here for completeness. It is not the source of the measured improvement — everything above is the planner.
Across 60 training runs — 4 architectures × 3 densities × 5 seeds, 300,000 steps each — the full stack reaches 0.680 ± 0.091 in Dynamic Dense. Its own predictive planner, running with no learned policy at all, reaches 0.780 ± 0.135 on the same episodes.
The two are statistically indistinguishable at five seeds, and the weight sits near 1 almost always, so the planner emits nearly every action. The arbitration layer is therefore reported as a secondary mechanism: present in the architecture, but not what produces the 46→78 improvement this page is about. Attributing that improvement to the planner, not the policy, is the whole reason the planner-alone control was run.