Pick a Theme:
       
       

2D Stock Cutting Problem Workpage

September 17, 2011

Menu
Home

Outdoors (12)
Submit Comments (1)
Outdoors (3)
Food (19)
Erudition (12)
Projects (6)
Scouting (4)
Programming (5)
Art (4)
Bad math (9)
Mis-information (4)
Minecraft (4)
Random (12)

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...

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)!

Because things will get horribly variable heavy later, lets change n and r now.

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 = 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?

Hmmm, not so cool eh? We need to define some variables. Lets go back to before our interlude.

Well that helps a bit. Time to magic up some numbers.

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.


What are our options at this point?

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:

Then we need something like:

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........