 Hello everyone, this is Alice Gao. In the previous videos, I constructed the decision network for the male pickup robot, then I calculated the expected utility for the robot for different states of the world, given that I determined the action that maximizes the expected utility of the robot. The calculation procedure doesn't look like any algorithm we've learned before. However, in this video, I want to show you that we can also solve this problem using the variable elimination algorithm that we've learned before. Let's take a look. Before we apply the variable elimination algorithm to our robot decision network, let's first simplify the network. In this network, we represented short and paths using two different decision nodes. But we can make these decisions at the same time. There is no order between the two. So we'll combine these two decision nodes into just one node. The domain of the combined node is the cross product of the domain of the two separate nodes. So used to be the domain of short is short and long, and the domain of paths is yes or no, wearing paths or not wearing paths. Now the domain for the new node would contain four values, short paths, short no paths, long paths and long no paths. We will also have to modify the conditional probability distribution for accident because now it should condition on this new variable which has four possible values. We also need to modify our utility function. Our utility function now is a function of two variables instead of a function of three variables. But let's not do those changes right now. Let's do those changes directly when we apply our variable elimination algorithm. What we have here is a single-stage decision network. That means we make one decision and then we'll observe the consequence of this decision. So how does it affect other random events that's going to happen in the world such as accident and also how do the random events and our decision affect our happiness? So that's how the two variables can affect our utility. Here is the variable elimination algorithm for a single-stage decision network. It's fairly simple. First of all, we want to prune all the nodes that are not ancestors of the utility node. The reason for this is that the utility node is only influenced by its ancestors. So if some node is not an ancestor of the utility node, it's irrelevant. It does not affect our happiness. So the first step just says let's prune all the irrelevant nodes. They don't affect our utility. Second, we will sum out all the chance nodes. These are sort of like the hidden variables in the variable elimination algorithm. We have to sum out all the random events that happen, sort of merge their effects together in order to determine how they affect our happiness, how they affect our utility. After that, we will have a single remaining factor. And using that factor, we will determine our maximum expected utility and the assignment that gives the maximum expected utility. So the assignment here would be the decision that we make. Given our combined decision nodes that would be the combination of the two decisions that we make that can maximize our expected utility. Let's go through this algorithm now and execute it. It's not going to take very long. It will only take two slides to explain most of this algorithm. First of all, we have to take our decision network and look at every table in this decision network. So by table, I'm referring to either the conditional probability distribution, for example, this one, or I'm referring to the utility function table. So either table, we have to look at all of these tables and for each table, we have to create a corresponding factor. So that's what I did here. The left factor is corresponding to the conditional probability distribution attached to the chance node accident. So for this, this is representing a conditional probability, right? It's saying that if we choose the short route, then there is a probability that an accident will occur. If we choose the long route, then accident will never occur. So that's how we came up with these numbers. For example, if we choose the short route, these first four cases are all relating to the short route, then the probability for an accident to occur is Q. And the probability for an accident to not happen is 1 minus Q. And then for the other possibility, if we choose the long route, then the probability for an accident to happen is zero. Here on the long route, an accident will never happen. And similarly, the probability for an accident to not happen is 1. This is how we realized here that we already incorporated the fact that we merged the two decision nodes. So we have this new decision node right here, which has a lot more possible values. So now it has four possible values instead of two in the domain of either variable. Similarly, we'll take the utility function and also convert it into a factor. Here you will realize that being a factor is such an abstract concept. So it can represent so many things. It can represent a joint distribution. It can represent a conditional distribution. And now it could also represent the utility function. Seems like as long as you can put something in the form of a table, a factor probably can represent it. So here for the right table, I basically took the utility function and move it here, except that I put all the numbers in the right place depending on the combination of values. So for example, the first value is when an accident happens, we choose a short route and we wear a pad. Our utility is two. Now that we have put everything into factors, then the first step of the algorithm tells us that we need to prune all the nodes that are not ancestors of the utility node. In our decision network, every node is an ancestor of the utility node. So we don't have to do anything for step one. Let's move on to step two. Step two says we will sum out all the chance nodes. Well, we only have one chance node in this decision network. So let's sum that out. We want to sum out accident and turns out both factor have accident in it. So in order to do that, we first have to multiply the two factors together and then sum out accident from the resulting factor. So on this slide here, first I'm showing you the result of multiplying the two factors together. This is exactly the same as how we multiply two factors in the variable elimination algorithm. Then after that, we sum out A from the resulting factor F2, which gives us F3 on the right. F3 should look very familiar to you, right? Because it's already in the form of the expected utilities that we calculated before, right? You can compare these expressions to the expressions we got before and they're exactly the same, right? So the variable elimination algorithm leads us to the same point right before we're supposed to make a decision. Now we have all the information we need to decide on which combination of actions is the best, right? So using the same numbers, we will reach the same decisions. For example, we can immediately prune this combination of decision because it's strictly dominated by the last one, right? Then depending on the value of Q, we will make different decisions. Since I already explained the decision-making process for the previous method, I'm not going to explain it here. There are two main reasons for showing you this example. The first one is to show to you that we can solve the problem using two different methods. One is to directly think about how to calculate the expected utility and make a decision based on that. And the other one is using this general and more generic algorithm called the variable elimination algorithm. The second reason is to show you that a decision network is not that much different from a Bayesian network. And the variable elimination algorithm still applies to a decision network. That's everything for this video. Thank you very much for watching and I will see you in the next video. Bye for now.