 So in our last video, we introduced sort of, again, exploring the idea of building out our own heuristics because when we were dealing with, say, the sliding puzzle problem and moving, say, that to into its correct location, the big issue there was it's not an easy translation to sort of a traditional graph or grid structure, and so we had to use sort of, we explored multiple heuristics, H1 and H2, and said, oh, well, you know, if I took the max of those two, I can potentially generate a good one. But that actually leads into sort of our next sort of topic point, which is this idea of an optimization problem. The big idea is, well, you know, again, if heuristics aren't just a magic, super easy translation, where else could they kind of sit? And that's actually, again, looking at this idea of now something known as a configuration, rather than a path. Again, a path had a starting point, you traverse some set of things until you reach the goal. Well, we still want to kind of utilize the same algorithms, they seem to do very well in that world. Could we use them here in some sense? And that's where I'm going to introduce a new problem to you. Something known as the linear assignment problem. I have five people, P1 is red, P2 is orange, P3 is green, P4 is blue, and P5 is purple. Now, with that in mind, which task should each person do? Oh, well, you see that they're, they're, you know, reds, right above custodians, so that, you know, just give them what they're next to. All right, we're done. Now, you know, the big idea with the linear assignment problem is each one of those tasks and those people, or whatever terminology or, you know, things you're kind of working off of, each one of them get some associated value. So in our case, red, if red is a server, generates a value of 23. Maybe this is a cost. It's red costs the restaurant $23 an hour to be a server. Or it's productivity. Red generates $23 worth of revenue if they are the server. Either one of those comes into play. And our goal is to min max the minimize or maximize that cost or productivity. But the big issue is that as we start to expand, our numbers get bigger on possible configurations. I'm only dealing with five because it's easy for me to make these slides. And so as a consequence, you know, five only has 120 possible configurations if each person can only have one job and only one person can do a job. All right, fine. You see that's not hard. You can build an algorithm to do that and just have it solves it within a second. But the problem is what happens as we increase how many people in tasks we have or how many do we have to deal with how many configurations do we have to deal with when this number gets to like 25, you can see it gets into a giant number. And so we can't brute force this anymore because yeah, that's going to take millennia. And this is the exact same problem that you have with password cracking, right? There are if someone has 13 characters and there are, you know, your work, I'm just looking at my keyboard, there's roughly speaking 62 possible characters. If we just do numbers and lower and uppercase characters, no special characters, that's 13 possible, you know, that's 13 letters or characters and 64 possible configurations, you know, 13 to the 64th power, big number. And we're running into that same sort of problem as we expand this, right? You can see this possible configuration, it's not feasible for us to do a just traditional search. So we have to find out ways and, you know, it's harder because a star, you know, everything that we saw with a star, like there was a distance involved. This one's going to get a little harder because, you know, I can't tell if this is good or bad because I may not know the goal. It may be actually incredibly difficult for me to find the goal. Again, if we're thinking about 25 star configurations, or, you know, 25 factorial configurations, we can't do that. I can't find what the best possible solution is because, again, even brute forcing it would take millennia to do. And so that's actually sort of where we're going to work off of this idea that each one of those configurations, however we set up, you know, P1 was going to equal the custodian, P2 was the chef, P3 was the bartender, etc. This whole setup with all of those would generate some fitness measure, or you may remember we saw this, this was the F score in our A star solution. And so at least when we're thinking about this, what we want to do is something known as iterative optimization. And just this nice little thing right here is going to tell us what this allows us to do is not have to deal with a search tree. I don't need to explore all these possible routes and decide which one's the next possible route, or the best next possible route to consider. Instead, instead of a search tree, it's much more a simple loop. I just iterate through my search at each sort of cycle. I just say, all right, let's refine our search this loop around. And hopefully that works out. So when we're dealing with the linear assignment problem, you know, what you could possibly do with this is you could randomly assign our people to a task. So again, red is the server, orange is the sous chef, green is the head chef, or the person who designs out the menu, whatever. Again, we start with some configuration. Or you could just, you know, linearly assign it. Either one will work. The big idea is we're going to iterate from it later. But what you do with this is once you have your configuration set up, you essentially calculate out your fitness measure. And I'm just again, being super lazy and saying, Oh, well, I'm going to just take wherever these configurations are lined up, add them together. And congratulations, that gave me a 106. My my fitness value is a 106. Done. Okay, well, you know, I need to figure out if this is the best configuration. And how could I do that? Well, again, I can't brute force or I can, but brute forcing will take forever. So what are their options? Do I have at my disposal? And this is where, you know, we'll start with the super simple version. What if we just randomly generate configurations, right? You know, we do that first one, we see, you know, reds at the server, orange is the sous chef greens, the head chef, blue is the custodian and purple is the bartender. That gives us again that f score of 106. I randomly generate a new configuration it has a 105. Well, again, I make the the decision, is this better or worse? And oh, well, if it's better, say we're reducing costs, congratulations, I have a new configuration. Or, you know, I look at the next one, and I say, Oh, well, you know, it's this configuration, and this is the f score for it. Oh, well, you know, again, if we're trying to find a smaller number, that's not a good small number. So we ignore it. But you know, again, if you're thinking about random, right, random may not lead to any good solutions, because again, it's random, we can't control it. And in fact, that's actually going to be what the next few heuristics are going to look at is, can we control control, I'll put some air quotes on that random. So to at least start before we get there, we've already started to see this idea that again, if I have some initial configuration, and I build new ones, are they better or worse? And what we call that is hill climbing. And the entire idea is, well, wherever I'm currently sitting on sort of, in this case, a polynomial curve, that's more whatever, on a curve, again, I want to make steps that lead me towards some peak, or bottom, again, trying to think about maximizing rf, or minimizing our fitness value. And again, so one way if we're looking to maximize it is again, if I see steps that would be better, I'd go towards them. And if I see ones that are worse, I don't. Or I flip it again, I'm just dealing with it depends on your problem. So again, what I would do in this situation is I maybe generate my moves. And in my case, for this, again, since there's so many possible configurations, the only thing I'm going to focus in on is what if I'm just swapping red, red is the only person that I'm looking at in this first iteration of who to move. Okay, well, we see that again, I have my 106, I see if I do the swap of red and orange, I get 105 if I swap red and green, I get a 100 if I swap red and blue, I get 121 and red with purple, I get 93. All right, I generated in characters, built their fitness. Okay, now what? Well, again, it depends on your problem. If I'm looking for something to be maximized again, I'm looking at this idea that I want to pick the child that would be the best next step. So the 121 is the best next step. So that's the child I would go to minimizing it's obviously the other way around. But the big idea here is again, I'm going to just take this maximizing what I would do is this new configuration, again, in our loop, remember, think about this whole iterative optimization process is this big old circle, I say that this configuration, this nice little orange, you know, highlighted one, that's my new configuration. And I'm going to be swapping off of this in the next turn. So I do that, I take it. And now, again, just only focusing on on red, red swaps with the worms, red swaps of green, red swaps of blue, red swaps with purple. Done. But I'm not getting any good children out of this. All my possible children are worse than I am. What did I do? Am I done? Have I reached the peak? Well, not necessarily. You could almost think that what we just did may have been this step. We thought we were here, we thought we were making our moves upward to this giant mountain and we'd get to this peak and we'd be done. But we may find ourselves in this type of situation. Now we're running into a problem because we've sort of created what we like to call a local maxima. There are no better options that we can work off of. So we're not going to move or we don't dare move anywhere else. Again, because everything's worse than what we are. So we're stuck here. And so again, you have sort of this problem. I don't want to move to either one of them. But at least for our sake, the big idea that you'll see here is we're not at the global maximum or global maxima. We may be stuck at this local maxima. And the big idea with these types of problems is when we're trying to brute force them, we can't. Because again, if it's a 25 factorial or if it's in is 25, that's 25 factorial. It's impossible for us to figure out all the possible configurations to see this. And so here are the limitations of hill climbing. But in the next video, we'll start to see some of those approaches that we can use that say, well, maybe sometimes it's okay to go down.