AI Driven Engineering Optimization of Simple Trebuchets
Genetic Algorithms (GAs) are one of our favorite tools at Resolved Analytics. I can’t help but think that they are an under-appreciated and under-utilized resource for engineers.
If you take a look at the Wikipedia page on genetic algorithms you’ll quickly understand why we hear so little about their use. The material is dry, difficult to follow for those not familiar with mathematical operations research, and lacking real world context. Jargon such as “metaheuristics”, “arrays of bits”, and “chromosome representation” make GAs inaccessible to potential learners. Hopefully this series of posts can demystify GAs and encourage their use by starting with a simple, easy to follow use case and building from there.
Trebuchets!
Everyone knows what a trebuchet is, right? In case you don’t, you should know that it’s a compound machine capable of hurling heavy stones, dead horses, flaming sacks of manure or even pianos at your enemy’s castle using only the force of gravity.
“The key is not the thing you fling, but the fling itself.” Chris Stevens – Northern Exposure
We will start with a simple design optimization problem and build from there. Our initial design is for a see-saw type trebuchet with the counterweight rigidly attached to the lever arm and not utilizing any sling mechanism. The counterweight is raised and then dropped, accelerating the projectile located at the opposite end of the arm and launching it upon impact of the counter weight with the Earth. The initial objective is to achieve the maximum flight distance while obeying all design constraints. This distance we will call the objective function. The independent parameters of our solution space include the counter weight and projectile arm lengths and initial angles, as well as the pivot elevation, as shown in the following figure.
Genetic Algorithms!
Genetic algorithms have a tremendous range of potential uses and are widely being used in fields such as computational biology, financing, logistics, and power electronics. They are one instance of an evolutionary algorithm inspired by biological evolution for iteratively searching for optimal solutions to all types of mathematical problems. A genetic algorithm works by iteratively transforming a collection of possible solutions (sets) to the optimization problem by analogies with evolutionary functions such as reproduction, mutation and selection. A picture speaks a thousand volumes.