WARNING! This page is math heavy and erratic as I work out a problem.
The basis is to create a 2D stock cutting program...Look it up on Wikipedia if your curious. Look up why Farenheit is actually not as horrible system as everyone seems to think (overly complicated, but not bad) while your over there.
Combinations and Permutations...
- Combination: order doesn't matter
- Permutation: order matters
Alright, so order doesn't matter...abb = bba = bab = 1 a and 2 b's
Combinations it is. There are 2 types of combinations, repetition, and no repetition. As long as we don't blow the maximum number of pieces of each type we can repeat over and over. So repetition it is.
Hokay, So. Here's the earth...Oh wait, thats something else (this). So. The math to find out how many possibilities is:
x = (n+r-1)! / r!(n-1)!
- n = total number of choices
- r = how many you choose
Because things will get horribly variable heavy later, lets change n and r now.
- n is now T (for total)
- r is now P (picks)
Now calculating the number of possible cuts is rather easy...Listing them isn't. Well listing them efficiently so your script doesn't time out isn't.
T | P | answer | notes (if any) |
---|---|---|---|
1 | 1 | 1/1 = 1 | duh. |
2 | 1 | 2/1 = 2 | |
3 | 1 | 6/2 = 3 | |
4 | 1 | 24/6 = 4 | See a pattern? Good. |
So as long as P=1, the answer that there a T possibilities. Round 2, here we come!
T | P | answer | notes (if any) |
---|---|---|---|
1 | 2 | 2/2 = 1 | |
2 | 2 | 6/2 = 3 | |
3 | 2 | 24/4 = 6 | |
4 | 2 | 120/6 = 10 | |
5 | 2 | 720/48 = 15 | New pattern. Yay! |
Alrighty then! This pattern is called triangular numbers. Total = T + (T-1) + (T-2) + (T-3), etc, etc. Or Total = T(T+1)/2
T | P | answer | notes (if any) |
---|---|---|---|
1 | 3 | 6/6 = 1 | |
2 | 3 | 24/6 = 4 | |
3 | 3 | 120/12 = 10 | |
4 | 3 | 720/36 = 20 | |
5 | 3 | 5040/144 = 35 | |
6 | 3 | 40320/720 = 56 | New pattern. I think. Internet time. |
*Pause*
*tap tap tappity tap* Ah-Ha!
They are tetrahedral numbers...A triangular pyramid if you will...1D, 2D, 3D, I don't like where my pattern of patterns is going. Equation is:
Total = T(T+1)(T+2) / 6 = T³+3T²+2T / 3!
Interlude
Do we argree this is starting to get to be too much like work? Tough, I think it is.
Why am I doing this at all? Well, I found a nifty site on geodesic domes (here: www.desertdomes.com). Very, very good site, it even has a calculator to tell you how many of each length part you need. But not how to cut it efficiently. Thats where this page comes in...eventually...I hope.
/Interlude
1V Dome
A 1 frequency dome needs 25 poles of a single size. Easy to calculate:
- X = number of stock pieces
- L = length of stock pieces
- a = number of pole A = 25
- l = length of pole A
- n = number of poles per piece of stock. n = floor(L/l)
- w = waste per piece of stock
- W = total waste
X = ceiling(n / a) = ceiling(25n)
w = L - (n * l)
W = w * X
Done, I'll code that at a later date.
2V Dome
A 2 frequency dome needs 35 poles of a size A and 30 of size B. Still easy to calculate?
- X = number of stock pieces
- L = length of stock pieces
- a = number of A poles = 35
- b = number of B poles = 30
- l = length of poles
- n = number of poles per piece of stock. n = floor(L/l)
- w = waste per piece of stock
Hmmm, not so cool eh? We need to define some variables. Lets go back to before our interlude.
- T = total number of choices = 2 (A or B)
- P = how many you choose = maximum number of poles from one piece of stock
Well that helps a bit. Time to magic up some numbers.
- L = 10 feet (standard length of EMT)
- P = 3 (are you really using poles less than 3 feet long??)
So how many combos are there? A lot.
T | P | answer | notes (if any) |
---|---|---|---|
2 | 1 | 2/1 = 2 | A, B |
2 | 2 | 6/2 = 3 | AA, AB, BB |
2 | 3 | 24/6 = 4 | AAA, AAB, ABB, BBB |
Ok, maybe not, but did you think that 9 was the total?
For curiousity's sake, lets do more than 3 cuts.
T | P | answer | notes (if any) |
---|---|---|---|
2 | 4 | 120/24 = 5 | AAAA, AAAB, AABB, ABBB, BBBB |
2 | 5 | 720/120 = 6 | AAAAA, AAAAB, AAABB, AABBB, ABBBB, BBBBB |
2 | 6 | 5040/720 = 7 | AAAAAA, AAAAAB, AAAABB, AAABBB, AABBBB, ABBBBB, BBBBBB |
Egads! A pattern! There are P+1 combos with 2 options (T)!!
Now, lets apply some logic.
- The singles are not efficient unless your poles are really close to 10 feet long. So lets rule out those.
- Any dome radius over 5.25 feet will rule out AAA
- Any dome radius over 5.5 feet will rule out AAB
- Any dome radius over 5.75 feet will rule out ABB
- Any dome radius over 6.0 feet will rule out BBB
- Any dome radius over 8.0 feet will rule out AA
- Any dome radius over 8.5 feet will rule out AB
- Any dome radius over 9.0 feet will rule out BB
- And to finish off the pattern: Any dome radius over 16.0 feet will rule out A and therefore you can't build it anyways.
What are our options at this point?
- 12x AAA will give us our 35 A poles. We then need 10x BBB to complete the set.
- 18x AAB will give us 35 A poles and 18 B poles. We then need 4x BBB to complete the set.
- 35x ABB will not work.
- 15x ABB will give us 15 A poles and 30 B poles. We then need 7x AAA to finish.
- etc.
Now we need to run through all the options to see what has the least waste. That depends on your dome size. Uggg!
We need something like:
- if radius < 9 then include BB
- if radius < 8.5 then include AB
- if radius < 8 then include AA
- etc.
Then we need something like:
- Maximum # of AAA = blah
- Maximum # of AAB = blah
- etc.
Blah being an array: (name, # of A's, # of B's, max # based on A's, max # based on B's, lowest max, waste)
Max # of A's = ceiling(a / (# of A's))
Max # of B's = ceiling(b / (# of B's))
Compare max A's and max B's and take whichever is lower as the max of that type that you can make (lowest max).
Finally compute the amount of waste generated.
Repeat for all the viable options.
Now you can run a reasonably simple script to come up with combos of each type that produces your total needed quantity.
Compare your waste for each combo and choose the best one.
Done. That wasn't so bad, was it?
I'm getting tired, even if your not. It's also supper time. So let's wrap up for today.
Until next time, goodnight! hmmm, I wonder what's in the fridge........