CAVEAT
This is a theoretical example, not near the work that would be required in a professional design. Note that member stresses are not even considered!
My presentation is via a couple Jupyter notebooks. The notebooks differ in only one respect, the truss input data.
Here are the two truss diagrams:



Truss #1 Output

Truss #2 Output
And here are my Excel verification calculations:


~~~
The comparison is simple (for a structural engineer): The second truss has an additional member which happens to be a zero force member. Why might I have tested such a truss? Only to see if the zero force would trip up the PyTorch calculations.
I used AI to obtain the base code. Then I worked through the AI version to learn all that I could, and then to verify results. Once I accepted the program as correct, I changed a few things as follows:
- I substituted in my truss data for the AI base example.
- I changed the units from metric to imperial.
- The program quit working — that is, the optimization quit working.
- After many many debugging runs, much thought, tuning of the hyperparameters, I realized that I should decrease the PENALTY_WEIGHT and set up a WEIGHT_FACTOR. I suppose other combinations would have worked but I feel that the PENALTY_WEIGHT number was inappropriate for the optimization calculations in my specific problem.
- With the optimization back on track, I was able to complete my work.
Now let’s discuss what was learned
The most obvious result is that I was able to optimize a truss using PyTorch. With very little effort on my part, using AI, I was able to generate a program that worked for my specific trusses.
However, I’ve convinced myself that PyTorch is not the way I would proceed if I were doing a real world structural engineering optimization problem.
My first reason is there are more straightforward ways to do the optimization. In this example, I was able to use Excel Solver to get answers very quickly while PyTorch expended about a 1000 epochs (iterations) converging.
My second reason addresses the fact that several objectives must be met in a structural design: engineers would say limit states must be met: such as stability, stress, deflection, buckling. And then there are constraints such as connection detailing, clearance around nonstructural elements, et cetera.
I can imagine AI addressing those concerns and doing it fairly well. In fact AI might take care of issues that are easily overlooked by a human engineer. But if I restrict my assessment in this post to the goal of generating a mathematically optimal layout, I still think there are traditional operations research methods that give more direct answers.
Finally, I point to the hyperparameter issue. THroughout my career, I’ve used iterative methods. I have found one truth. Successful iteration parameters are a function of the problem itself. Tomorrow’s problem will likely require different hyperparameters than today’s. This is what I really wanted to investigate when I set out on this work. I would have been amazed if the hyperparameters just worked out of the box.



