{"version":1,"lectureId":"01M20SKMMFZ3B2ZPP93PGBNY5D","attempt":0,"publication":{"slug":"visualizing-a-search-pathfinding-through-heuristic-guidance","title":"Visualizing A* Search: Pathfinding Through Heuristic Guidance","subject":"computer-science","summary":"A single grid instance, carried from the statement of the pathfinding problem to a complete run of A* search. The lecture separates the two costs that meet at a cell: the measured cost of the route traced so far, and an estimate of the cost still remaining. It then runs Dijkstra's algorithm on that grid, watching its frontier grow as a diamond that spends as much effort behind the start as ahead of it; builds the Manhattan estimate and shows why it never overshoots the true remaining cost; and finally expands by least f, following one comparison in the priority queue before the search runs to the goal. The two searches finish side by side on identical mazes, returning routes of identical cost after very different amounts of work.","metaDescription":"A* search on one grid: g, h and f unpacked, an uninformed frontier flooding the maze, and an informed one steering to the goal.","transcript":"Pathfinding is a search problem, and it is worth stating precisely before we solve it. We are given a graph, a start vertex, a goal vertex, and a cost on every edge, and we want a route of least total cost. Underneath it lies a second question: how much of the graph must an algorithm examine before it can commit to an answer? Here is an instance. Each cell of this grid is a vertex; each cell is joined to its neighbours above, below, left and right; and the shaded cells are walls, which no route may enter. One step from a cell to a neighbour costs one unit, so the cost of a route is the number of steps in it. This cell is the start. This one is the goal. A search algorithm answers one question repeatedly: of the cells it has reached but not yet examined, which should it examine next? Every algorithm in this lecture answers by attaching a single number to each candidate and taking the smallest. So consider one candidate. Take this cell, and call it n. Two different costs meet at n. One of them lies behind it. From S, the search has traced a route to n, one step at a time, and that route has a cost of five steps. That measured number is g of n. The other lies ahead of it. From n, some cost remains before G is reached, and the search cannot know it, because it has not been there. So it estimates. This dashed figure is the estimate: four cells across, one cell up, five in total. That number is h of n. Keep the distinction. g is known, because those steps have been taken. h is a guess about ground the search has not covered. A star search adds them. f of n is g of n plus h of n: the cost committed, plus the cost estimated. It is the algorithm's estimate of the total cost of the best route through n. Here that is five plus five, which is ten. And the rule of the algorithm is exactly this: always examine the reached cell whose f is smallest. Two numbers and one sum. What follows takes them apart: a search that uses g and nothing else, then the estimate h on its own, and then the two together. Start with a search that has no information about where the goal is. Dijkstra's algorithm keeps, for every cell it has reached, the cheapest known cost of reaching it, and it always expands the reached cell whose cost is smallest. When every step costs the same, that is the order breadth-first search uses as well. Look at which quantity that rule uses. It uses g, the cost already accumulated, and nothing else. No term in it mentions the goal, so nothing in it can prefer one direction over another. So it grows in every direction at once. Watch the shading: its leading edge is the frontier, the boundary between cells already expanded and cells not yet reached. Stop it here. The outlined cells are the frontier at this instant: expanded cells behind them, unreached cells in front. The frontier is a diamond rather than a circle, because distance is counted in horizontal and vertical steps. And it spreads behind the start as readily as ahead of it. Let the wave run on, and half of that work is going away from G. Keep going. The expansion folds around the walls and continues, filling cells that no shortest route to G could use. The goal is reached last, because it is far from the start and the search had no reason to hurry towards it. The route returned is a shortest one: ten steps. That optimality is not negotiable. Whatever we add to make the search look in the right direction must still return a route of least cost. Now count the work. Before the goal came off the queue, every cell strictly closer to the start than the goal is had already been expanded. That is this many, out of the sixty-seven cells of this grid that are not walls. That is not a defect of the implementation; it follows from the rule. g measures the past, and a search that ranks candidates by the past alone cannot tell a promising direction from a hopeless one. What is missing is a term that looks forward. The missing term is an estimate of the cost that remains. For every cell we want a number saying, without any searching, roughly how far the goal still is. Here is the estimate this lecture uses. Ignore the walls completely. Count the horizontal separation between the cell and the goal, count the vertical separation, and add the two. That is the Manhattan distance. Take this cell. It is seven columns and two rows from the goal, so the estimate is nine. Move the cell and the number follows. Here it is six. Nearer the goal, it is two. And computing it costs two subtractions and an addition: no search, no queue, no walls consulted. The estimate ignores walls, and that has a consequence worth seeing. Move the cell here. The estimate is six: four columns across and two rows down. But look where the dashed figure runs. It goes straight through this wall, and no route can follow it. The true remaining cost is eight, not six. A route has to come down to this row, pass the barrier, and climb back up to G. So the estimate falls short of the truth, and that is precisely the property we want. An estimate that never exceeds the true remaining cost is called admissible. The Manhattan estimate is admissible on this grid, because any route must make at least the horizontal steps and at least the vertical steps that separate the cell from the goal, and walls can only force it to make more. Admissibility is what will let us keep the optimality that Dijkstra's algorithm gave us. Now put both costs together at this cell. The cheapest route the search can trace from S to it costs six steps, so g is six. The estimate ahead is six as well, so f is twelve. Notice that twelve is not the true cost of the best route through this cell. In green and yellow together, that route is fourteen steps. Twelve is a lower bound on it, and a lower bound is all we need: twelve already exceeds ten, and a ten-step route exists. So this cell can be discarded without ever being expanded. That is the mechanism: g rules out nothing, h rules out nothing, and their sum rules out most of the maze. Now the two terms together. One change to the rule: instead of expanding the reached cell of least g, A star search expands the reached cell of least f, where f is g plus h. Expand S. Its four neighbours become reached cells, each with g equal to one, and each is given an f. Those four are the queue. The four share the same g, so g cannot separate them. Their estimates differ. The neighbour towards the goal is seven from it by the estimate; the other three are nine, because a step in the wrong direction adds one instead of removing one. Add the columns and f follows: eight for the neighbour in the direction of the goal, ten for the other three. The smallest f wins, so the search steps that way. Repeat the comparison. The next three choices come out the same way, so the search runs straight along this row, and f stays at eight all the way. Then the row runs into the wall. The cell straight ahead is blocked, so there is nowhere to continue, and every reached cell now has an f of ten. The estimate of eight was optimistic, and the search has just discovered why. Many cells now tie at ten, and f alone cannot choose among them. This implementation prefers the smaller estimate, which keeps it moving towards G; a different tie-break would examine a wider band. What no tie-break can do is examine a cell of larger f before one of smaller f. So it turns the corner and carries on: ten, ten, ten. Then G comes off the queue with f equal to ten, which is its g plus nothing, since the estimate at the goal is zero. Eleven cells expanded. The route returned is the same ten-step route, and it is optimal, for the reason we established: the estimate never overshoots, so no unexpanded cell could have hidden anything cheaper. The queue was not empty when it stopped. These cells were reached and given an f, and then never expanded, because their f exceeded ten. Reaching a cell is cheap; expanding it is the work. Put the two searches side by side, on the same maze, with the same walls, both returning a route of cost ten. The counts are on the board. The larger belongs to the search that ranked by g alone; the smaller belongs to the search that added an estimate of what remained. Same route, a fraction of the work. Three points to take away. First, the two terms measure different things: g is a measured cost over ground the search has covered, h is an estimate over ground it has not, and f is the only quantity the algorithm ever compares. Second, the estimate must never exceed the true remaining cost. That is admissibility, and it is what keeps the returned route optimal. An estimate that overshoots can make the search settle for a route that is not shortest. Third, the quality of the estimate is the quality of the search. Set h to zero and f becomes g, and the algorithm is Dijkstra's again, expanding in every direction. Sharpen h towards the true remaining cost and the expanded region contracts towards the route itself. The equation is one addition. What it changes is the set of cells the algorithm never has to look at.","watch":{"version":1,"scenes":[{"title":"The Problem and the Two Costs","start":0,"end":151.43533333333335,"objects":{"cell_mark":"a Math [text] that says \"$n$\" drawn in grid","cost_line":"a Math [text] that says \"$g(n) = 5$\"","estimate_line":"a Math [text] that says \"$h(n) = 5$\"","goal_mark":"a Math [text] that says \"$G$\" drawn in grid","grid":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 7.0), aspect=(11.0, 7.0))","lattice":"a Gridlines [gray] drawn in grid (x_range=(0.0, 11.0), y_range=(0.0, 7.0), step=1.0)","leg_across":"a Line [magenta] drawn in grid (start=(5.5, 2.5), end=(9.5, 2.5), dashed=True)","leg_up":"a Line [magenta] drawn in grid (start=(9.5, 2.5), end=(9.5, 3.5), dashed=True)","point":"a Point [yellow] drawn in grid (location=(2.5, 3.5))","point_2":"a Point [yellow] drawn in grid (location=(0.5, 3.5))","point_3":"a Point [yellow] drawn in grid (location=(1.5, 4.5))","point_4":"a Point [yellow] drawn in grid (location=(1.5, 2.5))","polygon":"a Polygon [gray] drawn in grid (vertices=((4.08, 0.08), (4.92, 0.08), (4.92, 0.92), (4.08, 0.92)), fill_opacity=0.85)","polygon_10":"a Polygon [gray] drawn in grid (vertices=((8.08, 1.08), (8.92, 1.08), (8.92, 1.92), (8.08, 1.92)), fill_opacity=0.85)","polygon_11":"a Polygon [green] drawn in grid (vertices=((1.08, 3.08), (1.92, 3.08), (1.92, 3.92), (1.08, 3.92)), fill_opacity=0.7)","polygon_12":"a Polygon [red] drawn in grid (vertices=((9.08, 3.08), (9.92, 3.08), (9.92, 3.92), (9.08, 3.92)), fill_opacity=0.7)","polygon_13":"a Polygon [blue] drawn in grid (vertices=((5.08, 2.08), (5.92, 2.08), (5.92, 2.92), (5.08, 2.92)), fill_opacity=0.55)","polygon_2":"a Polygon [gray] drawn in grid (vertices=((4.08, 1.08), (4.92, 1.08), (4.92, 1.92), (4.08, 1.92)), fill_opacity=0.85)","polygon_3":"a Polygon [gray] drawn in grid (vertices=((3.08, 5.08), (3.92, 5.08), (3.92, 5.92), (3.08, 5.92)), fill_opacity=0.85)","polygon_4":"a Polygon [gray] drawn in grid (vertices=((3.08, 6.08), (3.92, 6.08), (3.92, 6.92), (3.08, 6.92)), fill_opacity=0.85)","polygon_5":"a Polygon [gray] drawn in grid (vertices=((6.08, 3.08), (6.92, 3.08), (6.92, 3.92), (6.08, 3.92)), fill_opacity=0.85)","polygon_6":"a Polygon [gray] drawn in grid (vertices=((6.08, 4.08), (6.92, 4.08), (6.92, 4.92), (6.08, 4.92)), fill_opacity=0.85)","polygon_7":"a Polygon [gray] drawn in grid (vertices=((6.08, 5.08), (6.92, 5.08), (6.92, 5.92), (6.08, 5.92)), fill_opacity=0.85)","polygon_8":"a Polygon [gray] drawn in grid (vertices=((6.08, 6.08), (6.92, 6.08), (6.92, 6.92), (6.08, 6.92)), fill_opacity=0.85)","polygon_9":"a Polygon [gray] drawn in grid (vertices=((8.08, 0.08), (8.92, 0.08), (8.92, 0.92), (8.08, 0.92)), fill_opacity=0.85)","question":"a Panel that says \"Unit-cost steps on a grid. Which cells must a search examine before it can return a shortest route from $S$ to $G$?\"","start_mark":"a Math [text] that says \"$S$\" drawn in grid","total_line":"a Math [text] that says \"$f(n) = g(n) + h(n)$\"","traced":"a Line [green] drawn in grid (start=(1.5, 3.5), end=(2.5, 3.5))","traced_2":"a Line [green] drawn in grid (start=(2.5, 3.5), end=(3.5, 3.5))","traced_3":"a Line [green] drawn in grid (start=(3.5, 3.5), end=(4.5, 3.5))","traced_4":"a Line [green] drawn in grid (start=(4.5, 3.5), end=(5.5, 3.5))","traced_5":"a Line [green] drawn in grid (start=(5.5, 3.5), end=(5.5, 2.5))"},"beats":[{"start":0,"say":"Pathfinding is a search problem, and it is worth stating precisely before we solve it. We are given a graph, a start vertex, a goal vertex, and a cost on every edge, and we want a route of least total cost. Underneath it lies a second question: how much of the graph must an algorithm examine before it can commit to an answer?","live":[],"does":[[0,"question is shown on the screen, written out."],[21.3625,"question moves to a new place on the board."]]},{"start":21.962500000000002,"say":"Here is an instance. Each cell of this grid is a vertex; each cell is joined to its neighbours above, below, left and right; and the shaded cells are walls, which no route may enter.","live":["question"],"does":[[21.962500000000002,"grid is shown on the screen, written out."],[21.962500000000002,"lattice is shown on the screen, written out."],[32.864,"polygon is shown on the screen, written out."],[32.91983025780556,"polygon_2 is shown on the screen, written out."],[32.975660515611104,"polygon_3 is shown on the screen, written out."],[33.031490773416664,"polygon_4 is shown on the screen, written out."],[33.08732103122222,"polygon_5 is shown on the screen, written out."],[33.14315128902777,"polygon_6 is shown on the screen, written out."],[33.19898154683333,"polygon_7 is shown on the screen, written out."],[33.254811804638884,"polygon_8 is shown on the screen, written out."],[33.31064206244444,"polygon_9 is shown on the screen, written out."],[33.36647232025,"polygon_10 is shown on the screen, written out."]]},{"start":36.0415,"say":"One step from a cell to a neighbour costs one unit, so the cost of a route is the number of steps in it. This cell is the start. This one is the goal.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10"],"does":[[43.19299999999999,"polygon_11 is shown on the screen, written out."],[43.19299999999999,"start_mark is shown on the screen, written out."],[45.20199999999999,"polygon_12 is shown on the screen, written out."],[45.20199999999999,"goal_mark is shown on the screen, written out."]]},{"start":46.742,"say":"A search algorithm answers one question repeatedly: of the cells it has reached but not yet examined, which should it examine next? Every algorithm in this lecture answers by attaching a single number to each candidate and taking the smallest.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark"],"does":[[52.152,"point is shown on the screen, grown."],[52.152,"point_2 is shown on the screen, grown."],[52.152,"point_3 is shown on the screen, grown."],[52.152,"point_4 is shown on the screen, grown."],[54.33079961215255,"point is hidden from the screen."],[54.33079961215255,"point_2 is hidden from the screen."],[54.33079961215255,"point_3 is hidden from the screen."],[54.33079961215255,"point_4 is hidden from the screen."]]},{"start":63.271,"say":"So consider one candidate. Take this cell, and call it n. Two different costs meet at n.","live":null,"does":[[66.05799999999999,"polygon_13 is shown on the screen, written out."],[66.05799999999999,"cell_mark is shown on the screen, written out."]]},{"start":71.9175,"say":"One of them lies behind it. From S, the search has traced a route to n, one step at a time, and that route has a cost of five steps. That measured number is g of n.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","cell_mark"],"does":[[76.004,"traced is shown on the screen, written out."],[76.21999336659995,"traced_2 is shown on the screen, written out."],[76.43175883706338,"traced_3 is shown on the screen, written out."],[76.59725925538591,"traced_4 is shown on the screen, written out."],[76.80228383183437,"traced_5 is shown on the screen, written out."],[82.459,"grid moves to a new place on the board."],[82.459,"cost_line is shown on the screen, written out."]]},{"start":85.102,"say":"The other lies ahead of it. From n, some cost remains before G is reached, and the search cannot know it, because it has not been there. So it estimates. This dashed figure is the estimate: four cells across, one cell up, five in total. That number is h of n.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","cost_line","polygon_13","cell_mark","traced","traced_2","traced_3","traced_4","traced_5"],"does":[[95.888,"leg_across is shown on the screen, written out."],[95.888,"leg_up is shown on the screen, written out."],[100.77600000000001,"estimate_line is shown on the screen, written out."]]},{"start":104.50450000000001,"say":"Keep the distinction. g is known, because those steps have been taken. h is a guess about ground the search has not covered.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","cost_line","estimate_line","polygon_13","cell_mark","traced","traced_2","traced_3","traced_4","traced_5","leg_across","leg_up"],"does":[[106.89,"cost_line is emphasized."],[110.10600000000001,"cost_line is no longer emphasized."],[110.10600000000001,"estimate_line is emphasized."],[112.59100000000001,"estimate_line is no longer emphasized."]]},{"start":113.191,"say":"A star search adds them. f of n is g of n plus h of n: the cost committed, plus the cost estimated. It is the algorithm's estimate of the total cost of the best route through n.","live":null,"does":[[114.306,"total_line is shown on the screen, written out."],[119.855,"total_line (the \"g(n)\" part) is emphasized."],[121.503,"total_line (the \"g(n)\" part) is no longer emphasized."],[121.503,"total_line (the \"h(n)\" part) is emphasized."],[127.4825,"total_line (the \"h(n)\" part) is no longer emphasized."]]},{"start":128.0825,"say":"Here that is five plus five, which is ten. And the rule of the algorithm is exactly this: always examine the reached cell whose f is smallest.","live":["question","grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","cost_line","estimate_line","total_line","polygon_13","cell_mark","traced","traced_2","traced_3","traced_4","traced_5","leg_across","leg_up"],"does":[[129.29000000000002,"total_line becomes \"$f(n) = g(n) + h(n) = 5 + 5 = 10$\"."],[137.719,"A box is drawn around total_line."]]},{"start":139.36350000000002,"say":"Two numbers and one sum. What follows takes them apart: a search that uses g and nothing else, then the estimate h on its own, and then the two together.","live":null,"does":[[150.39366666666672,"cost_line is hidden from the screen — left the board."],[150.39366666666672,"estimate_line is hidden from the screen — left the board."],[150.39366666666672,"grid is hidden from the screen — left the board."],[150.39366666666672,"lattice is hidden from the screen — grid left the board."],[150.39366666666672,"polygon is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_2 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_3 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_4 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_5 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_6 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_7 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_8 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_9 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_10 is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_11 is hidden from the screen — grid left the board."],[150.39366666666672,"start_mark is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_12 is hidden from the screen — grid left the board."],[150.39366666666672,"goal_mark is hidden from the screen — grid left the board."],[150.39366666666672,"polygon_13 is hidden from the screen — grid left the board."],[150.39366666666672,"cell_mark is hidden from the screen — grid left the board."],[150.39366666666672,"traced is hidden from the screen — grid left the board."],[150.39366666666672,"traced_2 is hidden from the screen — grid left the board."],[150.39366666666672,"traced_3 is hidden from the screen — grid left the board."],[150.39366666666672,"traced_4 is hidden from the screen — grid left the board."],[150.39366666666672,"traced_5 is hidden from the screen — grid left the board."],[150.39366666666672,"leg_across is hidden from the screen — grid left the board."],[150.39366666666672,"leg_up is hidden from the screen — grid left the board."],[150.39366666666672,"question is hidden from the screen — left the board."],[150.39366666666672,"total_line is hidden from the screen — left the board."]]}]},{"title":"Searching Without a Compass","start":151.43533333333335,"end":282.4040625,"objects":{"closing":"a Heading that says \"The Cost of Having No Direction\"","count":"a Math [text] that says \"$upright(\"expanded\") = 49$\"","goal_mark":"a Math [text] that says \"$G$\" drawn in grid","grid":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 7.0), aspect=(11.0, 7.0))","heading":"a Heading that says \"Ranking by Cost So Far\"","lattice":"a Gridlines [gray] drawn in grid (x_range=(0.0, 11.0), y_range=(0.0, 7.0), step=1.0)","polygon":"a Polygon [gray] drawn in grid (vertices=((4.08, 0.08), (4.92, 0.08), (4.92, 0.92), (4.08, 0.92)), fill_opacity=0.85)","polygon_10":"a Polygon [gray] drawn in grid (vertices=((8.08, 1.08), (8.92, 1.08), (8.92, 1.92), (8.08, 1.92)), fill_opacity=0.85)","polygon_11":"a Polygon [green] drawn in grid (vertices=((1.08, 3.08), (1.92, 3.08), (1.92, 3.92), (1.08, 3.92)), fill_opacity=0.7)","polygon_12":"a Polygon [red] drawn in grid (vertices=((9.08, 3.08), (9.92, 3.08), (9.92, 3.92), (9.08, 3.92)), fill_opacity=0.7)","polygon_13":"a Polygon [blue] drawn in grid (vertices=((2.08, 3.08), (2.92, 3.08), (2.92, 3.92), (2.08, 3.92)), fill_opacity=0.4)","polygon_14":"a Polygon [blue] drawn in grid (vertices=((0.08, 3.08), (0.92, 3.08), (0.92, 3.92), (0.08, 3.92)), fill_opacity=0.4)","polygon_15":"a Polygon [blue] drawn in grid (vertices=((1.08, 4.08), (1.92, 4.08), (1.92, 4.92), (1.08, 4.92)), fill_opacity=0.4)","polygon_16":"a Polygon [blue] drawn in grid (vertices=((1.08, 2.08), (1.92, 2.08), (1.92, 2.92), (1.08, 2.92)), fill_opacity=0.4)","polygon_17":"a Polygon [blue] drawn in grid (vertices=((3.08, 3.08), (3.92, 3.08), (3.92, 3.92), (3.08, 3.92)), fill_opacity=0.4)","polygon_18":"a Polygon [blue] drawn in grid (vertices=((2.08, 4.08), (2.92, 4.08), (2.92, 4.92), (2.08, 4.92)), fill_opacity=0.4)","polygon_19":"a Polygon [blue] drawn in grid (vertices=((2.08, 2.08), (2.92, 2.08), (2.92, 2.92), (2.08, 2.92)), fill_opacity=0.4)","polygon_2":"a Polygon [gray] drawn in grid (vertices=((4.08, 1.08), (4.92, 1.08), (4.92, 1.92), (4.08, 1.92)), fill_opacity=0.85)","polygon_20":"a Polygon [blue] drawn in grid (vertices=((0.08, 4.08), (0.92, 4.08), (0.92, 4.92), (0.08, 4.92)), fill_opacity=0.4)","polygon_21":"a Polygon [blue] drawn in grid (vertices=((0.08, 2.08), (0.92, 2.08), (0.92, 2.92), (0.08, 2.92)), fill_opacity=0.4)","polygon_22":"a Polygon [blue] drawn in grid (vertices=((1.08, 5.08), (1.92, 5.08), (1.92, 5.92), (1.08, 5.92)), fill_opacity=0.4)","polygon_23":"a Polygon [blue] drawn in grid (vertices=((1.08, 1.08), (1.92, 1.08), (1.92, 1.92), (1.08, 1.92)), fill_opacity=0.4)","polygon_24":"a Polygon [blue] drawn in grid (vertices=((4.08, 3.08), (4.92, 3.08), (4.92, 3.92), (4.08, 3.92)), fill_opacity=0.4)","polygon_25":"a Polygon [blue] drawn in grid (vertices=((3.08, 4.08), (3.92, 4.08), (3.92, 4.92), (3.08, 4.92)), fill_opacity=0.4)","polygon_26":"a Polygon [blue] drawn in grid (vertices=((3.08, 2.08), (3.92, 2.08), (3.92, 2.92), (3.08, 2.92)), fill_opacity=0.4)","polygon_27":"a Polygon [blue] drawn in grid (vertices=((2.08, 5.08), (2.92, 5.08), (2.92, 5.92), (2.08, 5.92)), fill_opacity=0.4)","polygon_28":"a Polygon [blue] drawn in grid (vertices=((2.08, 1.08), (2.92, 1.08), (2.92, 1.92), (2.08, 1.92)), fill_opacity=0.4)","polygon_29":"a Polygon [blue] drawn in grid (vertices=((0.08, 5.08), (0.92, 5.08), (0.92, 5.92), (0.08, 5.92)), fill_opacity=0.4)","polygon_3":"a Polygon [gray] drawn in grid (vertices=((3.08, 5.08), (3.92, 5.08), (3.92, 5.92), (3.08, 5.92)), fill_opacity=0.85)","polygon_30":"a Polygon [blue] drawn in grid (vertices=((0.08, 1.08), (0.92, 1.08), (0.92, 1.92), (0.08, 1.92)), fill_opacity=0.4)","polygon_31":"a Polygon [blue] drawn in grid (vertices=((1.08, 6.08), (1.92, 6.08), (1.92, 6.92), (1.08, 6.92)), fill_opacity=0.4)","polygon_32":"a Polygon [blue] drawn in grid (vertices=((1.08, 0.08), (1.92, 0.08), (1.92, 0.92), (1.08, 0.92)), fill_opacity=0.4)","polygon_33":"a Polygon [yellow] drawn in grid (vertices=((5.08, 3.08), (5.92, 3.08), (5.92, 3.92), (5.08, 3.92)), fill_opacity=0.55)","polygon_34":"a Polygon [yellow] drawn in grid (vertices=((4.08, 4.08), (4.92, 4.08), (4.92, 4.92), (4.08, 4.92)), fill_opacity=0.55)","polygon_35":"a Polygon [yellow] drawn in grid (vertices=((4.08, 2.08), (4.92, 2.08), (4.92, 2.92), (4.08, 2.92)), fill_opacity=0.55)","polygon_36":"a Polygon [yellow] drawn in grid (vertices=((3.08, 1.08), (3.92, 1.08), (3.92, 1.92), (3.08, 1.92)), fill_opacity=0.55)","polygon_37":"a Polygon [yellow] drawn in grid (vertices=((2.08, 6.08), (2.92, 6.08), (2.92, 6.92), (2.08, 6.92)), fill_opacity=0.55)","polygon_38":"a Polygon [yellow] drawn in grid (vertices=((2.08, 0.08), (2.92, 0.08), (2.92, 0.92), (2.08, 0.92)), fill_opacity=0.55)","polygon_39":"a Polygon [yellow] drawn in grid (vertices=((0.08, 6.08), (0.92, 6.08), (0.92, 6.92), (0.08, 6.92)), fill_opacity=0.55)","polygon_4":"a Polygon [gray] drawn in grid (vertices=((3.08, 6.08), (3.92, 6.08), (3.92, 6.92), (3.08, 6.92)), fill_opacity=0.85)","polygon_40":"a Polygon [yellow] drawn in grid (vertices=((0.08, 0.08), (0.92, 0.08), (0.92, 0.92), (0.08, 0.92)), fill_opacity=0.55)","polygon_41":"a Polygon [blue] drawn in grid (vertices=((5.08, 3.08), (5.92, 3.08), (5.92, 3.92), (5.08, 3.92)), fill_opacity=0.4)","polygon_42":"a Polygon [blue] drawn in grid (vertices=((4.08, 4.08), (4.92, 4.08), (4.92, 4.92), (4.08, 4.92)), fill_opacity=0.4)","polygon_43":"a Polygon [blue] drawn in grid (vertices=((4.08, 2.08), (4.92, 2.08), (4.92, 2.92), (4.08, 2.92)), fill_opacity=0.4)","polygon_44":"a Polygon [blue] drawn in grid (vertices=((3.08, 1.08), (3.92, 1.08), (3.92, 1.92), (3.08, 1.92)), fill_opacity=0.4)","polygon_45":"a Polygon [blue] drawn in grid (vertices=((2.08, 6.08), (2.92, 6.08), (2.92, 6.92), (2.08, 6.92)), fill_opacity=0.4)","polygon_46":"a Polygon [blue] drawn in grid (vertices=((2.08, 0.08), (2.92, 0.08), (2.92, 0.92), (2.08, 0.92)), fill_opacity=0.4)","polygon_47":"a Polygon [blue] drawn in grid (vertices=((0.08, 6.08), (0.92, 6.08), (0.92, 6.92), (0.08, 6.92)), fill_opacity=0.4)","polygon_48":"a Polygon [blue] drawn in grid (vertices=((0.08, 0.08), (0.92, 0.08), (0.92, 0.92), (0.08, 0.92)), fill_opacity=0.4)","polygon_49":"a Polygon [blue] drawn in grid (vertices=((5.08, 4.08), (5.92, 4.08), (5.92, 4.92), (5.08, 4.92)), fill_opacity=0.4)","polygon_5":"a Polygon [gray] drawn in grid (vertices=((6.08, 3.08), (6.92, 3.08), (6.92, 3.92), (6.08, 3.92)), fill_opacity=0.85)","polygon_50":"a Polygon [blue] drawn in grid (vertices=((5.08, 2.08), (5.92, 2.08), (5.92, 2.92), (5.08, 2.92)), fill_opacity=0.4)","polygon_51":"a Polygon [blue] drawn in grid (vertices=((4.08, 5.08), (4.92, 5.08), (4.92, 5.92), (4.08, 5.92)), fill_opacity=0.4)","polygon_52":"a Polygon [blue] drawn in grid (vertices=((3.08, 0.08), (3.92, 0.08), (3.92, 0.92), (3.08, 0.92)), fill_opacity=0.4)","polygon_53":"a Polygon [blue] drawn in grid (vertices=((5.08, 5.08), (5.92, 5.08), (5.92, 5.92), (5.08, 5.92)), fill_opacity=0.4)","polygon_54":"a Polygon [blue] drawn in grid (vertices=((6.08, 2.08), (6.92, 2.08), (6.92, 2.92), (6.08, 2.92)), fill_opacity=0.4)","polygon_55":"a Polygon [blue] drawn in grid (vertices=((5.08, 1.08), (5.92, 1.08), (5.92, 1.92), (5.08, 1.92)), fill_opacity=0.4)","polygon_56":"a Polygon [blue] drawn in grid (vertices=((4.08, 6.08), (4.92, 6.08), (4.92, 6.92), (4.08, 6.92)), fill_opacity=0.4)","polygon_57":"a Polygon [blue] drawn in grid (vertices=((5.08, 6.08), (5.92, 6.08), (5.92, 6.92), (5.08, 6.92)), fill_opacity=0.4)","polygon_58":"a Polygon [blue] drawn in grid (vertices=((7.08, 2.08), (7.92, 2.08), (7.92, 2.92), (7.08, 2.92)), fill_opacity=0.4)","polygon_59":"a Polygon [blue] drawn in grid (vertices=((6.08, 1.08), (6.92, 1.08), (6.92, 1.92), (6.08, 1.92)), fill_opacity=0.4)","polygon_6":"a Polygon [gray] drawn in grid (vertices=((6.08, 4.08), (6.92, 4.08), (6.92, 4.92), (6.08, 4.92)), fill_opacity=0.85)","polygon_60":"a Polygon [blue] drawn in grid (vertices=((5.08, 0.08), (5.92, 0.08), (5.92, 0.92), (5.08, 0.92)), fill_opacity=0.4)","polygon_61":"a Polygon [blue] drawn in grid (vertices=((8.08, 2.08), (8.92, 2.08), (8.92, 2.92), (8.08, 2.92)), fill_opacity=0.4)","polygon_62":"a Polygon [blue] drawn in grid (vertices=((7.08, 3.08), (7.92, 3.08), (7.92, 3.92), (7.08, 3.92)), fill_opacity=0.4)","polygon_63":"a Polygon [blue] drawn in grid (vertices=((7.08, 1.08), (7.92, 1.08), (7.92, 1.92), (7.08, 1.92)), fill_opacity=0.4)","polygon_64":"a Polygon [blue] drawn in grid (vertices=((6.08, 0.08), (6.92, 0.08), (6.92, 0.92), (6.08, 0.92)), fill_opacity=0.4)","polygon_65":"a Polygon [blue] drawn in grid (vertices=((9.08, 2.08), (9.92, 2.08), (9.92, 2.92), (9.08, 2.92)), fill_opacity=0.4)","polygon_66":"a Polygon [blue] drawn in grid (vertices=((8.08, 3.08), (8.92, 3.08), (8.92, 3.92), (8.08, 3.92)), fill_opacity=0.4)","polygon_67":"a Polygon [blue] drawn in grid (vertices=((7.08, 4.08), (7.92, 4.08), (7.92, 4.92), (7.08, 4.92)), fill_opacity=0.4)","polygon_68":"a Polygon [blue] drawn in grid (vertices=((7.08, 0.08), (7.92, 0.08), (7.92, 0.92), (7.08, 0.92)), fill_opacity=0.4)","polygon_7":"a Polygon [gray] drawn in grid (vertices=((6.08, 5.08), (6.92, 5.08), (6.92, 5.92), (6.08, 5.92)), fill_opacity=0.85)","polygon_8":"a Polygon [gray] drawn in grid (vertices=((6.08, 6.08), (6.92, 6.08), (6.92, 6.92), (6.08, 6.92)), fill_opacity=0.85)","polygon_9":"a Polygon [gray] drawn in grid (vertices=((8.08, 0.08), (8.92, 0.08), (8.92, 0.92), (8.08, 0.92)), fill_opacity=0.85)","route":"a Line [green] drawn in grid (start=(1.5, 3.5), end=(2.5, 3.5))","route_10":"a Line [green] drawn in grid (start=(8.5, 3.5), end=(9.5, 3.5))","route_2":"a Line [green] drawn in grid (start=(2.5, 3.5), end=(3.5, 3.5))","route_3":"a Line [green] drawn in grid (start=(3.5, 3.5), end=(4.5, 3.5))","route_4":"a Line [green] drawn in grid (start=(4.5, 3.5), end=(5.5, 3.5))","route_5":"a Line [green] drawn in grid (start=(5.5, 3.5), end=(5.5, 2.5))","route_6":"a Line [green] drawn in grid (start=(5.5, 2.5), end=(6.5, 2.5))","route_7":"a Line [green] drawn in grid (start=(6.5, 2.5), end=(7.5, 2.5))","route_8":"a Line [green] drawn in grid (start=(7.5, 2.5), end=(7.5, 3.5))","route_9":"a Line [green] drawn in grid (start=(7.5, 3.5), end=(8.5, 3.5))","rule":"a Tex [text] that says \"Expand the reached cell of least $g(n)$.\"","start_mark":"a Math [text] that says \"$S$\" drawn in grid","verdict":"a Text [text] that says \"Ranking by $g$ alone contains no preference for any direction.\""},"beats":[{"start":151.43533333333335,"say":"Start with a search that has no information about where the goal is. Dijkstra's algorithm keeps, for every cell it has reached, the cheapest known cost of reaching it, and it always expands the reached cell whose cost is smallest. When every step costs the same, that is the order breadth-first search uses as well.","live":[],"does":[[151.43533333333335,"heading is shown on the screen, written out."],[151.43533333333335,"grid is shown on the screen, written out."],[151.43533333333335,"lattice is shown on the screen, written out."],[151.43533333333335,"polygon is shown on the screen, written out."],[151.46293333333335,"polygon_2 is shown on the screen, written out."],[151.49102147016012,"polygon_3 is shown on the screen, written out."],[151.52008588064047,"polygon_4 is shown on the screen, written out."],[151.54915029112084,"polygon_5 is shown on the screen, written out."],[151.57821470160118,"polygon_6 is shown on the screen, written out."],[151.60727911208153,"polygon_7 is shown on the screen, written out."],[151.63634352256187,"polygon_8 is shown on the screen, written out."],[151.66540793304222,"polygon_9 is shown on the screen, written out."],[151.69447234352256,"polygon_10 is shown on the screen, written out."],[154.33733333333333,"polygon_11 is shown on the screen, written out."],[154.33733333333333,"start_mark is shown on the screen, written out."],[154.33733333333333,"polygon_12 is shown on the screen, written out."],[154.33733333333333,"goal_mark is shown on the screen, written out."],[164.75133333333335,"rule is shown on the screen, written out."]]},{"start":171.88783333333333,"say":"Look at which quantity that rule uses. It uses g, the cost already accumulated, and nothing else. No term in it mentions the goal, so nothing in it can prefer one direction over another.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark"],"does":[[175.08033333333336,"rule is emphasized."],[182.75533333333334,"rule is no longer emphasized."]]},{"start":185.31083333333333,"say":"So it grows in every direction at once. Watch the shading: its leading edge is the frontier, the boundary between cells already expanded and cells not yet reached.","live":null,"does":[[188.56733333333335,"polygon_13 is shown on the screen, written out."],[188.6642539281706,"polygon_14 is shown on the screen, written out."],[188.76117452300787,"polygon_15 is shown on the screen, written out."],[188.85809511784512,"polygon_16 is shown on the screen, written out."],[188.9305016835017,"polygon_17 is shown on the screen, written out."],[188.98054377104378,"polygon_18 is shown on the screen, written out."],[189.04771268237937,"polygon_19 is shown on the screen, written out."],[189.18134998129443,"polygon_20 is shown on the screen, written out."],[189.31498728020952,"polygon_21 is shown on the screen, written out."],[189.44862457912458,"polygon_22 is shown on the screen, written out."],[189.58226187803967,"polygon_23 is shown on the screen, written out."],[189.71589917695474,"polygon_24 is shown on the screen, written out."],[189.8261590909091,"polygon_25 is shown on the screen, written out."],[189.93616540404042,"polygon_26 is shown on the screen, written out."],[190.02778451178455,"polygon_27 is shown on the screen, written out."],[190.11039709595963,"polygon_28 is shown on the screen, written out."],[190.1930096801347,"polygon_29 is shown on the screen, written out."],[190.2756222643098,"polygon_30 is shown on the screen, written out."],[190.35829090909093,"polygon_31 is shown on the screen, written out."],[190.44249966329969,"polygon_32 is shown on the screen, written out."]]},{"start":197.02783333333335,"say":"Stop it here. The outlined cells are the frontier at this instant: expanded cells behind them, unreached cells in front.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32"],"does":[[198.90833333333336,"polygon_33 is shown on the screen, written out."],[198.95062291963862,"polygon_34 is shown on the screen, written out."],[198.9929125059439,"polygon_35 is shown on the screen, written out."],[199.0352020922492,"polygon_36 is shown on the screen, written out."],[199.07749167855445,"polygon_37 is shown on the screen, written out."],[199.11978126485974,"polygon_38 is shown on the screen, written out."],[199.16207085116503,"polygon_39 is shown on the screen, written out."],[199.2043604374703,"polygon_40 is shown on the screen, written out."]]},{"start":205.91683333333333,"say":"The frontier is a diamond rather than a circle, because distance is counted in horizontal and vertical steps. And it spreads behind the start as readily as ahead of it. Let the wave run on, and half of that work is going away from G.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_33","polygon_34","polygon_35","polygon_36","polygon_37","polygon_38","polygon_39","polygon_40"],"does":[[216.71433333333334,"polygon_33 is hidden from the screen."],[216.71433333333334,"polygon_34 is hidden from the screen."],[216.71433333333334,"polygon_35 is hidden from the screen."],[216.71433333333334,"polygon_36 is hidden from the screen."],[216.71433333333334,"polygon_37 is hidden from the screen."],[216.71433333333334,"polygon_38 is hidden from the screen."],[216.71433333333334,"polygon_39 is hidden from the screen."],[216.71433333333334,"polygon_40 is hidden from the screen."],[216.71433333333334,"polygon_41 is shown on the screen, written out."],[216.77881962056426,"polygon_42 is shown on the screen, written out."],[216.84330590779516,"polygon_43 is shown on the screen, written out."],[216.90779219502605,"polygon_44 is shown on the screen, written out."],[216.97227848225697,"polygon_45 is shown on the screen, written out."],[217.03245689570434,"polygon_46 is shown on the screen, written out."],[217.09193160817853,"polygon_47 is shown on the screen, written out."],[217.1514063206527,"polygon_48 is shown on the screen, written out."],[217.2723416642092,"polygon_49 is shown on the screen, written out."],[217.44412395556867,"polygon_50 is shown on the screen, written out."],[217.61590624692815,"polygon_51 is shown on the screen, written out."],[217.7630073233068,"polygon_52 is shown on the screen, written out."],[217.82972768603167,"polygon_53 is shown on the screen, written out."],[217.8964480487565,"polygon_54 is shown on the screen, written out."],[217.96316841148138,"polygon_55 is shown on the screen, written out."],[218.02002876241028,"polygon_56 is shown on the screen, written out."]]},{"start":221.04383333333334,"say":"Keep going. The expansion folds around the walls and continues, filling cells that no shortest route to G could use.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56"],"does":[[221.26433333333335,"polygon_57 is shown on the screen, written out."],[221.31730958001378,"polygon_58 is shown on the screen, written out."],[221.37028582669421,"polygon_59 is shown on the screen, written out."],[221.42326207337464,"polygon_60 is shown on the screen, written out."],[221.47623832005507,"polygon_61 is shown on the screen, written out."],[221.5292145667355,"polygon_62 is shown on the screen, written out."],[221.68419915974653,"polygon_63 is shown on the screen, written out."],[221.87624822605346,"polygon_64 is shown on the screen, written out."],[222.06829729236043,"polygon_65 is shown on the screen, written out."],[222.2603463586674,"polygon_66 is shown on the screen, written out."],[222.45239542497433,"polygon_67 is shown on the screen, written out."],[222.64444449128132,"polygon_68 is shown on the screen, written out."]]},{"start":229.81733333333335,"say":"The goal is reached last, because it is far from the start and the search had no reason to hurry towards it. The route returned is a shortest one: ten steps.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68"],"does":[[230.72233333333332,"polygon_12 is indicated — a transient flash."],[236.33033333333333,"route is shown on the screen, written out."],[236.4104032328528,"route_2 is shown on the screen, written out."],[236.49047313237222,"route_3 is shown on the screen, written out."],[236.57384578418524,"route_4 is shown on the screen, written out."],[236.68612771224699,"route_5 is shown on the screen, written out."],[236.7984096403087,"route_6 is shown on the screen, written out."],[236.91069156837045,"route_7 is shown on the screen, written out."],[237.0229734964322,"route_8 is shown on the screen, written out."],[237.11715727391874,"route_9 is shown on the screen, written out."],[237.21145522062037,"route_10 is shown on the screen, written out."]]},{"start":240.29733333333334,"say":"That optimality is not negotiable. Whatever we add to make the search look in the right direction must still return a route of least cost.","live":["grid","rule","heading","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10"],"does":[[247.49533333333335,"route is indicated — a transient flash."],[247.49533333333335,"route_2 is indicated — a transient flash."],[247.49533333333335,"route_3 is indicated — a transient flash."],[247.49533333333335,"route_4 is indicated — a transient flash."],[247.49533333333335,"route_5 is indicated — a transient flash."],[247.49533333333335,"route_6 is indicated — a transient flash."],[247.49533333333335,"route_7 is indicated — a transient flash."],[247.49533333333335,"route_8 is indicated — a transient flash."],[247.49533333333335,"route_9 is indicated — a transient flash."],[247.49533333333335,"route_10 is indicated — a transient flash."],[248.71433333333334,"grid moves to a new place on the board."],[248.71433333333334,"rule moves to a new place on the board."],[248.71433333333334,"heading is hidden from the screen — left the board."]]},{"start":249.91433333333333,"say":"Now count the work. Before the goal came off the queue, every cell strictly closer to the start than the goal is had already been expanded. That is this many, out of the sixty-seven cells of this grid that are not walls.","live":["grid","rule","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10"],"does":[[249.91433333333333,"closing is shown on the screen, written out."],[250.54133333333334,"count is shown on the screen, written out."],[260.03833333333336,"count is indicated — a transient flash."]]},{"start":265.17783333333335,"say":"That is not a defect of the implementation; it follows from the rule. g measures the past, and a search that ranks candidates by the past alone cannot tell a promising direction from a hopeless one.","live":["grid","rule","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10","count","closing"],"does":[[268.20833333333337,"verdict is shown on the screen, written out."]]},{"start":278.28183333333334,"say":"What is missing is a term that looks forward.","live":["grid","rule","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","polygon_14","polygon_15","polygon_16","polygon_17","polygon_18","polygon_19","polygon_20","polygon_21","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","polygon_49","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10","count","verdict","closing"],"does":[[279.04833333333335,"rule is indicated — a transient flash."],[281.3623958333334,"closing is hidden from the screen — left the board."],[281.3623958333334,"count is hidden from the screen — left the board."],[281.3623958333334,"grid is hidden from the screen — left the board."],[281.3623958333334,"lattice is hidden from the screen — grid left the board."],[281.3623958333334,"polygon is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_2 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_3 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_4 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_5 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_6 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_7 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_8 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_9 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_10 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_11 is hidden from the screen — grid left the board."],[281.3623958333334,"start_mark is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_12 is hidden from the screen — grid left the board."],[281.3623958333334,"goal_mark is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_13 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_14 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_15 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_16 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_17 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_18 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_19 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_20 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_21 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_22 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_23 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_24 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_25 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_26 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_27 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_28 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_29 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_30 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_31 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_32 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_41 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_42 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_43 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_44 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_45 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_46 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_47 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_48 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_49 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_50 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_51 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_52 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_53 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_54 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_55 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_56 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_57 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_58 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_59 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_60 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_61 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_62 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_63 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_64 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_65 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_66 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_67 is hidden from the screen — grid left the board."],[281.3623958333334,"polygon_68 is hidden from the screen — grid left the board."],[281.3623958333334,"route is hidden from the screen — grid left the board."],[281.3623958333334,"route_2 is hidden from the screen — grid left the board."],[281.3623958333334,"route_3 is hidden from the screen — grid left the board."],[281.3623958333334,"route_4 is hidden from the screen — grid left the board."],[281.3623958333334,"route_5 is hidden from the screen — grid left the board."],[281.3623958333334,"route_6 is hidden from the screen — grid left the board."],[281.3623958333334,"route_7 is hidden from the screen — grid left the board."],[281.3623958333334,"route_8 is hidden from the screen — grid left the board."],[281.3623958333334,"route_9 is hidden from the screen — grid left the board."],[281.3623958333334,"route_10 is hidden from the screen — grid left the board."],[281.3623958333334,"rule is hidden from the screen — left the board."],[281.3623958333334,"verdict is hidden from the screen — left the board."]]}]},{"title":"The Estimate of What Remains","start":282.4040625,"end":428.0296041666667,"objects":{"bound":"a Math [text] that says \"$h(n) <= upright(\"true remaining cost\")$\"","bound_note":"a Text [text] that says \"Any route must take at least $Delta x$ horizontal and $Delta y$ vertical steps. Walls can only add more.\"","col":"a VariableNumber (initial_value=2.0)","cost_at":"a Math [text] that says \"$g(n) = 6$\"","cost_route":"a Line [green] drawn in grid (start=(1.5, 3.5), end=(1.5, 4.5))","cost_route_2":"a Line [green] drawn in grid (start=(1.5, 4.5), end=(2.5, 4.5))","cost_route_3":"a Line [green] drawn in grid (start=(2.5, 4.5), end=(3.5, 4.5))","cost_route_4":"a Line [green] drawn in grid (start=(3.5, 4.5), end=(4.5, 4.5))","cost_route_5":"a Line [green] drawn in grid (start=(4.5, 4.5), end=(4.5, 5.5))","cost_route_6":"a Line [green] drawn in grid (start=(4.5, 5.5), end=(5.5, 5.5))","est_at":"a Math [text] that says \"$h(n) = 6$\"","estimate":"a VariableNumber (initial_value=9.0, format_spec='.0f')","goal_mark":"a Math [text] that says \"$G$\" drawn in grid","grid":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 7.0), aspect=(11.0, 7.0))","h_def":"a Math [text] that says \"$h(n) = Delta x + Delta y$\"","h_panel":"a Panel that says \"$Delta x$ and $Delta y$ are the horizontal and vertical separations from the cell to the goal. Walls are ignored.\"","head_adm":"a Heading that says \"The Estimate Never Overshoots\"","head_est":"a Heading that says \"An Estimate That Costs Nothing\"","head_sum":"a Heading that says \"What the Sum Rules Out\"","lattice":"a Gridlines [gray] drawn in grid (x_range=(0.0, 11.0), y_range=(0.0, 7.0), step=1.0)","leg_across":"a Line [magenta] drawn in grid (start=((col + 0.5), (row + 0.5)), end=(9.5, (row + 0.5)), dashed=True)","leg_up":"a Line [magenta] drawn in grid (start=(9.5, (row + 0.5)), end=(9.5, 3.5), dashed=True)","polygon":"a Polygon [gray] drawn in grid (vertices=((4.08, 0.08), (4.92, 0.08), (4.92, 0.92), (4.08, 0.92)), fill_opacity=0.85)","polygon_10":"a Polygon [gray] drawn in grid (vertices=((8.08, 1.08), (8.92, 1.08), (8.92, 1.92), (8.08, 1.92)), fill_opacity=0.85)","polygon_11":"a Polygon [green] drawn in grid (vertices=((1.08, 3.08), (1.92, 3.08), (1.92, 3.92), (1.08, 3.92)), fill_opacity=0.7)","polygon_12":"a Polygon [red] drawn in grid (vertices=((9.08, 3.08), (9.92, 3.08), (9.92, 3.92), (9.08, 3.92)), fill_opacity=0.7)","polygon_2":"a Polygon [gray] drawn in grid (vertices=((4.08, 1.08), (4.92, 1.08), (4.92, 1.92), (4.08, 1.92)), fill_opacity=0.85)","polygon_3":"a Polygon [gray] drawn in grid (vertices=((3.08, 5.08), (3.92, 5.08), (3.92, 5.92), (3.08, 5.92)), fill_opacity=0.85)","polygon_4":"a Polygon [gray] drawn in grid (vertices=((3.08, 6.08), (3.92, 6.08), (3.92, 6.92), (3.08, 6.92)), fill_opacity=0.85)","polygon_5":"a Polygon [gray] drawn in grid (vertices=((6.08, 3.08), (6.92, 3.08), (6.92, 3.92), (6.08, 3.92)), fill_opacity=0.85)","polygon_6":"a Polygon [gray] drawn in grid (vertices=((6.08, 4.08), (6.92, 4.08), (6.92, 4.92), (6.08, 4.92)), fill_opacity=0.85)","polygon_7":"a Polygon [gray] drawn in grid (vertices=((6.08, 5.08), (6.92, 5.08), (6.92, 5.92), (6.08, 5.92)), fill_opacity=0.85)","polygon_8":"a Polygon [gray] drawn in grid (vertices=((6.08, 6.08), (6.92, 6.08), (6.92, 6.92), (6.08, 6.92)), fill_opacity=0.85)","polygon_9":"a Polygon [gray] drawn in grid (vertices=((8.08, 0.08), (8.92, 0.08), (8.92, 0.92), (8.08, 0.92)), fill_opacity=0.85)","probe":"a Polygon [blue] drawn in grid (vertices=(((col + 0.08), (row + 0.08)), ((col + 0.92), (row + 0.08)), ((…, fill_opacity=0.55)","reading":"a Point [magenta] labelled \"h = 9\" drawn in grid (location=((col + 0.5), <VariableNumber row = 5.0>), show_marker=False)","row":"a VariableNumber (initial_value=1.0)","start_mark":"a Math [text] that says \"$S$\" drawn in grid","total_at":"a Math [text] that says \"$f(n) = 12$\"","true_route":"a Line [yellow] drawn in grid (start=(5.5, 5.5), end=(5.5, 4.5))","true_route_2":"a Line [yellow] drawn in grid (start=(5.5, 4.5), end=(5.5, 3.5))","true_route_3":"a Line [yellow] drawn in grid (start=(5.5, 3.5), end=(5.5, 2.5))","true_route_4":"a Line [yellow] drawn in grid (start=(5.5, 2.5), end=(6.5, 2.5))","true_route_5":"a Line [yellow] drawn in grid (start=(6.5, 2.5), end=(7.5, 2.5))","true_route_6":"a Line [yellow] drawn in grid (start=(7.5, 2.5), end=(7.5, 3.5))","true_route_7":"a Line [yellow] drawn in grid (start=(7.5, 3.5), end=(8.5, 3.5))","true_route_8":"a Line [yellow] drawn in grid (start=(8.5, 3.5), end=(9.5, 3.5))","verdict":"a Text [text] that says \"A cell with $f(n) = 12$ cannot lie on a route costing 10.\""},"beats":[{"start":282.4040625,"say":"The missing term is an estimate of the cost that remains. For every cell we want a number saying, without any searching, roughly how far the goal still is.","live":[],"does":[[282.4040625,"head_est is shown on the screen, written out."],[282.4040625,"grid is shown on the screen, written out."],[282.4040625,"lattice is shown on the screen, written out."],[282.4040625,"polygon is shown on the screen, written out."],[282.4460625,"polygon_2 is shown on the screen, written out."],[282.47906692477875,"polygon_3 is shown on the screen, written out."],[282.49408019911505,"polygon_4 is shown on the screen, written out."],[282.50909347345134,"polygon_5 is shown on the screen, written out."],[282.52410674778764,"polygon_6 is shown on the screen, written out."],[282.5391200221239,"polygon_7 is shown on the screen, written out."],[282.5541332964602,"polygon_8 is shown on the screen, written out."],[282.5691465707965,"polygon_9 is shown on the screen, written out."],[282.5841598451328,"polygon_10 is shown on the screen, written out."],[290.1010625,"polygon_11 is shown on the screen, written out."],[290.1010625,"start_mark is shown on the screen, written out."],[290.1010625,"polygon_12 is shown on the screen, written out."],[290.1010625,"goal_mark is shown on the screen, written out."]]},{"start":291.9900625,"say":"Here is the estimate this lecture uses. Ignore the walls completely. Count the horizontal separation between the cell and the goal, count the vertical separation, and add the two. That is the Manhattan distance.","live":["grid","head_est","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark"],"does":[[295.1250625,"grid moves to a new place on the board."],[295.1250625,"h_panel is shown on the screen, written out."],[302.3460625,"h_def is shown on the screen, written out."]]},{"start":306.49906250000004,"say":"Take this cell. It is seven columns and two rows from the goal, so the estimate is nine.","live":["h_panel","h_def","grid","head_est","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark"],"does":[[306.8470625,"probe is shown on the screen, written out."],[306.8470625,"leg_across is shown on the screen, written out."],[306.8470625,"leg_up is shown on the screen, written out."],[312.14106250000003,"reading is shown on the screen, written out."]]},{"start":313.6580625,"say":"Move the cell and the number follows. Here it is six.","live":["h_panel","h_def","grid","head_est","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading"],"does":[[314.1340625,"probe is redrawn as the numbers it depends on change."],[314.1340625,"leg_across is redrawn as the numbers it depends on change."],[314.1340625,"reading is redrawn as the numbers it depends on change."],[314.1340625,"col ticks to 5.0."],[314.1340625,"estimate ticks to 6.0."]]},{"start":318.71056250000004,"say":"Nearer the goal, it is two. And computing it costs two subtractions and an addition: no search, no queue, no walls consulted.","live":null,"does":[[318.9020625,"probe is redrawn as the numbers it depends on change."],[318.9020625,"leg_across is redrawn as the numbers it depends on change."],[318.9020625,"leg_up is redrawn as the numbers it depends on change."],[318.9020625,"reading is redrawn as the numbers it depends on change."],[318.9020625,"col ticks to 8.0."],[318.9020625,"row ticks to 4.0."],[318.9020625,"estimate ticks to 2.0."],[328.39356250000003,"h_def is hidden from the screen — left the board."],[328.39356250000003,"h_panel is hidden from the screen — left the board."],[328.39356250000003,"head_est is hidden from the screen — left the board."]]},{"start":329.1935625,"say":"The estimate ignores walls, and that has a consequence worth seeing. Move the cell here.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading"],"does":[[329.1935625,"head_adm is shown on the screen, written out."],[335.1210625,"probe is redrawn as the numbers it depends on change."],[335.1210625,"leg_across is redrawn as the numbers it depends on change."],[335.1210625,"leg_up is redrawn as the numbers it depends on change."],[335.1210625,"reading is redrawn as the numbers it depends on change."],[335.1210625,"col ticks to 5.0."],[335.1210625,"row ticks to 5.0."],[335.1210625,"estimate ticks to 6.0."]]},{"start":336.4635625,"say":"The estimate is six: four columns across and two rows down. But look where the dashed figure runs. It goes straight through this wall, and no route can follow it.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","head_adm"],"does":[[344.5090625,"polygon_7 is indicated — a transient flash."]]},{"start":347.0250625,"say":"The true remaining cost is eight, not six. A route has to come down to this row, pass the barrier, and climb back up to G.","live":null,"does":[[350.8330625,"true_route is shown on the screen, written out."],[350.96510712531574,"true_route_2 is shown on the screen, written out."],[351.1023379701095,"true_route_3 is shown on the screen, written out."],[351.30972570516417,"true_route_4 is shown on the screen, written out."],[351.44893470507066,"true_route_5 is shown on the screen, written out."],[351.5830945516419,"true_route_6 is shown on the screen, written out."],[351.72183246912715,"true_route_7 is shown on the screen, written out."],[351.86599413064835,"true_route_8 is shown on the screen, written out."]]},{"start":356.4250625,"say":"So the estimate falls short of the truth, and that is precisely the property we want. An estimate that never exceeds the true remaining cost is called admissible.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","head_adm","true_route","true_route_2","true_route_3","true_route_4","true_route_5","true_route_6","true_route_7","true_route_8"],"does":[[360.1640625,"bound is shown on the screen, written out."]]},{"start":366.9290625,"say":"The Manhattan estimate is admissible on this grid, because any route must make at least the horizontal steps and at least the vertical steps that separate the cell from the goal, and walls can only force it to make more. Admissibility is what will let us keep the optimality that Dijkstra's algorithm gave us.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","bound","head_adm","true_route","true_route_2","true_route_3","true_route_4","true_route_5","true_route_6","true_route_7","true_route_8"],"does":[[370.4810625,"bound_note is shown on the screen, written out."],[384.5300625,"bound is hidden from the screen — left the board."],[384.5300625,"bound_note is hidden from the screen — left the board."],[384.5300625,"head_adm is hidden from the screen — left the board."]]},{"start":385.1300625,"say":"Now put both costs together at this cell. The cheapest route the search can trace from S to it costs six steps, so g is six. The estimate ahead is six as well, so f is twelve.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","true_route","true_route_2","true_route_3","true_route_4","true_route_5","true_route_6","true_route_7","true_route_8"],"does":[[385.1300625,"head_sum is shown on the screen, written out."],[389.3560625,"cost_route is shown on the screen, written out."],[389.539539624183,"cost_route_2 is shown on the screen, written out."],[389.72375975490195,"cost_route_3 is shown on the screen, written out."],[389.93296250000003,"cost_route_4 is shown on the screen, written out."],[390.2202781862745,"cost_route_5 is shown on the screen, written out."],[390.64255269607844,"cost_route_6 is shown on the screen, written out."],[392.6180625,"cost_at is shown on the screen, written out."],[393.99906250000004,"est_at is shown on the screen, written out."],[396.2750625,"total_at is shown on the screen, written out."]]},{"start":397.7110625,"say":"Notice that twelve is not the true cost of the best route through this cell. In green and yellow together, that route is fourteen steps. Twelve is a lower bound on it, and a lower bound is all we need: twelve already exceeds ten, and a ten-step route exists.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","true_route","true_route_2","true_route_3","true_route_4","true_route_5","true_route_6","true_route_7","true_route_8","cost_at","est_at","total_at","head_sum","cost_route","cost_route_2","cost_route_3","cost_route_4","cost_route_5","cost_route_6"],"does":[[407.3700625,"total_at is indicated — a transient flash."],[411.3990625,"verdict is shown on the screen, written out."],[413.68606250000005,"A box is drawn around total_at."]]},{"start":415.3195625,"say":"So this cell can be discarded without ever being expanded. That is the mechanism: g rules out nothing, h rules out nothing, and their sum rules out most of the maze.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","probe","leg_across","leg_up","reading","true_route","true_route_2","true_route_3","true_route_4","true_route_5","true_route_6","true_route_7","true_route_8","cost_at","est_at","total_at","verdict","head_sum","cost_route","cost_route_2","cost_route_3","cost_route_4","cost_route_5","cost_route_6"],"does":[[426.9879375,"cost_at is hidden from the screen — left the board."],[426.9879375,"est_at is hidden from the screen — left the board."],[426.9879375,"grid is hidden from the screen — left the board."],[426.9879375,"lattice is hidden from the screen — grid left the board."],[426.9879375,"polygon is hidden from the screen — grid left the board."],[426.9879375,"polygon_2 is hidden from the screen — grid left the board."],[426.9879375,"polygon_3 is hidden from the screen — grid left the board."],[426.9879375,"polygon_4 is hidden from the screen — grid left the board."],[426.9879375,"polygon_5 is hidden from the screen — grid left the board."],[426.9879375,"polygon_6 is hidden from the screen — grid left the board."],[426.9879375,"polygon_7 is hidden from the screen — grid left the board."],[426.9879375,"polygon_8 is hidden from the screen — grid left the board."],[426.9879375,"polygon_9 is hidden from the screen — grid left the board."],[426.9879375,"polygon_10 is hidden from the screen — grid left the board."],[426.9879375,"polygon_11 is hidden from the screen — grid left the board."],[426.9879375,"start_mark is hidden from the screen — grid left the board."],[426.9879375,"polygon_12 is hidden from the screen — grid left the board."],[426.9879375,"goal_mark is hidden from the screen — grid left the board."],[426.9879375,"probe is hidden from the screen — grid left the board."],[426.9879375,"leg_across is hidden from the screen — grid left the board."],[426.9879375,"leg_up is hidden from the screen — grid left the board."],[426.9879375,"reading is hidden from the screen — grid left the board."],[426.9879375,"true_route is hidden from the screen — grid left the board."],[426.9879375,"true_route_2 is hidden from the screen — grid left the board."],[426.9879375,"true_route_3 is hidden from the screen — grid left the board."],[426.9879375,"true_route_4 is hidden from the screen — grid left the board."],[426.9879375,"true_route_5 is hidden from the screen — grid left the board."],[426.9879375,"true_route_6 is hidden from the screen — grid left the board."],[426.9879375,"true_route_7 is hidden from the screen — grid left the board."],[426.9879375,"true_route_8 is hidden from the screen — grid left the board."],[426.9879375,"cost_route is hidden from the screen — grid left the board."],[426.9879375,"cost_route_2 is hidden from the screen — grid left the board."],[426.9879375,"cost_route_3 is hidden from the screen — grid left the board."],[426.9879375,"cost_route_4 is hidden from the screen — grid left the board."],[426.9879375,"cost_route_5 is hidden from the screen — grid left the board."],[426.9879375,"cost_route_6 is hidden from the screen — grid left the board."],[426.9879375,"head_sum is hidden from the screen — left the board."],[426.9879375,"total_at is hidden from the screen — left the board."],[426.9879375,"verdict is hidden from the screen — left the board."]]}]},{"title":"The Informed Frontier","start":428.0296041666667,"end":638.93875,"objects":{"blind":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 7.0), aspect=(11.0, 7.0))","blind_goal_mark":"a Math [text] that says \"$G$\" drawn in blind","blind_label":"a Tex [text] that says \"Ranked by $g$: 49 cells expanded\"","blind_lattice":"a Gridlines [gray] drawn in blind (x_range=(0.0, 11.0), y_range=(0.0, 7.0), step=1.0)","blind_start_mark":"a Math [text] that says \"$S$\" drawn in blind","goal_mark":"a Math [text] that says \"$G$\" drawn in grid","grid":"a Figure (x_range=(0.0, 11.0), y_range=(0.0, 7.0), aspect=(11.0, 7.0))","head_close":"a Heading that says \"What to Carry Away\"","head_cmp":"a Heading that says \"The Same Route, Different Work\"","head_more":"a Heading that says \"Where the Frontier Goes\"","head_queue":"a Heading that says \"One Comparison in the Queue\"","head_run":"a Heading that says \"Ranking by Cost Plus Estimate\"","lattice":"a Gridlines [gray] drawn in grid (x_range=(0.0, 11.0), y_range=(0.0, 7.0), step=1.0)","point_one":"a Text [text] that says \"1. $g$ is measured, $h$ is estimated, and $f$ is the only number compared.\"","point_three":"a Text [text] that says \"3. $h = 0$ gives Dijkstra; a sharper $h$ narrows the expanded region.\"","point_two":"a Text [text] that says \"2. An admissible $h$ never overshoots, so the route stays optimal.\"","polygon":"a Polygon [gray] drawn in grid (vertices=((4.08, 0.08), (4.92, 0.08), (4.92, 0.92), (4.08, 0.92)), fill_opacity=0.85)","polygon_10":"a Polygon [gray] drawn in grid (vertices=((8.08, 1.08), (8.92, 1.08), (8.92, 1.92), (8.08, 1.92)), fill_opacity=0.85)","polygon_11":"a Polygon [green] drawn in grid (vertices=((1.08, 3.08), (1.92, 3.08), (1.92, 3.92), (1.08, 3.92)), fill_opacity=0.7)","polygon_12":"a Polygon [red] drawn in grid (vertices=((9.08, 3.08), (9.92, 3.08), (9.92, 3.92), (9.08, 3.92)), fill_opacity=0.7)","polygon_13":"a Polygon [blue] drawn in grid (vertices=((2.08, 3.08), (2.92, 3.08), (2.92, 3.92), (2.08, 3.92)), fill_opacity=0.4)","polygon_14":"a Polygon [blue] drawn in grid (vertices=((3.08, 3.08), (3.92, 3.08), (3.92, 3.92), (3.08, 3.92)), fill_opacity=0.4)","polygon_15":"a Polygon [blue] drawn in grid (vertices=((4.08, 3.08), (4.92, 3.08), (4.92, 3.92), (4.08, 3.92)), fill_opacity=0.4)","polygon_16":"a Polygon [blue] drawn in grid (vertices=((5.08, 3.08), (5.92, 3.08), (5.92, 3.92), (5.08, 3.92)), fill_opacity=0.4)","polygon_17":"a Polygon [blue] drawn in grid (vertices=((5.08, 2.08), (5.92, 2.08), (5.92, 2.92), (5.08, 2.92)), fill_opacity=0.4)","polygon_18":"a Polygon [blue] drawn in grid (vertices=((6.08, 2.08), (6.92, 2.08), (6.92, 2.92), (6.08, 2.92)), fill_opacity=0.4)","polygon_19":"a Polygon [blue] drawn in grid (vertices=((7.08, 2.08), (7.92, 2.08), (7.92, 2.92), (7.08, 2.92)), fill_opacity=0.4)","polygon_2":"a Polygon [gray] drawn in grid (vertices=((4.08, 1.08), (4.92, 1.08), (4.92, 1.92), (4.08, 1.92)), fill_opacity=0.85)","polygon_20":"a Polygon [blue] drawn in grid (vertices=((7.08, 3.08), (7.92, 3.08), (7.92, 3.92), (7.08, 3.92)), fill_opacity=0.4)","polygon_21":"a Polygon [blue] drawn in grid (vertices=((8.08, 3.08), (8.92, 3.08), (8.92, 3.92), (8.08, 3.92)), fill_opacity=0.4)","polygon_22":"a Polygon [yellow] drawn in grid (vertices=((0.08, 3.08), (0.92, 3.08), (0.92, 3.92), (0.08, 3.92)), fill_opacity=0.35)","polygon_23":"a Polygon [yellow] drawn in grid (vertices=((1.08, 2.08), (1.92, 2.08), (1.92, 2.92), (1.08, 2.92)), fill_opacity=0.35)","polygon_24":"a Polygon [yellow] drawn in grid (vertices=((1.08, 4.08), (1.92, 4.08), (1.92, 4.92), (1.08, 4.92)), fill_opacity=0.35)","polygon_25":"a Polygon [yellow] drawn in grid (vertices=((2.08, 2.08), (2.92, 2.08), (2.92, 2.92), (2.08, 2.92)), fill_opacity=0.35)","polygon_26":"a Polygon [yellow] drawn in grid (vertices=((2.08, 4.08), (2.92, 4.08), (2.92, 4.92), (2.08, 4.92)), fill_opacity=0.35)","polygon_27":"a Polygon [yellow] drawn in grid (vertices=((3.08, 2.08), (3.92, 2.08), (3.92, 2.92), (3.08, 2.92)), fill_opacity=0.35)","polygon_28":"a Polygon [yellow] drawn in grid (vertices=((3.08, 4.08), (3.92, 4.08), (3.92, 4.92), (3.08, 4.92)), fill_opacity=0.35)","polygon_29":"a Polygon [yellow] drawn in grid (vertices=((4.08, 2.08), (4.92, 2.08), (4.92, 2.92), (4.08, 2.92)), fill_opacity=0.35)","polygon_3":"a Polygon [gray] drawn in grid (vertices=((3.08, 5.08), (3.92, 5.08), (3.92, 5.92), (3.08, 5.92)), fill_opacity=0.85)","polygon_30":"a Polygon [yellow] drawn in grid (vertices=((4.08, 4.08), (4.92, 4.08), (4.92, 4.92), (4.08, 4.92)), fill_opacity=0.35)","polygon_31":"a Polygon [yellow] drawn in grid (vertices=((5.08, 1.08), (5.92, 1.08), (5.92, 1.92), (5.08, 1.92)), fill_opacity=0.35)","polygon_32":"a Polygon [yellow] drawn in grid (vertices=((5.08, 4.08), (5.92, 4.08), (5.92, 4.92), (5.08, 4.92)), fill_opacity=0.35)","polygon_33":"a Polygon [yellow] drawn in grid (vertices=((6.08, 1.08), (6.92, 1.08), (6.92, 1.92), (6.08, 1.92)), fill_opacity=0.35)","polygon_34":"a Polygon [yellow] drawn in grid (vertices=((7.08, 1.08), (7.92, 1.08), (7.92, 1.92), (7.08, 1.92)), fill_opacity=0.35)","polygon_35":"a Polygon [yellow] drawn in grid (vertices=((7.08, 4.08), (7.92, 4.08), (7.92, 4.92), (7.08, 4.92)), fill_opacity=0.35)","polygon_36":"a Polygon [yellow] drawn in grid (vertices=((8.08, 2.08), (8.92, 2.08), (8.92, 2.92), (8.08, 2.92)), fill_opacity=0.35)","polygon_37":"a Polygon [yellow] drawn in grid (vertices=((8.08, 4.08), (8.92, 4.08), (8.92, 4.92), (8.08, 4.92)), fill_opacity=0.35)","polygon_38":"a Polygon [gray] drawn in blind (vertices=((4.08, 0.08), (4.92, 0.08), (4.92, 0.92), (4.08, 0.92)), fill_opacity=0.85)","polygon_39":"a Polygon [gray] drawn in blind (vertices=((4.08, 1.08), (4.92, 1.08), (4.92, 1.92), (4.08, 1.92)), fill_opacity=0.85)","polygon_4":"a Polygon [gray] drawn in grid (vertices=((3.08, 6.08), (3.92, 6.08), (3.92, 6.92), (3.08, 6.92)), fill_opacity=0.85)","polygon_40":"a Polygon [gray] drawn in blind (vertices=((3.08, 5.08), (3.92, 5.08), (3.92, 5.92), (3.08, 5.92)), fill_opacity=0.85)","polygon_41":"a Polygon [gray] drawn in blind (vertices=((3.08, 6.08), (3.92, 6.08), (3.92, 6.92), (3.08, 6.92)), fill_opacity=0.85)","polygon_42":"a Polygon [gray] drawn in blind (vertices=((6.08, 3.08), (6.92, 3.08), (6.92, 3.92), (6.08, 3.92)), fill_opacity=0.85)","polygon_43":"a Polygon [gray] drawn in blind (vertices=((6.08, 4.08), (6.92, 4.08), (6.92, 4.92), (6.08, 4.92)), fill_opacity=0.85)","polygon_44":"a Polygon [gray] drawn in blind (vertices=((6.08, 5.08), (6.92, 5.08), (6.92, 5.92), (6.08, 5.92)), fill_opacity=0.85)","polygon_45":"a Polygon [gray] drawn in blind (vertices=((6.08, 6.08), (6.92, 6.08), (6.92, 6.92), (6.08, 6.92)), fill_opacity=0.85)","polygon_46":"a Polygon [gray] drawn in blind (vertices=((8.08, 0.08), (8.92, 0.08), (8.92, 0.92), (8.08, 0.92)), fill_opacity=0.85)","polygon_47":"a Polygon [gray] drawn in blind (vertices=((8.08, 1.08), (8.92, 1.08), (8.92, 1.92), (8.08, 1.92)), fill_opacity=0.85)","polygon_48":"a Polygon [green] drawn in blind (vertices=((1.08, 3.08), (1.92, 3.08), (1.92, 3.92), (1.08, 3.92)), fill_opacity=0.7)","polygon_49":"a Polygon [red] drawn in blind (vertices=((9.08, 3.08), (9.92, 3.08), (9.92, 3.92), (9.08, 3.92)), fill_opacity=0.7)","polygon_5":"a Polygon [gray] drawn in grid (vertices=((6.08, 3.08), (6.92, 3.08), (6.92, 3.92), (6.08, 3.92)), fill_opacity=0.85)","polygon_50":"a Polygon [blue] drawn in blind (vertices=((2.08, 3.08), (2.92, 3.08), (2.92, 3.92), (2.08, 3.92)), fill_opacity=0.4)","polygon_51":"a Polygon [blue] drawn in blind (vertices=((0.08, 3.08), (0.92, 3.08), (0.92, 3.92), (0.08, 3.92)), fill_opacity=0.4)","polygon_52":"a Polygon [blue] drawn in blind (vertices=((1.08, 4.08), (1.92, 4.08), (1.92, 4.92), (1.08, 4.92)), fill_opacity=0.4)","polygon_53":"a Polygon [blue] drawn in blind (vertices=((1.08, 2.08), (1.92, 2.08), (1.92, 2.92), (1.08, 2.92)), fill_opacity=0.4)","polygon_54":"a Polygon [blue] drawn in blind (vertices=((3.08, 3.08), (3.92, 3.08), (3.92, 3.92), (3.08, 3.92)), fill_opacity=0.4)","polygon_55":"a Polygon [blue] drawn in blind (vertices=((2.08, 4.08), (2.92, 4.08), (2.92, 4.92), (2.08, 4.92)), fill_opacity=0.4)","polygon_56":"a Polygon [blue] drawn in blind (vertices=((2.08, 2.08), (2.92, 2.08), (2.92, 2.92), (2.08, 2.92)), fill_opacity=0.4)","polygon_57":"a Polygon [blue] drawn in blind (vertices=((0.08, 4.08), (0.92, 4.08), (0.92, 4.92), (0.08, 4.92)), fill_opacity=0.4)","polygon_58":"a Polygon [blue] drawn in blind (vertices=((0.08, 2.08), (0.92, 2.08), (0.92, 2.92), (0.08, 2.92)), fill_opacity=0.4)","polygon_59":"a Polygon [blue] drawn in blind (vertices=((1.08, 5.08), (1.92, 5.08), (1.92, 5.92), (1.08, 5.92)), fill_opacity=0.4)","polygon_6":"a Polygon [gray] drawn in grid (vertices=((6.08, 4.08), (6.92, 4.08), (6.92, 4.92), (6.08, 4.92)), fill_opacity=0.85)","polygon_60":"a Polygon [blue] drawn in blind (vertices=((1.08, 1.08), (1.92, 1.08), (1.92, 1.92), (1.08, 1.92)), fill_opacity=0.4)","polygon_61":"a Polygon [blue] drawn in blind (vertices=((4.08, 3.08), (4.92, 3.08), (4.92, 3.92), (4.08, 3.92)), fill_opacity=0.4)","polygon_62":"a Polygon [blue] drawn in blind (vertices=((3.08, 4.08), (3.92, 4.08), (3.92, 4.92), (3.08, 4.92)), fill_opacity=0.4)","polygon_63":"a Polygon [blue] drawn in blind (vertices=((3.08, 2.08), (3.92, 2.08), (3.92, 2.92), (3.08, 2.92)), fill_opacity=0.4)","polygon_64":"a Polygon [blue] drawn in blind (vertices=((2.08, 5.08), (2.92, 5.08), (2.92, 5.92), (2.08, 5.92)), fill_opacity=0.4)","polygon_65":"a Polygon [blue] drawn in blind (vertices=((2.08, 1.08), (2.92, 1.08), (2.92, 1.92), (2.08, 1.92)), fill_opacity=0.4)","polygon_66":"a Polygon [blue] drawn in blind (vertices=((0.08, 5.08), (0.92, 5.08), (0.92, 5.92), (0.08, 5.92)), fill_opacity=0.4)","polygon_67":"a Polygon [blue] drawn in blind (vertices=((0.08, 1.08), (0.92, 1.08), (0.92, 1.92), (0.08, 1.92)), fill_opacity=0.4)","polygon_68":"a Polygon [blue] drawn in blind (vertices=((1.08, 6.08), (1.92, 6.08), (1.92, 6.92), (1.08, 6.92)), fill_opacity=0.4)","polygon_69":"a Polygon [blue] drawn in blind (vertices=((1.08, 0.08), (1.92, 0.08), (1.92, 0.92), (1.08, 0.92)), fill_opacity=0.4)","polygon_7":"a Polygon [gray] drawn in grid (vertices=((6.08, 5.08), (6.92, 5.08), (6.92, 5.92), (6.08, 5.92)), fill_opacity=0.85)","polygon_70":"a Polygon [blue] drawn in blind (vertices=((5.08, 3.08), (5.92, 3.08), (5.92, 3.92), (5.08, 3.92)), fill_opacity=0.4)","polygon_71":"a Polygon [blue] drawn in blind (vertices=((4.08, 4.08), (4.92, 4.08), (4.92, 4.92), (4.08, 4.92)), fill_opacity=0.4)","polygon_72":"a Polygon [blue] drawn in blind (vertices=((4.08, 2.08), (4.92, 2.08), (4.92, 2.92), (4.08, 2.92)), fill_opacity=0.4)","polygon_73":"a Polygon [blue] drawn in blind (vertices=((3.08, 1.08), (3.92, 1.08), (3.92, 1.92), (3.08, 1.92)), fill_opacity=0.4)","polygon_74":"a Polygon [blue] drawn in blind (vertices=((2.08, 6.08), (2.92, 6.08), (2.92, 6.92), (2.08, 6.92)), fill_opacity=0.4)","polygon_75":"a Polygon [blue] drawn in blind (vertices=((2.08, 0.08), (2.92, 0.08), (2.92, 0.92), (2.08, 0.92)), fill_opacity=0.4)","polygon_76":"a Polygon [blue] drawn in blind (vertices=((0.08, 6.08), (0.92, 6.08), (0.92, 6.92), (0.08, 6.92)), fill_opacity=0.4)","polygon_77":"a Polygon [blue] drawn in blind (vertices=((0.08, 0.08), (0.92, 0.08), (0.92, 0.92), (0.08, 0.92)), fill_opacity=0.4)","polygon_78":"a Polygon [blue] drawn in blind (vertices=((5.08, 4.08), (5.92, 4.08), (5.92, 4.92), (5.08, 4.92)), fill_opacity=0.4)","polygon_79":"a Polygon [blue] drawn in blind (vertices=((5.08, 2.08), (5.92, 2.08), (5.92, 2.92), (5.08, 2.92)), fill_opacity=0.4)","polygon_8":"a Polygon [gray] drawn in grid (vertices=((6.08, 6.08), (6.92, 6.08), (6.92, 6.92), (6.08, 6.92)), fill_opacity=0.85)","polygon_80":"a Polygon [blue] drawn in blind (vertices=((4.08, 5.08), (4.92, 5.08), (4.92, 5.92), (4.08, 5.92)), fill_opacity=0.4)","polygon_81":"a Polygon [blue] drawn in blind (vertices=((3.08, 0.08), (3.92, 0.08), (3.92, 0.92), (3.08, 0.92)), fill_opacity=0.4)","polygon_82":"a Polygon [blue] drawn in blind (vertices=((5.08, 5.08), (5.92, 5.08), (5.92, 5.92), (5.08, 5.92)), fill_opacity=0.4)","polygon_83":"a Polygon [blue] drawn in blind (vertices=((6.08, 2.08), (6.92, 2.08), (6.92, 2.92), (6.08, 2.92)), fill_opacity=0.4)","polygon_84":"a Polygon [blue] drawn in blind (vertices=((5.08, 1.08), (5.92, 1.08), (5.92, 1.92), (5.08, 1.92)), fill_opacity=0.4)","polygon_85":"a Polygon [blue] drawn in blind (vertices=((4.08, 6.08), (4.92, 6.08), (4.92, 6.92), (4.08, 6.92)), fill_opacity=0.4)","polygon_86":"a Polygon [blue] drawn in blind (vertices=((5.08, 6.08), (5.92, 6.08), (5.92, 6.92), (5.08, 6.92)), fill_opacity=0.4)","polygon_87":"a Polygon [blue] drawn in blind (vertices=((7.08, 2.08), (7.92, 2.08), (7.92, 2.92), (7.08, 2.92)), fill_opacity=0.4)","polygon_88":"a Polygon [blue] drawn in blind (vertices=((6.08, 1.08), (6.92, 1.08), (6.92, 1.92), (6.08, 1.92)), fill_opacity=0.4)","polygon_89":"a Polygon [blue] drawn in blind (vertices=((5.08, 0.08), (5.92, 0.08), (5.92, 0.92), (5.08, 0.92)), fill_opacity=0.4)","polygon_9":"a Polygon [gray] drawn in grid (vertices=((8.08, 0.08), (8.92, 0.08), (8.92, 0.92), (8.08, 0.92)), fill_opacity=0.85)","polygon_90":"a Polygon [blue] drawn in blind (vertices=((8.08, 2.08), (8.92, 2.08), (8.92, 2.92), (8.08, 2.92)), fill_opacity=0.4)","polygon_91":"a Polygon [blue] drawn in blind (vertices=((7.08, 3.08), (7.92, 3.08), (7.92, 3.92), (7.08, 3.92)), fill_opacity=0.4)","polygon_92":"a Polygon [blue] drawn in blind (vertices=((7.08, 1.08), (7.92, 1.08), (7.92, 1.92), (7.08, 1.92)), fill_opacity=0.4)","polygon_93":"a Polygon [blue] drawn in blind (vertices=((6.08, 0.08), (6.92, 0.08), (6.92, 0.92), (6.08, 0.92)), fill_opacity=0.4)","polygon_94":"a Polygon [blue] drawn in blind (vertices=((9.08, 2.08), (9.92, 2.08), (9.92, 2.92), (9.08, 2.92)), fill_opacity=0.4)","polygon_95":"a Polygon [blue] drawn in blind (vertices=((8.08, 3.08), (8.92, 3.08), (8.92, 3.92), (8.08, 3.92)), fill_opacity=0.4)","polygon_96":"a Polygon [blue] drawn in blind (vertices=((7.08, 4.08), (7.92, 4.08), (7.92, 4.92), (7.08, 4.92)), fill_opacity=0.4)","polygon_97":"a Polygon [blue] drawn in blind (vertices=((7.08, 0.08), (7.92, 0.08), (7.92, 0.92), (7.08, 0.92)), fill_opacity=0.4)","queue":"a Table [text] that says \"reached cell $g$ $h$ $f$ towards $G$ 1 7 8 away from $G$ 1 9 10 above $S$ 1 9 10 below $S$ 1 9 10\" (rows=(('reached cell', '$g$', '$h$', '$f$'), ('towards $G$', '1', '7…, header=True)","route":"a Line [green] drawn in grid (start=(1.5, 3.5), end=(2.5, 3.5))","route_10":"a Line [green] drawn in grid (start=(8.5, 3.5), end=(9.5, 3.5))","route_2":"a Line [green] drawn in grid (start=(2.5, 3.5), end=(3.5, 3.5))","route_3":"a Line [green] drawn in grid (start=(3.5, 3.5), end=(4.5, 3.5))","route_4":"a Line [green] drawn in grid (start=(4.5, 3.5), end=(5.5, 3.5))","route_5":"a Line [green] drawn in grid (start=(5.5, 3.5), end=(5.5, 2.5))","route_6":"a Line [green] drawn in grid (start=(5.5, 2.5), end=(6.5, 2.5))","route_7":"a Line [green] drawn in grid (start=(6.5, 2.5), end=(7.5, 2.5))","route_8":"a Line [green] drawn in grid (start=(7.5, 2.5), end=(7.5, 3.5))","route_9":"a Line [green] drawn in grid (start=(7.5, 3.5), end=(8.5, 3.5))","rule_star":"a Tex [text] that says \"Expand the reached cell of least $f(n) = g(n) + h(n)$.\"","star_label":"a Tex [text] that says \"Ranked by $g + h$: 11 cells expanded\"","star_marks":"a Math [text] that says \"$8$\" drawn in grid","star_marks_2":"a Math [text] that says \"$8$\" drawn in grid","star_marks_3":"a Math [text] that says \"$8$\" drawn in grid","star_marks_4":"a Math [text] that says \"$8$\" drawn in grid","star_marks_5":"a Math [text] that says \"$10$\" drawn in grid","star_marks_6":"a Math [text] that says \"$10$\" drawn in grid","star_marks_7":"a Math [text] that says \"$10$\" drawn in grid","star_marks_8":"a Math [text] that says \"$10$\" drawn in grid","star_marks_9":"a Math [text] that says \"$10$\" drawn in grid","start_mark":"a Math [text] that says \"$S$\" drawn in grid","total_note":"a Text [text] that says \"With a consistent estimate, $f$ never decreases along a route.\""},"beats":[{"start":428.0296041666667,"say":"Now the two terms together. One change to the rule: instead of expanding the reached cell of least g, A star search expands the reached cell of least f, where f is g plus h.","live":[],"does":[[428.0296041666667,"head_run is shown on the screen, written out."],[428.0296041666667,"grid is shown on the screen, written out."],[428.0296041666667,"lattice is shown on the screen, written out."],[428.0296041666667,"polygon is shown on the screen, written out."],[428.0644041666667,"polygon_2 is shown on the screen, written out."],[428.09610228249375,"polygon_3 is shown on the screen, written out."],[428.1215966299749,"polygon_4 is shown on the screen, written out."],[428.14709097745606,"polygon_5 is shown on the screen, written out."],[428.1725853249372,"polygon_6 is shown on the screen, written out."],[428.1980796724184,"polygon_7 is shown on the screen, written out."],[428.2235740198995,"polygon_8 is shown on the screen, written out."],[428.2490683673807,"polygon_9 is shown on the screen, written out."],[428.2745627148618,"polygon_10 is shown on the screen, written out."],[428.2745627148618,"polygon_11 is shown on the screen, written out."],[428.2745627148618,"start_mark is shown on the screen, written out."],[428.2745627148618,"polygon_12 is shown on the screen, written out."],[428.2745627148618,"goal_mark is shown on the screen, written out."],[437.01560416666666,"rule_star is shown on the screen, written out."],[439.8196041666667,"grid moves to a new place on the board."],[439.8196041666667,"rule_star moves to a new place on the board."],[439.8196041666667,"head_run is hidden from the screen — left the board."]]},{"start":440.41960416666666,"say":"Expand S. Its four neighbours become reached cells, each with g equal to one, and each is given an f. Those four are the queue.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark"],"does":[[440.41960416666666,"head_queue is shown on the screen, written out."],[440.5416041666667,"polygon_11 is indicated — a transient flash."],[449.0746041666667,"queue is shown on the screen, written out."]]},{"start":450.42910416666666,"say":"The four share the same g, so g cannot separate them. Their estimates differ. The neighbour towards the goal is seven from it by the estimate; the other three are nine, because a step in the wrong direction adds one instead of removing one.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","head_queue"],"does":[[456.5126041666667,"queue is shown on the screen, written out."],[459.69360416666666,"queue is shown on the screen, written out."],[459.89458126043905,"queue is shown on the screen, written out."],[460.70937247971847,"queue is shown on the screen, written out."]]},{"start":464.91460416666666,"say":"Add the columns and f follows: eight for the neighbour in the direction of the goal, ten for the other three. The smallest f wins, so the search steps that way.","live":null,"does":[[465.2166041666667,"queue (the \"column=4\" part) is emphasized."],[471.71860416666664,"queue (the \"column=4\" part) is no longer emphasized."],[471.71860416666664,"queue (the \"row=2\" part) is emphasized."],[473.8196041666667,"polygon_13 is shown on the screen, written out."],[473.8196041666667,"star_marks is shown on the screen, written out."],[475.07310416666667,"rule_star moves to a new place on the board."],[475.07310416666667,"head_queue is hidden from the screen — left the board."],[475.07310416666667,"queue is hidden from the screen — left the board."],[475.07310416666667,"queue (the \"row=2\" part) is no longer emphasized."]]},{"start":475.6731041666667,"say":"Repeat the comparison. The next three choices come out the same way, so the search runs straight along this row, and f stays at eight all the way.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks"],"does":[[475.6731041666667,"head_more is shown on the screen, written out."],[480.8396041666667,"polygon_14 is shown on the screen, written out."],[481.22921017746734,"star_marks_2 is shown on the screen, written out."],[481.470816188268,"polygon_15 is shown on the screen, written out."],[481.71516916627536,"star_marks_3 is shown on the screen, written out."],[481.95553184922125,"polygon_16 is shown on the screen, written out."],[482.57100431928467,"star_marks_4 is shown on the screen, written out."],[482.9996041666667,"total_note is shown on the screen, written out."]]},{"start":485.4451041666667,"say":"Then the row runs into the wall. The cell straight ahead is blocked, so there is nowhere to continue, and every reached cell now has an f of ten. The estimate of eight was optimistic, and the search has just discovered why.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks","total_note","head_more","polygon_14","star_marks_2","polygon_15","star_marks_3","polygon_16","star_marks_4"],"does":[[489.1016041666667,"polygon_5 is indicated — a transient flash."]]},{"start":499.41960416666666,"say":"Many cells now tie at ten, and f alone cannot choose among them. This implementation prefers the smaller estimate, which keeps it moving towards G; a different tie-break would examine a wider band. What no tie-break can do is examine a cell of larger f before one of smaller f.","live":null,"does":[]},{"start":517.5851041666667,"say":"So it turns the corner and carries on: ten, ten, ten. Then G comes off the queue with f equal to ten, which is its g plus nothing, since the estimate at the goal is zero.","live":null,"does":[[518.1306041666667,"polygon_17 is shown on the screen, written out."],[518.4308463462833,"star_marks_5 is shown on the screen, written out."],[518.6253226328624,"polygon_18 is shown on the screen, written out."],[518.8996818659604,"star_marks_6 is shown on the screen, written out."],[519.1175191515305,"polygon_19 is shown on the screen, written out."],[519.3696996510259,"star_marks_7 is shown on the screen, written out."],[519.8165731374033,"polygon_20 is shown on the screen, written out."],[520.5437200092499,"star_marks_8 is shown on the screen, written out."],[521.2646540153044,"polygon_21 is shown on the screen, written out."],[522.4525625924991,"star_marks_9 is shown on the screen, written out."],[523.7036041666667,"polygon_12 is indicated — a transient flash."]]},{"start":530.7236041666666,"say":"Eleven cells expanded. The route returned is the same ten-step route, and it is optimal, for the reason we established: the estimate never overshoots, so no unexpanded cell could have hidden anything cheaper.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks","total_note","head_more","polygon_14","star_marks_2","polygon_15","star_marks_3","polygon_16","star_marks_4","polygon_17","star_marks_5","polygon_18","star_marks_6","polygon_19","star_marks_7","polygon_20","star_marks_8","polygon_21","star_marks_9"],"does":[[533.6496041666667,"route is shown on the screen, written out."],[533.7255163344064,"route_2 is shown on the screen, written out."],[533.8014285021462,"route_3 is shown on the screen, written out."],[533.8813026972923,"route_4 is shown on the screen, written out."],[533.9960910963898,"route_5 is shown on the screen, written out."],[534.1108794954873,"route_6 is shown on the screen, written out."],[534.2256678945847,"route_7 is shown on the screen, written out."],[534.3404562936822,"route_8 is shown on the screen, written out."],[534.4352774372627,"route_9 is shown on the screen, written out."],[534.5186004519564,"route_10 is shown on the screen, written out."]]},{"start":544.9076041666667,"say":"The queue was not empty when it stopped. These cells were reached and given an f, and then never expanded, because their f exceeded ten. Reaching a cell is cheap; expanding it is the work.","live":["grid","rule_star","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks","total_note","head_more","polygon_14","star_marks_2","polygon_15","star_marks_3","polygon_16","star_marks_4","polygon_17","star_marks_5","polygon_18","star_marks_6","polygon_19","star_marks_7","polygon_20","star_marks_8","polygon_21","star_marks_9","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10"],"does":[[547.7866041666666,"polygon_22 is shown on the screen, written out."],[547.8427658427668,"polygon_23 is shown on the screen, written out."],[547.8989275188668,"polygon_24 is shown on the screen, written out."],[547.9550891949668,"polygon_25 is shown on the screen, written out."],[548.0112508710669,"polygon_26 is shown on the screen, written out."],[548.0677107030917,"polygon_27 is shown on the screen, written out."],[548.1331320103767,"polygon_28 is shown on the screen, written out."],[548.1985533176618,"polygon_29 is shown on the screen, written out."],[548.2639746249467,"polygon_30 is shown on the screen, written out."],[548.3293959322317,"polygon_31 is shown on the screen, written out."],[548.3934975754671,"polygon_32 is shown on the screen, written out."],[548.4384269163471,"polygon_33 is shown on the screen, written out."],[548.4833562572272,"polygon_34 is shown on the screen, written out."],[548.5282855981072,"polygon_35 is shown on the screen, written out."],[548.5732149389872,"polygon_36 is shown on the screen, written out."],[548.6235042944738,"polygon_37 is shown on the screen, written out."],[558.1776041666667,"grid moves to a new place on the board."],[558.1776041666667,"head_more is hidden from the screen — left the board."],[558.1776041666667,"rule_star is hidden from the screen — left the board."],[558.1776041666667,"total_note is hidden from the screen — left the board."]]},{"start":558.7776041666666,"say":"Put the two searches side by side, on the same maze, with the same walls, both returning a route of cost ten.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks","polygon_14","star_marks_2","polygon_15","star_marks_3","polygon_16","star_marks_4","polygon_17","star_marks_5","polygon_18","star_marks_6","polygon_19","star_marks_7","polygon_20","star_marks_8","polygon_21","star_marks_9","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10","polygon_22","polygon_23","polygon_24","polygon_25","polygon_26","polygon_27","polygon_28","polygon_29","polygon_30","polygon_31","polygon_32","polygon_33","polygon_34","polygon_35","polygon_36","polygon_37"],"does":[[558.7776041666666,"head_cmp is shown on the screen, written out."],[558.7776041666666,"polygon_22 is hidden from the screen."],[558.7776041666666,"polygon_23 is hidden from the screen."],[558.7776041666666,"polygon_24 is hidden from the screen."],[558.7776041666666,"polygon_25 is hidden from the screen."],[558.7776041666666,"polygon_26 is hidden from the screen."],[558.7776041666666,"polygon_27 is hidden from the screen."],[558.7776041666666,"polygon_28 is hidden from the screen."],[558.7776041666666,"polygon_29 is hidden from the screen."],[558.7776041666666,"polygon_30 is hidden from the screen."],[558.7776041666666,"polygon_31 is hidden from the screen."],[558.7776041666666,"polygon_32 is hidden from the screen."],[558.7776041666666,"polygon_33 is hidden from the screen."],[558.7776041666666,"polygon_34 is hidden from the screen."],[558.7776041666666,"polygon_35 is hidden from the screen."],[558.7776041666666,"polygon_36 is hidden from the screen."],[558.7776041666666,"polygon_37 is hidden from the screen."],[558.7776041666666,"blind is shown on the screen, written out."],[558.7776041666666,"blind_lattice is shown on the screen, written out."],[558.7776041666666,"polygon_38 is shown on the screen, written out."],[558.9168041666667,"polygon_39 is shown on the screen, written out."],[559.0560041666668,"polygon_40 is shown on the screen, written out."],[559.1351419883867,"polygon_41 is shown on the screen, written out."],[559.1542176318268,"polygon_42 is shown on the screen, written out."],[559.1732932752668,"polygon_43 is shown on the screen, written out."],[559.1923689187068,"polygon_44 is shown on the screen, written out."],[559.2114445621469,"polygon_45 is shown on the screen, written out."],[559.2305202055869,"polygon_46 is shown on the screen, written out."],[559.249595849027,"polygon_47 is shown on the screen, written out."],[559.249595849027,"polygon_48 is shown on the screen, written out."],[559.249595849027,"blind_start_mark is shown on the screen, written out."],[559.249595849027,"polygon_49 is shown on the screen, written out."],[559.249595849027,"blind_goal_mark is shown on the screen, written out."],[560.0546041666666,"polygon_50 is shown on the screen, written out."],[560.0754579017577,"polygon_51 is shown on the screen, written out."],[560.0963116368487,"polygon_52 is shown on the screen, written out."],[560.1171653719398,"polygon_53 is shown on the screen, written out."],[560.1380191070307,"polygon_54 is shown on the screen, written out."],[560.1588728421218,"polygon_55 is shown on the screen, written out."],[560.1797265772128,"polygon_56 is shown on the screen, written out."],[560.2005803123038,"polygon_57 is shown on the screen, written out."],[560.2214340473948,"polygon_58 is shown on the screen, written out."],[560.2422877824858,"polygon_59 is shown on the screen, written out."],[560.263141517577,"polygon_60 is shown on the screen, written out."],[560.2839952526679,"polygon_61 is shown on the screen, written out."],[560.304848987759,"polygon_62 is shown on the screen, written out."],[560.32570272285,"polygon_63 is shown on the screen, written out."],[560.346556457941,"polygon_64 is shown on the screen, written out."],[560.3676964453861,"polygon_65 is shown on the screen, written out."],[560.3891025973007,"polygon_66 is shown on the screen, written out."],[560.4105087492153,"polygon_67 is shown on the screen, written out."],[560.43191490113,"polygon_68 is shown on the screen, written out."],[560.4533210530445,"polygon_69 is shown on the screen, written out."],[560.4747272049592,"polygon_70 is shown on the screen, written out."],[560.4961333568738,"polygon_71 is shown on the screen, written out."],[560.5175395087884,"polygon_72 is shown on the screen, written out."],[560.5389456607031,"polygon_73 is shown on the screen, written out."],[560.5725175376648,"polygon_74 is shown on the screen, written out."],[560.6085972614563,"polygon_75 is shown on the screen, written out."],[560.644676985248,"polygon_76 is shown on the screen, written out."],[560.6807567090395,"polygon_77 is shown on the screen, written out."],[560.7168364328311,"polygon_78 is shown on the screen, written out."],[560.7529161566227,"polygon_79 is shown on the screen, written out."],[560.7889958804143,"polygon_80 is shown on the screen, written out."],[560.825075604206,"polygon_81 is shown on the screen, written out."],[560.8611553279975,"polygon_82 is shown on the screen, written out."],[560.897235051789,"polygon_83 is shown on the screen, written out."],[560.9333147755807,"polygon_84 is shown on the screen, written out."],[560.9693944993722,"polygon_85 is shown on the screen, written out."],[561.0054742231639,"polygon_86 is shown on the screen, written out."],[561.0415539469554,"polygon_87 is shown on the screen, written out."],[561.077633670747,"polygon_88 is shown on the screen, written out."],[561.1137133945385,"polygon_89 is shown on the screen, written out."],[561.1497931183302,"polygon_90 is shown on the screen, written out."],[561.1780109463277,"polygon_91 is shown on the screen, written out."],[561.1966550141243,"polygon_92 is shown on the screen, written out."],[561.2152990819209,"polygon_93 is shown on the screen, written out."],[561.2339431497176,"polygon_94 is shown on the screen, written out."],[561.2525872175141,"polygon_95 is shown on the screen, written out."],[561.2712312853107,"polygon_96 is shown on the screen, written out."],[561.2898753531073,"polygon_97 is shown on the screen, written out."]]},{"start":566.2506041666667,"say":"The counts are on the board. The larger belongs to the search that ranked by g alone; the smaller belongs to the search that added an estimate of what remained. Same route, a fraction of the work.","live":["grid","lattice","polygon","polygon_2","polygon_3","polygon_4","polygon_5","polygon_6","polygon_7","polygon_8","polygon_9","polygon_10","polygon_11","start_mark","polygon_12","goal_mark","polygon_13","star_marks","polygon_14","star_marks_2","polygon_15","star_marks_3","polygon_16","star_marks_4","polygon_17","star_marks_5","polygon_18","star_marks_6","polygon_19","star_marks_7","polygon_20","star_marks_8","polygon_21","star_marks_9","route","route_2","route_3","route_4","route_5","route_6","route_7","route_8","route_9","route_10","blind","head_cmp","blind_lattice","polygon_38","polygon_39","polygon_40","polygon_41","polygon_42","polygon_43","polygon_44","polygon_45","polygon_46","polygon_47","polygon_48","blind_start_mark","polygon_49","blind_goal_mark","polygon_50","polygon_51","polygon_52","polygon_53","polygon_54","polygon_55","polygon_56","polygon_57","polygon_58","polygon_59","polygon_60","polygon_61","polygon_62","polygon_63","polygon_64","polygon_65","polygon_66","polygon_67","polygon_68","polygon_69","polygon_70","polygon_71","polygon_72","polygon_73","polygon_74","polygon_75","polygon_76","polygon_77","polygon_78","polygon_79","polygon_80","polygon_81","polygon_82","polygon_83","polygon_84","polygon_85","polygon_86","polygon_87","polygon_88","polygon_89","polygon_90","polygon_91","polygon_92","polygon_93","polygon_94","polygon_95","polygon_96","polygon_97"],"does":[[566.7966041666666,"blind_label is shown on the screen, written out."],[567.1170255564522,"star_label is shown on the screen, written out."],[569.0136041666667,"blind_label is indicated — a transient flash."],[572.5086041666666,"star_label is indicated — a transient flash."],[578.5396041666667,"blind is hidden from the screen — left the board."],[578.5396041666667,"blind_lattice is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_38 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_39 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_40 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_41 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_42 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_43 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_44 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_45 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_46 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_47 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_48 is hidden from the screen — blind left the board."],[578.5396041666667,"blind_start_mark is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_49 is hidden from the screen — blind left the board."],[578.5396041666667,"blind_goal_mark is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_50 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_51 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_52 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_53 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_54 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_55 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_56 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_57 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_58 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_59 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_60 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_61 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_62 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_63 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_64 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_65 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_66 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_67 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_68 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_69 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_70 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_71 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_72 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_73 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_74 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_75 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_76 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_77 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_78 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_79 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_80 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_81 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_82 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_83 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_84 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_85 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_86 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_87 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_88 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_89 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_90 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_91 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_92 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_93 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_94 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_95 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_96 is hidden from the screen — blind left the board."],[578.5396041666667,"polygon_97 is hidden from the screen — blind left the board."],[578.5396041666667,"blind_label is hidden from the screen — left the board."],[578.5396041666667,"grid is hidden from the screen — left the board."],[578.5396041666667,"lattice is hidden from the screen — grid left the board."],[578.5396041666667,"polygon is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_2 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_3 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_4 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_5 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_6 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_7 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_8 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_9 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_10 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_11 is hidden from the screen — grid left the board."],[578.5396041666667,"start_mark is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_12 is hidden from the screen — grid left the board."],[578.5396041666667,"goal_mark is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_13 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_14 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_2 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_15 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_3 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_16 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_4 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_17 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_5 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_18 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_6 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_19 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_7 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_20 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_8 is hidden from the screen — grid left the board."],[578.5396041666667,"polygon_21 is hidden from the screen — grid left the board."],[578.5396041666667,"star_marks_9 is hidden from the screen — grid left the board."],[578.5396041666667,"route is hidden from the screen — grid left the board."],[578.5396041666667,"route_2 is hidden from the screen — grid left the board."],[578.5396041666667,"route_3 is hidden from the screen — grid left the board."],[578.5396041666667,"route_4 is hidden from the screen — grid left the board."],[578.5396041666667,"route_5 is hidden from the screen — grid left the board."],[578.5396041666667,"route_6 is hidden from the screen — grid left the board."],[578.5396041666667,"route_7 is hidden from the screen — grid left the board."],[578.5396041666667,"route_8 is hidden from the screen — grid left the board."],[578.5396041666667,"route_9 is hidden from the screen — grid left the board."],[578.5396041666667,"route_10 is hidden from the screen — grid left the board."],[578.5396041666667,"head_cmp is hidden from the screen — left the board."],[578.5396041666667,"star_label is hidden from the screen — left the board."]]},{"start":579.1396041666667,"say":"Three points to take away. First, the two terms measure different things: g is a measured cost over ground the search has covered, h is an estimate over ground it has not, and f is the only quantity the algorithm ever compares.","live":[],"does":[[579.1396041666667,"head_close is shown on the screen, written out."],[581.4556041666667,"point_one is shown on the screen, written out."]]},{"start":595.5816041666667,"say":"Second, the estimate must never exceed the true remaining cost. That is admissibility, and it is what keeps the returned route optimal. An estimate that overshoots can make the search settle for a route that is not shortest.","live":["point_one","head_close"],"does":[[595.9296041666666,"point_two is shown on the screen, written out."]]},{"start":611.1466041666667,"say":"Third, the quality of the estimate is the quality of the search. Set h to zero and f becomes g, and the algorithm is Dijkstra's again, expanding in every direction. Sharpen h towards the true remaining cost and the expanded region contracts towards the route itself.","live":["point_one","point_two","head_close"],"does":[[611.4946041666667,"point_three is shown on the screen, written out."]]},{"start":630.8341041666667,"say":"The equation is one addition. What it changes is the set of cells the algorithm never has to look at.","live":["point_one","point_two","point_three","head_close"],"does":[[637.8970833333334,"head_close is hidden from the screen — left the board."],[637.8970833333334,"point_one is hidden from the screen — left the board."],[637.8970833333334,"point_three is hidden from the screen — left the board."],[637.8970833333334,"point_two is hidden from the screen — left the board."]]}]}]},"durationSeconds":639,"chapters":[{"title":"The Problem and the Two Costs","startSeconds":0,"narration":"Pathfinding is a search problem, and it is worth stating precisely before we solve it. We are given a graph, a start vertex, a goal vertex, and a cost on every edge, and we want a route of least total cost. Underneath it lies a second question: how much of the graph must an algorithm examine before it can commit to an answer? Here is an instance. Each cell of this grid is a vertex; each cell is joined to its neighbours above, below, left and right; and the shaded cells are walls, which no route may enter. One step from a cell to a neighbour costs one unit, so the cost of a route is the number of steps in it. This cell is the start. This one is the goal. A search algorithm answers one question repeatedly: of the cells it has reached but not yet examined, which should it examine next? Every algorithm in this lecture answers by attaching a single number to each candidate and taking the smallest. So consider one candidate. Take this cell, and call it n. Two different costs meet at n. One of them lies behind it. From S, the search has traced a route to n, one step at a time, and that route has a cost of five steps. That measured number is g of n. The other lies ahead of it. From n, some cost remains before G is reached, and the search cannot know it, because it has not been there. So it estimates. This dashed figure is the estimate: four cells across, one cell up, five in total. That number is h of n. Keep the distinction. g is known, because those steps have been taken. h is a guess about ground the search has not covered. A star search adds them. f of n is g of n plus h of n: the cost committed, plus the cost estimated. It is the algorithm's estimate of the total cost of the best route through n. Here that is five plus five, which is ten. And the rule of the algorithm is exactly this: always examine the reached cell whose f is smallest. Two numbers and one sum. What follows takes them apart: a search that uses g and nothing else, then the estimate h on its own, and then the two together."},{"title":"Searching Without a Compass","startSeconds":151.43533333333335,"narration":"Start with a search that has no information about where the goal is. Dijkstra's algorithm keeps, for every cell it has reached, the cheapest known cost of reaching it, and it always expands the reached cell whose cost is smallest. When every step costs the same, that is the order breadth-first search uses as well. Look at which quantity that rule uses. It uses g, the cost already accumulated, and nothing else. No term in it mentions the goal, so nothing in it can prefer one direction over another. So it grows in every direction at once. Watch the shading: its leading edge is the frontier, the boundary between cells already expanded and cells not yet reached. Stop it here. The outlined cells are the frontier at this instant: expanded cells behind them, unreached cells in front. The frontier is a diamond rather than a circle, because distance is counted in horizontal and vertical steps. And it spreads behind the start as readily as ahead of it. Let the wave run on, and half of that work is going away from G. Keep going. The expansion folds around the walls and continues, filling cells that no shortest route to G could use. The goal is reached last, because it is far from the start and the search had no reason to hurry towards it. The route returned is a shortest one: ten steps. That optimality is not negotiable. Whatever we add to make the search look in the right direction must still return a route of least cost. Now count the work. Before the goal came off the queue, every cell strictly closer to the start than the goal is had already been expanded. That is this many, out of the sixty-seven cells of this grid that are not walls. That is not a defect of the implementation; it follows from the rule. g measures the past, and a search that ranks candidates by the past alone cannot tell a promising direction from a hopeless one. What is missing is a term that looks forward."},{"title":"The Estimate of What Remains","startSeconds":282.4040625,"narration":"The missing term is an estimate of the cost that remains. For every cell we want a number saying, without any searching, roughly how far the goal still is. Here is the estimate this lecture uses. Ignore the walls completely. Count the horizontal separation between the cell and the goal, count the vertical separation, and add the two. That is the Manhattan distance. Take this cell. It is seven columns and two rows from the goal, so the estimate is nine. Move the cell and the number follows. Here it is six. Nearer the goal, it is two. And computing it costs two subtractions and an addition: no search, no queue, no walls consulted. The estimate ignores walls, and that has a consequence worth seeing. Move the cell here. The estimate is six: four columns across and two rows down. But look where the dashed figure runs. It goes straight through this wall, and no route can follow it. The true remaining cost is eight, not six. A route has to come down to this row, pass the barrier, and climb back up to G. So the estimate falls short of the truth, and that is precisely the property we want. An estimate that never exceeds the true remaining cost is called admissible. The Manhattan estimate is admissible on this grid, because any route must make at least the horizontal steps and at least the vertical steps that separate the cell from the goal, and walls can only force it to make more. Admissibility is what will let us keep the optimality that Dijkstra's algorithm gave us. Now put both costs together at this cell. The cheapest route the search can trace from S to it costs six steps, so g is six. The estimate ahead is six as well, so f is twelve. Notice that twelve is not the true cost of the best route through this cell. In green and yellow together, that route is fourteen steps. Twelve is a lower bound on it, and a lower bound is all we need: twelve already exceeds ten, and a ten-step route exists. So this cell can be discarded without ever being expanded. That is the mechanism: g rules out nothing, h rules out nothing, and their sum rules out most of the maze."},{"title":"The Informed Frontier","startSeconds":428.0296041666667,"narration":"Now the two terms together. One change to the rule: instead of expanding the reached cell of least g, A star search expands the reached cell of least f, where f is g plus h. Expand S. Its four neighbours become reached cells, each with g equal to one, and each is given an f. Those four are the queue. The four share the same g, so g cannot separate them. Their estimates differ. The neighbour towards the goal is seven from it by the estimate; the other three are nine, because a step in the wrong direction adds one instead of removing one. Add the columns and f follows: eight for the neighbour in the direction of the goal, ten for the other three. The smallest f wins, so the search steps that way. Repeat the comparison. The next three choices come out the same way, so the search runs straight along this row, and f stays at eight all the way. Then the row runs into the wall. The cell straight ahead is blocked, so there is nowhere to continue, and every reached cell now has an f of ten. The estimate of eight was optimistic, and the search has just discovered why. Many cells now tie at ten, and f alone cannot choose among them. This implementation prefers the smaller estimate, which keeps it moving towards G; a different tie-break would examine a wider band. What no tie-break can do is examine a cell of larger f before one of smaller f. So it turns the corner and carries on: ten, ten, ten. Then G comes off the queue with f equal to ten, which is its g plus nothing, since the estimate at the goal is zero. Eleven cells expanded. The route returned is the same ten-step route, and it is optimal, for the reason we established: the estimate never overshoots, so no unexpanded cell could have hidden anything cheaper. The queue was not empty when it stopped. These cells were reached and given an f, and then never expanded, because their f exceeded ten. Reaching a cell is cheap; expanding it is the work. Put the two searches side by side, on the same maze, with the same walls, both returning a route of cost ten. The counts are on the board. The larger belongs to the search that ranked by g alone; the smaller belongs to the search that added an estimate of what remained. Same route, a fraction of the work. Three points to take away. First, the two terms measure different things: g is a measured cost over ground the search has covered, h is an estimate over ground it has not, and f is the only quantity the algorithm ever compares. Second, the estimate must never exceed the true remaining cost. That is admissibility, and it is what keeps the returned route optimal. An estimate that overshoots can make the search settle for a route that is not shortest. Third, the quality of the estimate is the quality of the search. Set h to zero and f becomes g, and the algorithm is Dijkstra's again, expanding in every direction. Sharpen h towards the true remaining cost and the expanded region contracts towards the route itself. The equation is one addition. What it changes is the set of cells the algorithm never has to look at."}]}}
