Computer Science / A* Heuristic Search
FREE TO EXPLORE
LABORATORY 21 · COMPUTER SCIENCE

A* Heuristic Search lab report

A worked a* heuristic search lab report with benchmark data tables, asymptotic graphs, calculations, uncertainty and conclusions.

WORKED EXAMPLE · BENCHMARK OBSERVATIONS

A complete example laboratory report.

Simulated demonstration data.

This report illustrates formal algorithmic benchmarking, operation counting arithmetic, and regression analysis. Replace its observations with your own benchmark telemetry when preparing a practical submission.

Student: __________________Student ID: __________________Course: __________________Date: __________________Partner: __________________Instructor: __________________

1. Title and aim

A* Pathfinding & Heuristic Search: Admissibility, Consistency, Priority Queue Open Sets, and State Space Exploration. To investigate informed state-space search algorithms, analyze the mathematical mechanics of the A* evaluation function f(n) = g(n) + h(n), evaluate heuristic admissibility (h ≤ h*) and consistency (|h(u) - h(v)| ≤ c(u,v)), contrast uninformed Dijkstra search (h = 0) against Manhattan and Euclidean heuristics, verify the linear state expansion law E(D) = k_astar · D + E_0 = 3.0000 · D + 0.0000 expansions across path distances D ∈ [10, 70] grid units, and examine memory-bounded architectures including IDA* and Jump Point Search (JPS).

2. Abstract

Seven benchmark trials were generated across optimal grid path distances D = 10 to D = 70 steps (total closed set node expansions E from 30 to 210 expansions). An ordinary least-squares regression of closed set expansions against path distance yielded an empirical scaling factor of 3.0000 expansions/grid-step and an intercept of 0.0000 expansions, demonstrating exact agreement with Hart, Nilsson, and Raphael's A* heuristic corridor invariant E(D) = 3D (difference = 0.0000%). The empirical telemetry confirms that by coupling exact path-cost-to-come g(n) with an admissible and consistent Manhattan heuristic h(n), A* prunes over 90% of the state space relative to blind Dijkstra search, expanding exactly 3 candidate vertices per unit path step.

3. Apparatus and fixed settings

4. Theory and graph choice

Shortest-path graph search algorithms form the core computational engine of autonomous mobile robotics, game engine navigation, logistics routing, computer vision segmentation, and artificial intelligence planning. In 1959, Edsger Dijkstra formulated the foundational shortest-path algorithm, which explores vertices in order of exact path cost g(n) from the start. However, because Dijkstra's algorithm possesses zero knowledge regarding the location of the goal, it radiates outward uniformly in all directions like an expanding circular wave, exploring up to Θ(D²) nodes across 2D search spaces. In 1968, Peter Hart, Nils Nilsson, and Bertram Raphael at the Stanford Research Institute revolutionized pathfinding by inventing the A* Search Algorithm for Shakey the Robot. A* introduces an evaluation function f(n) = g(n) + h(n) that balances exact historical cost-to-come g(n) with an estimated heuristic cost-to-go h(n) directed toward the goal. Under an admissible heuristic (which never overestimates the true remaining distance, h(n) ≤ h*(n)) and consistency (satisfying the triangle inequality h(u) ≤ c(u,v) + h(v)), A* is mathematically guaranteed to find the provably optimal shortest path while expanding the minimal number of states necessary. In directed 2D grid corridors with Manhattan heuristic guidance, A* constrains state exploration to a focused directional envelope, reducing state expansion from quadratic Θ(D²) down to strictly linear E(D) = 3.0000 · D expansions. Today, A* and its descendants—such as Jump Point Search (JPS), Lifelong Planning A* (LPA*), and Hierarchical Pathfinding (HPA*)—power navigation across modern operating systems, video game engines (Unreal, Unity), GIS routing services (OpenStreetMap, Google Maps), and aerospace mission planners. In this laboratory investigation, students benchmark A* node expansions across distances D ∈ [10, 70], verify the linear scaling law E(D) = 3.0000 · D + 0.0000 via ordinary least-squares regression, contrast Dijkstra against Manhattan and Euclidean heuristics, analyze open set priority queue dynamics, and evaluate heuristic admissibility boundaries.

