So here's a little background.
I'm making a program that optimizes the cost of a bridge in a bridge designing program, given the length, the compression it has to support, and the tension it has to support.
Each bar in the bridge (truss bridge design) has two variables you can edit (for the purposes of this program): size (x mm by x mm) and material.
With each size, each material gets stronger, but the strongest of the size before is weaker than the weakest of the current size. Ex: 120x120 M3 is weaker than 130x130 M1 (M3 being the strongest, M1 being weakest).
There are 32 somewhat arbitrary sizes which I already put into my program, and three materials that have been also.
I have also input the 96 values for each of the costs for each cross section of material (all combinations) possible.
What I have done so far:
My program will take in any number of members, given their length, compression force, and tensile force, and optimize them individually--that is, make each bar the lowest it can be. I have thoroughly tested this part of the program, and it is very successful. It will correctly output the type of material and size needed to minimize individual costs.
How it works:
I have a main class and a Member class. The Member class holds basic information:
-The size "number" (the sizes are held in an array in the main class, and the Members just hold the index)
-The needed compression strength
-The needed tensile strength
-The length
-The current material
The main class iterates through each member (all are stored in one array) with a basic for loop. Inside this loop, there is a while statement that checks if the bar will hold. If not, it makes it the next biggest material, or the next size and the weakest material.
I am very confident that this part of the program works.
What I need to do:
Optimize lowest cost. Now, it sounds like my program already does it, but here's the catch: each unique kind of bar (120x120 M1 and 120x120 M2 are different) costs an extra $1000. What I was originally going to do was to have the program iterate through every single possibility and calculate the cost, giving the lowest cost and the corresponding members. I soon realized that with an average of about 25 members, this would be (32 x 3)^25 possibilities, which would take years to compute. I have never really worked with a program that needs such a high efficiency as this one.
In addition, 25 "for" loops nested within each other wouldn't be practical, as the number of members can vary greatly.
So, I'm not asking for help in the form of code. I need someone to help me create an algorithm that would be able to test only a few reasonable possibilities, in addition to making a program that can work for a varying number of members. Don't worry about the specifics, I only need the concepts, as I have much experience coding. I guess I'm just having trouble solving this problem.
Thanks for your time! (even if you're not going to answer, you still read a lot of my rambling)
P.S.--Putting filters of "has to be higher than the lowest and lower than the highest" don't work, as this still leaves you with 25 nested "for" loops and a long, long time to wait.
Are you familiar with linear programming?
I am somewhat familiar with linear programming, I have done moderate work with it. I'm not sure how it could be used here though. If you do know, could you please share it with me?
(I'm not sure because the equations for the forces are somewhat complex. Aside from that, though, I'm not sure how I would be able to recreate the $1000-for-each-value part of it).
Perhaps I'm oversimplifying this. Can you give a couple sample formulas? I suspect the complicated formulas might be simpler than you thought.
OK. Get ready.
lambda = (length / (sqrt(1/A) x pi)^2*yield force/200000000
A = area of the cross section
yield force is a value that is different force each of the 3 materials, but is not dependent on size or length
If lambda <= 2.25,
Max force=0.9*((0.66)^lambda)*yield force*A //same A as up there
If lambda > 2.25,
Max force = 0.9*0.88*yield force*A/lamda
If you can use linear programming to solve it, I would be very, very happy.
It seems like what you're looking at is a combination of problems where the parameters create the linear programming problem on the fly.
For each material, lambda is only a function of length, as is Max force. It looks like each bar, in reality, has a constant max force for each type (size/material) and length. It seems like the only actual tricky part is accounting for the 1000 for each type of material used.
It seems like what you're looking at is a combination of problems where the parameters create the linear programming problem on the fly.
For each material, lambda is only a function of length, as is Max force. It looks like each bar, in reality, has a constant max force for each type (size/material) and length. It seems like the only actual tricky part is accounting for the 1000 for each type of material used.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks