This example compares two simple routes from Gent to Oostende. It is named “GPS” because it demonstrates goal-driven route planning: start somewhere, reach a destination, and compare candidate routes.
Each route has four scores: duration, cost, belief, and comfort. Duration and cost are added along the route. Belief and comfort are multiplied, because each route segment affects the overall reliability and comfort.
The planner compares the direct route through Brugge with an alternative route through Kortrijk and Brugge.
The direct route is faster, cheaper, more reliable, and slightly more comfortable. Because it dominates the alternative on all four measures, the explanation is easy to audit.
The trust gate verifies that the goal is configured, at least one simple route connects the start and goal, every route starts and ends correctly, routes do not revisit nodes, edge metrics are valid, and the emitted route is the fastest route after enumeration.
From the repository root:
node examples/gps.js