E(D) = k_astar · D + E_0 = 3.0000 · D + 0.0000 expansions

The mathematical regression fits the linear model y = mx + b, where x = D represents the optimal path distance in grid steps, y = E represents total closed set node expansions, m represents the heuristic expansion factor k_astar, and b represents the baseline expansion offset (theoretically E_0 = 0.0000 expansions). The gradient has physical units expansions/grid-step.

5. Method

  1. Initialize the 2D grid map with start vertex s and goal vertex g separated by optimal path distance D ∈ [10, 20, 30, 40, 50, 60, 70] grid units. Clear the Open Set min-heap and Closed Set registry.
  2. Set g(s) = 0, evaluate h(s) = |x_s - x_g| + |y_s - y_g|, and insert start node s into the Open Set with priority f(s) = g(s) + h(s). Initialize the closed set expansion counter to zero.
  3. Extract the vertex n with the minimum f(n) from the Open Set. If n matches the goal vertex g, terminate the search and initiate path reconstruction. Otherwise, add n to the Closed Set and increment the node expansion counter E by 1.
  4. Iterate across all valid orthogonal neighbor vertices n' of n. If n' is in the Closed Set or is an impassable obstacle, skip it. Calculate tentative cost tentative_g = g(n) + c(n, n'). If n' is not in the Open Set or tentative_g < g(n'), update parent(n') = n, g(n') = tentative_g, and f(n') = g(n') + h(n'), then insert or update n' in the Open Set.
  5. Upon extracting goal vertex g, traverse predecessor pointers backward from g to s: path = [g, parent(g), parent(parent(g)), ..., s]. Reverse the list to yield the forward optimal trajectory, verifying that path length matches the expected distance D.
  6. Record total Closed Set node expansions E(D) across all benchmark distances D ∈ [10, 70]. Perform ordinary least-squares linear regression of E against D to determine empirical slope k_astar, intercept E_0, and coefficient of determination R².

6. Observations and calculation table

All benchmark observations use strictly controlled memory buffers. Values are recorded deterministically from the algorithmic comparator register. Residuals are computed relative to the ordinary least-squares regression line.

Table 1. Seven simulated algorithmic benchmarks; x and y represent computational state metrics.
No.Optimal Path Distance D (grid steps)Closed Set Node Expansions E(D) (expansions)Optimal path distance D (grid steps)Total node expansions E(D) = 3.0000 · D + 0.0000 (expansions)Fitted yResidual
1103010.000030.000030.00000.0000
2206020.000060.000060.00000.0000
3309030.000090.000090.00000.0000
44012040.0000120.0000120.00000.0000
55015050.0000150.0000150.00000.0000
66018060.0000180.0000180.00000.0000
77021070.0000210.0000210.00000.0000

Download the sample observations (CSV) ↓

7. Worked calculation for one observation

Optimal Path Distance D = 10 grid steps; Heuristic Metric = Manhattan L1; Step Expansion Factor = 3.0000. Total Closed Set Node Expansions: E(D) = k_astar · D + E_0 = 3.0000 × 10 + 0 = 30 expansions. Verification: In a 4-connected grid environment guided by an admissible and consistent Manhattan distance heuristic h(n) = |Δx| + |Δy|, the A* evaluation function f(n) = g(n) + h(n) restricts state exploration to a directional corridor along the direct path. At each step along the D-step trajectory, the algorithm expands exactly the on-path vertex and evaluates its 2 orthogonal lateral neighbor candidates before advancing forward, bounding total closed set expansions strictly to 3·D = 30 nodes.

8. Graph, gradient and final calculation

3.002.8061.5021.40120.0040.00178.5058.60237.0077.20Optimal path distance D (grid steps)Total node expansions E(D) = 3.0000 · D + 0.0000 (expansions)n = 10n = 20n = 30n = 40n = 50n = 60n = 70

Circular markers represent empirical benchmark observations. The solid line represents the ordinary least-squares asymptotic linear fit.

x̄ = 40.00000; ȳ = 120.00000
Σ(x − x̄)² = 2800.00000
Σ(x − x̄)(y − ȳ) = 8400.00000
m = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² = 3.00000000
b = ȳ − mx̄ = 0.00000000
k_astar = m = 3.0000 expansions/grid-step; Intercept E_0 = 0.0000 expansions (theoretical k_astar = 3.0000, E_0 = 0.0000)

9. Uncertainty and comparison

Percentage difference = |estimate − theoretical value| / |theoretical value| × 100 = 0.0000%.

For n = 7 benchmark observations, Σresidual² = 0.00000; s² = Σresidual²/(n − 2). Gradient standard error = √[s²/Σ(x − x̄)²] = 1.8898e-08. Intercept standard error = √[s²(1/n + x̄²/Σ(x − x̄)²)] = 8.4515e-07.

Propagating the fit parameters yields a fit standard error of 1.8898e-08 expansions/grid-step, with an ideal coefficient of determination R² = 1.000000.

In heuristic search theory and discrete optimization, the closed set node expansion count E(D) = k_astar · D + E_0 = 3.0000·D + 0.0000 expansions across path distance D is an exact algorithmic invariant for consistent Manhattan guidance in uniform grid corridors. Unlike analog physical experiments, there is no continuous sensor noise, thermal fluctuations, or mechanical wear in counting discrete graph node expansions or priority queue extractions. However, in practical robotic navigation systems and autonomous game engines, wall-clock pathfinding throughput and memory consumption are heavily modulated by computer microarchitecture and heuristic dynamics: (1) Priority queue min-heap percolation overhead: in large-scale state spaces with millions of vertices, each decrease-key or insertion operation in the binary min-heap requires O(log |Open|) pointer swaps, incurring CPU cache line misses once the heap exceeds L3 cache capacity; (2) Heuristic admissibility and consistency violations: utilizing an inadmissible heuristic (h(n) > h*(n)) can accelerate search but forfeits the guarantee of path optimality, while an inconsistent heuristic requires reopening closed nodes, escalating execution time from O(|V| log |V|) to exponential worst-case O(2^|V|); (3) Tie-breaking strategies on identical f-scores: in open grid maps with many equidistant paths, naive FIFO tie-breaking causes extensive exploration of symmetric paths, whereas tie-breaking in favor of higher g(n) directs the search aggressively along the forward frontier; and (4) Jump Point Search (JPS) and spatial caching: on uniform-cost grid terrain, JPS prunes symmetric intermediate nodes by jumping directly between obstacle turning points, reducing Open Set operations by up to 95%. Ordinary least-squares linear regression of observed closed set expansions against optimal path distance D across trials from D = 10 to D = 70 grid steps yields an empirical scaling factor k_astar = 3.0000 expansions/grid-step and intercept E_0 = 0.0000 expansions with zero residual variance (R² = 1.00000), verifying the linear search corridor bound Θ(D) with mathematical certitude.

10. Result and discussion

k_astar = 3.0000 expansions/grid-step
Theoretical reference value: 3.0000 expansions/grid-step

The empirical benchmark observations provide rigorous quantitative verification of Informed State Space Search theory, heuristic admissibility, and the optimality of A*. In discrete graph pathfinding, blind uninformed search algorithms—such as Breadth-First Search (BFS) and Dijkstra's algorithm (h = 0)—explore vertices in radially symmetric concentric circles, expanding an area of πD² = Θ(D²) nodes across 2D planar maps. For large-scale geographical navigation or high-dimensional robotic motion planning, quadratic scaling becomes computationally intractable. In 1968, Peter Hart, Nils Nilsson, and Bertram Raphael introduced the A* Search Algorithm, evaluating states using f(n) = g(n) + h(n), combining exact cost-to-come g(n) with heuristic cost-to-go h(n). When the heuristic function h(n) satisfies admissibility (h(n) ≤ h*(n)) and consistency (h(u) ≤ c(u, v) + h(v)), A* is guaranteed to find an optimal shortest path without ever reopening closed vertices. In our 4-connected grid environment, the Manhattan heuristic h(n) = |x - x_goal| + |y - y_goal| creates an optimal potential gradient pointing directly toward the target. At each step along the path, A* extracts the minimum-f vertex from the binary min-heap Open Set, expands its orthogonal neighbors, and immediately advances along the direct line of sight. Across all benchmark trials from D = 10 to D = 70 grid steps, the empirical regression slope m = 3.0000 expansions/grid-step and baseline intercept b = 0.0000 confirm this linear corridor invariant with zero residual variance (R² = 1.00000). Comparative architectural analysis elucidates fundamental trade-offs across pathfinding paradigms: Dijkstra's algorithm guarantees optimality but suffers quadratic expansion overhead. Greedy Best-First search (f = h) rushes toward the goal but is sub-optimal and easily trapped in concavities and dead ends. A* strikes the mathematically optimal balance between path cost and search effort. Furthermore, modern extensions illustrate advanced performance scaling: Jump Point Search (JPS) exploits grid symmetries to jump directly between obstacle turning points, reducing Open Set operations by up to 95%, while Hierarchical Pathfinding (HPA*) and Lifelong Planning A* (LPA*) enable real-time dynamic replanning across massive video game worlds and autonomous robotics fleets.

11. Precautions and limitations

The simulated benchmark environment models idealized 4-connected uniform-cost grid terrain where Manhattan heuristic evaluations execute deterministically (E(D) = 3D expansions). In real-world robotic navigation, video game engines, and GIS routing platforms, execution latency is heavily modulated by priority queue min-heap pointer swap overhead, floating-point Euclidean square root latencies, non-uniform terrain traversal costs (mud, water, elevation slopes), dynamic obstacle appearances requiring D* Lite replanning, and memory cache misses across large graph topologies. In the A* heuristic search benchmark across 2D grid path distances D in [10, 70] steps (under 4-connected orthogonal motion with unit edge costs and an admissible, consistent Manhattan distance heuristic h(n) = |x - x_goal| + |y - y_goal|), the search frontier is tightly focused along the direct line of sight between start and goal. At each step along the optimal path, the algorithm extracts the minimum-f vertex from the binary min-heap Open Set, places it into the Closed Set, and relaxes its 4 orthogonal neighbors. Because the Manhattan heuristic perfectly reflects obstacle-free grid costs, only the on-path cell and its immediate adjacent non-goal lateral neighbors are evaluated before the forward cell is chosen for expansion. Across an optimal trajectory of distance D, the cumulative count of closed set state expansions is strictly governed by the exact linear invariant E(D) = 3.0000 · D + 0.0000 expansions. Plotting closed set expansions against path distance D yields an ordinary least-squares regression slope k_astar = 3.0000 expansions/grid-step and baseline intercept E_0 = 0.0000 expansions with an ideal coefficient of determination R² = 1.000000.

12. Conclusion

This laboratory investigation quantitatively verified the evaluation function mechanics, heuristic consistency invariants, and linear corridor scaling of the A* Search Algorithm. Through systematic benchmarking across path distances from D = 10 to 70 grid steps, we verified the empirical expansion factor k_astar = 3.0000 expansions/grid-step and baseline intercept E_0 = 0.0000 expansions with an ideal R² = 1.00000. The investigation established the microarchitectural efficiency and theoretical elegance of admissible heuristic guidance, priority queue open sets, and state space pruning, proving why A* remains the premier, universally implemented pathfinding algorithm in robotics, video game development, artificial intelligence, and global navigation systems.