 Hello everyone, this is AliceGal. In this video, I will describe the generic search algorithm. First, let's take a look at the search graph. Given the formulation of a search problem, we have enough information to generate the search graph. Create one node for each state. Each state appears exactly once in the search graph. There are no duplicates. Next, if state B is a successor of state A, then there should be a directed edge from state A to state B. Also, if there's a cost function, we can label each directed edge with this cost. When solving a search problem, we often do not work with the search graph directly. For many real-world search problems, the search graph may be extremely large or infinite. It may be impossible or infeasible to generate and store the complete search graph in memory. Instead, we'll search for a solution in the search graph by generating a search tree. Given a search graph, an initial state, and a goal test, we will search for a solution by generating a search tree. We do this by maintaining a frontier of path from the initial state. The frontier contains all of the paths that are available for exploration. In the beginning, the frontier starts with having the trivial path containing the initial state and no edges. As the search proceeds, the frontier expands into the unexplored region until we encounter a goal node. At each step, we select one path from the frontier and check whether it is a goal state. If it is not a goal state, we will expand it. Expanding the state means applying the successor function, generating all of its successors, and adding the successors to the frontier. Then, the process repeats. It is important to distinguish between the search graph and the search tree. Here are a few points. First, we can construct the search graph given a problem formulation, whereas creating the search tree requires executing an algorithm. Second, each state appears once in the search graph, but can appear multiple times in the search tree. Third, the search graph is static, whereas the search tree grows in one direction. Finally, even if the search graph is finite, a corresponding search tree may be infinite. There may be other similarities and differences between the search graph and the search tree. Let me know if you come up with other ideas. Let's take a look at the generic search algorithm. We can use the generic search algorithm as a blueprint to create all kinds of search algorithms. Initially, the frontier contains one path consisting of the initial state only. We will continue exploring the space as long as the frontier is not empty. At each step, we select and remove one path from the frontier. If the last node on the path is a goal node, we can return the path as a solution. Otherwise, we expand the path by finding the neighbors of the last node n sub k, constructing new path by adding each neighbor and adding all the new path to the frontier. Let me discuss two lines in the algorithm in more detail. First, on line four, we need to select a path and remove it from the frontier. How we choose this path from the frontier determines our search strategy. For instance, depth first search selects the newest path added to the frontier, whereas breadth first search selects the oldest path added to the frontier. Second, on line five, we perform the goal test when removing the path from the frontier, not when adding the path to the frontier. There are two reasons for doing this. First, the goal test can be costly to perform, so we should delay this computation if it's unnecessary. Second, the first path to a goal node added to the frontier may not be the path with the least cost. Therefore, if we want to find the shortest path, we should wait after adding all possible paths to the frontier before selecting the best among them. That's everything on the generic search algorithm. Let me summarize. After watching this video, you should be able to do the following. Compare and contrast the search graph and the search tree. Describe the generic search algorithm. Thank you very much for watching. I will see you in the next video. Bye for now.