Predictive planning for dense dynamic environments

Predictive risk fields for navigation in dense dynamic environments

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.

Drag to orbitScroll to explore
Target scenario
100 moving obstacles
speed 1–2 cells/step, four motion patterns
Environment
50 × 50 grid
8-connected moves, 250-step cap
Evaluation
100 episodes
5 seeds × 20, paired by seed
Planning cost
6 ms / step
risk field, unoptimized Python

A* plans over a world that has already moved

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.

Vanilla A* — replanning every single step
Replanning every step… Collisions 0 / 0

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.

01

The snapshot is stale on arrival

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.

02

Corridors close behind the plan

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.

03

Density makes it worse, fast

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.

04

Hard predictive constraints don’t fix it

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.

Price the future, don’t forbid it

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.

1

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+τ).

2

Accumulate

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.

3

Price

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.

Eq. 1 Rt(c) = ∑o ∑τ=1..h Wpred · λτ−1 · K(c, p̂o(t+τ))
Eq. 2 K(c, p) = 1.0 if c = p  ·  0.25 if ∥c − p∥∞ = 1  ·  0 otherwise
Eq. 3 cost(u, v) = ∥u − v∥2 + Wpred · Rt(v)
Horizon h
3 steps
Decay λ
0.7
Wpred
8.0

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.

The risk field as terrain
Risk surface · 3-step horizon
Predicted risk Risk-aware A* path Forecast position

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).

Why soft beats hard
Hard constraint

Every predicted-occupied cell removed from the graph. In a dense swarm the predicted footprints overlap until no corridor survives the horizon.

Planner returns no path
Soft cost (APGRP)

Predicted occupancy raises the price of a cell. The graph stays fully connected, so the search always returns something — the cheapest compromise available.

Planner returns a detour

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.

Same world, same obstacles, one difference

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.

Live in your browser — same A*, same risk field, smaller grid
Vanilla A* Navigating
Success0%
Episodes0

Costs are distance only. No forecast is used.

Predictive A* — APGRP Navigating
Success0%
Episodes0

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.

Dynamic Dense — 100 moving obstacles

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.

0
Success rate
46.0% → 78.0%, p = 0.0069
0%
Collision rate
0.540 → 0.220 per episode
0×
Clearance to threats
0.50 → 1.01 cells, mean minimum

Vanilla A* against predictive A* — Dynamic Dense, mean ± SD over 5 seeds

MetricVanilla A*Predictive A*Change
Success rate0.460 ± 0.1520.780 ± 0.135+32.0 pp
Collision rate0.540 ± 0.1520.220 ± 0.135−32.0 pp
Close encounters per step1.001 ± 0.0930.590 ± 0.028−41%
Mean min. clearance (cells)0.50 ± 0.131.01 ± 0.282.0×
Timeout rate0.0000.000—
Mean episode length (steps)14.45 ± 2.1840.76 ± 7.65see note
+32.0 points t(4) = 5.12 · p = 0.0069 · Holm p = 0.021 · Cohen’s d = 2.29 significant

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.

Where the risk field helps — and where it does nothing

ConditionVanilla A*Predictive A*DifferenceVerdict
Static Sparse
0 moving obstacles
1.000 ± 0.0001.000 ± 0.0000.000no effect — nothing to forecast
Dynamic Sparse
5 moving obstacles
0.920 ± 0.0450.990 ± 0.022+0.070right sign, p = 0.080, underpowered
Dynamic Dense
100 moving obstacles
0.460 ± 0.1520.780 ± 0.135+0.320significant, 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.

What anticipation costs

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.

ComponentMedianMeanp90
Predictive risk field6.07 ms7.02 ms11.69 ms
Risk-aware A*, per call29.96 ms30.32 ms42.64 ms
Full environment step11.07 ms22.04 ms58.99 ms
End-to-end control loop13.03 ms23.60 ms61.36 ms
77 Hz median 16 Hz at the 90th percentile · 100 obstacles · h = 3 real-time

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.

Scope and caveats

  • Density is the operating point. The gain is significant only in the 100-obstacle condition. With no moving obstacles the method is a no-op, and at five obstacles the effect is positive but underpowered.
  • Abstracted kinematics. A discrete, 8-connected gridworld. Continuous non-holonomic dynamics — acceleration limits, slip, turning radii — are abstracted away and the transfer is untested.
  • Five seeds. The headline result has a very large effect size and survives Holm correction across the comparison family, but five seeds is five seeds.
  • In-distribution evaluation. Episodes are resampled from the training generator and seed rather than held out. Every comparison is paired by seed so this does not bias them, but absolute rates are in-distribution.
  • Linear forecasting only. Random-walking obstacles have non-zero velocity components at initialization, so the predictor’s stochastic branch is never reached and they are extrapolated as linear movers. Prediction is systematically wrong for the least predictable obstacles, which bounds the ceiling.
  • Collision model under-counts. Collisions are checked after both the agent and the obstacles move, so a pair exchanging cells within one timestep is not recorded. This applies identically to both controllers.

A secondary mechanism: adaptive arbitration

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.

How αt is formed — drag the risk slider
αt = σ(4 zt) R = 0.04
Planner action Policy action Executed
Executed this step: Planner
P(planner) αt = 1.00 (planner acts) P(policy)

Five normalized context variables — planner confidence, path stability, local risk, motion uncertainty, congestion — form a logit that a sigmoid maps to αt. The slider drives local risk; the other four are pinned to their measured Dynamic Dense means (C = 0.738, P = 0.358, U = 0.126, G = 0.042). The executed action is not a blend: with eight discrete moves, a weighted coin flip picks one controller or the other.

What it contributes, measured

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.

APGRP-PPO, full stack
0.680
Predictive A* alone
0.780
Difference
p = 0.37, n.s.
Mean αt, Dynamic Dense
0.977
Steps the policy controlled
1.65%

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.