Biology and Physics meet Computer Science | Learning Intelligence 7

A look at three optimization algorithms—simulated annealing, hill climbing, genetic algorithms—explained through physics and biology. NASA used genetic algorithms to design an antenna; the creator is working through Udacity's AI Nanodegree, tackling constraint satisfaction and planning problems like warehouse scheduling.
Chapters
What's up, y'all? Welcome to Learning Intelligence Episode 7. It's been an awesome day of learning today. A bit more on the theory side today rather than sort of jumping in and doing practical stuff and coding and whatnot. I've still got to work on that Pac-Man lab that I was doing last, in last, last episode, Episode 6. That will be tomorrow's task. Today, I like, I don't know, Tuesday seems to be my most productive day, so I like to reserve the hardest, the hardest things of the week for Tuesday, and Monday is theory, getting me Get me warmed up for the rest of the week. What have I been up to today? Well, just had some cereal, brain food snack. Cereal's like a anytime of day food. Read some more of this book. I'm about not even one chapter through. I'm still in the introduction. I'm learning a good deal of history about where artificial intelligence actually came from, where the first computers actually came from, and all the different fields artificial intelligence sort of takes from. And I think that's why it's so appealing to me. I know I mentioned this, I think, in the last video, but artificial intelligence literally takes from all the major fields, mathematics, psychology, philosophy, the economics, computer engineering, both hardware and software. You need the hardware to run the software. Otherwise, after I did a little bit of reading, I went into the next class in Udacity. And the 3 algorithms I learned about today, or 3 classes of algorithms I learned, all borrowed from either a physical concept or biological concept in the real world. So number 1, I'll try to remember them all off the top of my head. If not, bear with me, I just learned all these things. Number 1 was simulated annealing. Why am I showing you this diagram? Well, this animation here exemplifies what simulated annealing does. So if you imagine this red line starts off, it's moving around really randomly, trying to find the maximum point of this graph, which is right here, and it starts off extremely random and then finishes off. Once it gets closer to the, to the maximum, the randomness slows down and it only jumps in small little gaps, and then eventually it finds the top point. So where does simulated annealing come from? Well, you can imagine to anneal is to heat metal or glass and allow it to cool slowly, thus subsequently changing its form, moving towards a solution that you, you, you would prefer. So with with metal or iron or in the case of a sword maker, which was the analogy that was used in the lectures, a sword maker starts off with a hot sword, a hot piece of metal, and starts beating it down and then allows it to cool and then repeatedly heats and cools until he gets the form of the sword that he wants. Not hard, well hard, but not brittle. So the ideal solution. That's what happens with simulated annealing. The high temperature is the high amount of randomness, what you saw on the graph where the bar was moving really fast. And then the cooling was the randomness randomness of the, of the solution, of the little data point moving slowly down till it gets to a cooled state and gets to the solution that you want, in the case that we saw was the pinnacle of the graph. So at the start, high amount of randomness, bar moving across the screen really fast, and at the end, slow amount of randomness, bar moving slowly and converging on the solution. The second algorithm I learned about was the hill climbing algorithm. So if you imagine again you wanted to get to the top of this point here, but you could only move left and right. So you might get stuck at this local optima here, or you might get stuck at even this tabletop over here. So what the hill climbing algorithm does is finds the optimal height after stepping left and right. But the third one was probably my favorite, was the genetic algorithm. So the genetic algorithm models biology. It uses evolution to find the optimal solution for your problem. That rhymed. Evolution to find your solution. I could be a— Nah, I'm kidding. So with a genetic algorithm, it starts with a whole bunch of solutions. Let's imagine them as parents. And then it combines them by using genetic algorithm crossover. So much like if, if two parents in real life, you have a mother and a father, were to have a child, the child would, you would expect to get a crossover of genes, half from the mother, half from the father. And it uses this crossover effect to continually go down through generations until it finds an optimal solution. But there's a problem here. What if the solution didn't lie within the parents? What if the parents weren't possible, like the combination of of any two parents was never possible, no matter how many generations you had, to find the right solution in the children. And that's where genetic algorithm mutations come in. When the two parents combine through genetic algorithm crossover, there's a small chance with genetic algorithm mutation that one of the, one of the data points in the children will randomly change to something else within a certain range. And those random mutations allow for enough, enough diversity in the gene pool, if you may, So that eventually, after a certain number of generations, an ideal solution will come about. I've just been teaching Pac-Man how to play. Go, buddy! You can get it! Get to the goal! Get there! And— he's done it! Winner! Check it out. Record. Win. So I made some progress in the Pac-Man lab in the Udacity search class. That algorithm took me a while to implement. I dedicated a solid hour and a half of uninterrupted time just to turn this little piece of pseudo-code. Is that how you say it? Pseudo-code? Pseudo? I'm not sure. Pseudo-code here, the uniform cost search function on a graph. So that's something I need to work on, is turning pseudo-code into— I still, that word, I never really said that word out loud. I've heard it, but I haven't really said it. Sway-do, sway-do, persuade, sway-do. It's a fun word, I like it. How many times can I get it in this video? But that's something I need to work on, is implementing pseudo-code into an actual algorithm. So I can understand sort of, well, mostly what the code is saying in the textbook when it's in plain English. But something I need to work on is going into making it into an actual algorithm, something that's runnable by a computer, because that— the code on there unfortunately isn't yet runnable on a, on a computer in a, in an IDE or something like that. Plenty of learning today, from reading chapters in here to going through 3 major classes in Udacity Artificial Intelligence Nanodegree. I even had to write down points that I wanted to talk about in this video clip because today was a productive day. I'm not sure what I did differently. Maybe because in the morning, rather than doing fluffing around, I just sort of got straight into study. Which is a note to self, I should really do that in the future. So I put the Pac-Man lab on pause for the time being because I realized that project 3 is due in about 11 days. And from the previous 2 projects, it's taken me a while to actually understand them. It takes me a lot longer to understand the projects than what the time limit sort of on the Udacity suggested class. Like I think for most of them it's 2 to 3 hours. And for me, I've spent a whole day on one single section of the problem. So I've been catching up on the 3, 3 classes that I had to finish before starting Project 3. And good news, I'm up to Project 3 now. So that's my next major goal to do. The labs, the optional labs at the end of the 2 classes that I completed, or 3 classes that I completed today, I'll push them aside for the time being unless they're closely related to what I'm doing in the project. Because of course, projects are my major focus, and I can always come back to the optional, optional labs at a later date. So the 3 classes I went through today were Constraint Satisfaction, Logic and Reasoning. Now, Logic and Reasoning, it's quite confusing to me because I've never actually— I've never gone over most of these topics here. I have used technologies that use these, um, use these three methods or methodologies of artificial intelligence, but I haven't learned about them in depth before. And so Logic and Reasoning was like a whole nother language. So I've done Boolean expressions and whatnot, but Logic and Reasoning takes that one step further. Well, in my opinion. And there's different symbols. There's an upside down A, which means all of. And then sometimes the A doesn't appear and you just have to assume that the A is the upside down A is there. There's an upside down E and all this stuff. There's so much, so much going on in logic and reasoning, but it does make sense. So, I don't fully understand it, but the whole concept of it is starting to make sense to me because once you develop it's It's like once you get better at any skill, right, you sort of, you, you develop a language in that. And once you develop the language of, and the reason, language and understanding of logic and reasoning, you can communicate better. The way logic and reasoning is designed is so that it can be easily implemented into computer programs and it can be easily shared among other people. That's, that's my understanding of it so far. And then planning was the final class that I did today, which is a branch off of logic and reasoning. These three techniques, constraint satisfaction, logic and reasoning and planning. What are some use cases for these, these three techniques? Well, if you imagine anything to do that has large-scale planning and requires multiple constraints, say for example, if you're IBM and you're designing the most efficient computer chip possible and you want to make sure that this wire goes underneath this wire and this transistor is separate to this transistor, a human being could, could play around with that chip design for endless hours on end and may not find the most efficient way and they may eventually do it, But imagine if you could get a computer to design a computer. And essentially that's what I've gathered is some of the use cases of this is one is designing computer chips, the most efficient layout of the computer chip to make it faster so that you have optimal power consumption, optimal power efficiency, optimal everything essentially. And this not only happens in computer chips, it happens in planning warehouses, planning schedules. And now what did I read about in here? A cool thing. I'm really fascinated about genetic algorithms actually. I think the reason why they're so appealing is because it's like confirmation bias almost, or some sort of cognitive bias. I've seen this before. I've seen these algorithms before somewhere. That's how I evolved. That's how we evolved. Maybe. Not entirely. The algorithms aren't as good as natural selection yet, I don't think, or as good as evolution yet. They've been used for some cool stuff. One example, NASA used genetic algorithms to evolve the best antenna shape. And I'll put a picture here or something of what it looks like, but it's not what you would think. If you look at normal antennas, they're shaped pretty logically in my opinion. They've got the major part and then the— that's That's the antennas I see, like, you know, the ones you have on the side of your house for TV. But NASA, this one is a weird shape, and apparently the computer algorithm, the genetic algorithm, decided that that, or discovered that that was the best shape for a space station antenna, and it's been done more than once, several times. So I think that's enough for this week's video. Thank you so much for watching. If you have anything you want to see at all in a future video, leave a comment below or hit me up on Twitter or something like that. All my links will be in the description. Otherwise, I've got to go. Run, and it's burger night at my place, so burgers for the boys. Catch you next week.
More from Daniel

Small Language Models (SLMs) Are the Future: Fine-Tuning AI That Runs on Your iPhone

Introducing Sunny - A MedGemma-Powered Skin Health Tracking App (Kaggle Competition Entry)

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 4 - Comparing the results

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 3 - Running LLMs on the RTX 4090

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 2 - Formalizing the tests

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 1 - Creating a series of tests

Local Multimodal RAG on the NVIDIA DGX Spark | Part 4 - Publishing our demo to Hugging Face

Local Multimodal RAG on the NVIDIA DGX Spark | Part 3 - Putting it all together


