As part of my MTE119 Statics course, I was assigned a group project to design a 2D truss. Given a certain cost per node, and a cost per length of each member, we had to come up with a design capable of supporting a distributed load of about 8kN, whilst also being as cheap as possible.
Performing the hand calculation necessary for solving a single design could last somewhere between 15-30 minutes, and is far more difficult when dealing with non-standard member angles. Rather than spend my time doing that, I decided that whilst working on the project, I'd also spend some spare time writing a simulator to help me do this much faster.
Internally the calculator worked by mapping all the nodes and members into a huge matrix and solving it (similar to finite element analysis, though I didn't know it back then).
I had a little bit of time before the submission date to the project to actually create an optimizing feature in the simulator. It works by simply randomly positioning each non-floor node of the structure a certain radius away from its original position, and re-calculated the forces and cost of the bridge. By the end of the optimization after a certain specified interval of time, it'll return a bridge that met its constraints and had the lowest cost. That may sound inefficient, but my laptop can perform about 20,000 iterations of these possible different designs a second! Far better than me dragging nodes until I get what 'feels' right.
We finished the application 2 days before the final report was due, and came up with a very cheap design that met all the constraints within a few hours. Our design was one if not the most cheapest, and the simulator is expandable enough for me to use in some of my homework assignments. I forked another app from this one called CraneBoom.js that helped me simulate a Mechanics problem for my MTE219 course.
Overall I'm extremely proud of the outcome, and it was a great learning experience. I didn't actually know I could pull it off within the project deadline until I finally did.
I would like to thank Chris Gravel who was in my group for helping me with the project. He implemented the import and export feature of the calculator, making it far easier for our group to share possible designs with each other. It was also from his insight that I could debug the calculation algorithm and solve for the final solution.