 Hello everyone, this is Alice Gell. In this video, I am going to discuss some strategies for escaping local optimons. Previously, I introduced greedy descent. One major problem with the greedy descent algorithm is that it may get stuck at the local optimum and fail to find the global optimal solution. To understand this property, let's define global and local optimons more formally. The global optimum is a state that has the lowest cost among all of the states in the search space. A local optimum is a state where no neighbor has a strictly lower cost than the current state. In other words, a global optimum is the best state in the entire search space, whereas a local optimum is the best state in the local neighborhood. Let's visualize the global optimum and some local optimons in a picture of an one-dimensional search space. The global optimum is the lowest point on the curve. There are three kinds of local optimons in this picture. The middle one is a strict local optimum. Being a strict local optimum means that the cost of the state is less than or equal to the cost of all of its neighbors. And then the cost of the state is strictly less than at least one of the neighbors. Therefore, this state is strictly the best state in its neighborhood. The other two local optimons are in a flat neighborhood. The left one has a special name called a shoulder. You can tell that the name comes from its shape, which looks like a person's shoulder. If we're on a shoulder and we explore the neighborhood for long enough, we can escape the shoulder and reach the state with a lower cost. For the other flat local optimum, it's challenging to escape it since the states on both sides have higher costs. Now that we have defined local and global optimons formally, let's look at two practice questions. In each question, we're given a state of the four queens problem and the neighbor relation, and we're asked to determine whether the state is a local and or global optimal. Question one, the neighbor relation says to pick two queens and swap their role positions. Which of the following statements about local and global optimal are correct? Pause the video and choose an answer. Then keep watching. The correct answer is C. This state is not a local optimal and not a global optimal. Please watch a separate video for detailed explanation. Question two, consider the same state by the different neighbor relation. This neighbor relation says to choose one queen and move it to another role in the same column. Is this state a local optimal and or a global optimal? Pause the video and choose an answer. Then keep watching. The correct answer is B. This state is a local optimal but not a global optimal. Please watch a separate video for detailed explanation. As you have seen, a major problem with greedy descent is that it may get stuck at the local optimal. What can we do to overcome this problem? Let's explore a few strategies for escaping local optimons. Let's think about how we can escape a flat local optimum, in particular a shoulder. When greedy descent reaches a flat area, that is, when all the neighbors have the same cost as the current state, it terminates right away. The reason is that, by our definition, a state within a flat neighborhood is a local optimal. In this case, one strategy is to keep moving. This strategy is called sideways moves. The algorithm is allowed to move to a neighbor with the same cost as the current state. Now, one problem with allowing sideways moves is that the algorithm might not terminate. Imagine that we are exploring a flat area. Since the algorithm does not remember where it has been, it could be moving in the flat area in circle forever. So, if we allow sideways moves, we need to put a limit on it. Typically, we will specify that the algorithm terminates after making a maximum number of consecutive sideways moves. Even if we allow sideways moves, greedy descent may be exploring the flat area inefficiently. Recall that, greedy descent does not have any memory. It may be going in circles and not realizing it. To make the algorithm more efficient, we can give it some short memory, some short term memory, in the form of a taboo list. A taboo list records a list of recently visited states so that greedy descent does not return to these states immediately. However, the taboo list must have a limited size. If the list is filled up, we will have to replace some old states in the list with new ones. And it is still possible for greedy descent to explore states that it has visited before. You might be wondering, do these strategies really help greedy descent perform better? Let's look at some statistics on how greedy descent performs when we allow sideways moves. Consider the eight queens problem. It has roughly 17 million states. Without sideways moves, greedy descent can only solve 14% of the problem instances. With at most 100 consecutive sideways moves, greedy descent can solve more than 90% of the problems. However, there is a trade-off. Without sideways moves, greedy descent terminates fairly quickly in roughly 3-4 steps on average. With sideways moves, greedy descent spends a lot more time exploring flat areas. On average, the algorithm takes 21 steps until success and 64 steps until failure. So the trade-off is, sideways moves allows us to solve more problem instances at the cost of taking much longer before the algorithm terminates. That's everything on the strategies for escaping local optimums. Let me summarize. After watching this video, you should be able to do the following. Formally define local and global optimum. Describe different types of local optimums. Determine whether a given state is a local optimum and a global optimum. Describe some strategies of escaping local optimums. Thank you very much for watching. I will see you in the next video. Bye for now.