Sign in to follow this  
Followers 0
SpookMeister

Logic question

3 posts in this topic

#1 ·  Posted (edited)

Hey guys,

I need some help with developing an approach to a problem. I've got a buddy that works in a welding shop. He often needs to determine the right amount of stock to order for given project. The issue usually goes something like this:

This particular project requires:

15 ea 6 foot length

30 ea 3 foot lengths

10 ea 11 foot lengths

All those lengths are of the same materiel

For this example, the materiel comes from the supplier in 20 foot segments, and lets say that we are not allowed to weld smaller pieces together to make any of those parts.

So, I would like to devise a script that will accept assorted piece requirements and have it return a breakdown of how many full length pieces need to be ordered, and how to break down the cuts.

I'm thinking I would need to sort the required lengths then from largest to smallest, then starting at the top, see if I can fit another of the pieces in and if not, try to fit one of the next smaller... etc.

So using my example:

a ) 15x6

b ) 30x3

c ) 10x11

would sort to

c ) 10x11

a ) 15x6

b ) 30x3

Then the output would be

cab

cab

cab

cab

cab

cab

cab

cab

cab

cab

aaa

aabb

bbbbbbbb

bbbbbbbb

bb

Total of 15 pieces ordered

Is there a more efficient method or formula to use?

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think your approach is a great start. there would be 5 - 2' pieces left over. However, there may be times that the smaller piece may cut equally into the 20' stock and the longest and second longest may need to cut from the same 20' stock to get the least waste.

good luck

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Hey guys,

I need some help with developing an approach to a problem. I've got a buddy that works in a welding shop. He often needs to determine the right amount of stock to order for given project. The issue usually goes something like this:

This particular project requires:

15 ea 6 foot length

30 ea 3 foot lengths

10 ea 11 foot lengths

All those lengths are of the same materiel

For this example, the materiel comes from the supplier in 20 foot segments, and lets say that we are not allowed to weld smaller pieces together to make any of those parts.

So, I would like to devise a script that will accept assorted piece requirements and have it return a breakdown of how many full length pieces need to be ordered, and how to break down the cuts.

I'm thinking I would need to sort the required lengths then from largest to smallest, then starting at the top, see if I can fit another of the pieces in and if not, try to fit one of the next smaller... etc.

So using my example:

a ) 15x6

b ) 30x3

c ) 10x11

would sort to

c ) 10x11

a ) 15x6

b ) 30x3

Then the output would be

cab

cab

cab

cab

cab

cab

cab

cab

cab

cab

aaa

aabb

bbbbbbbb

bbbbbbbb

bb

Total of 15 pieces ordered

Is there a more efficient method or formula to use?

Optimsing can be very difficult. A 1D optimiser is the simplest but it is still quite tricky and can take a long time to develop.

Your results have not allowed for the saw with by the way which will be important. Also an new bar will usually need to have the ends trimed off so there will be some waste.

If you assume a saw width of 0 and no trim from each end then I don't think you will do simpler than

cbbb x 10

aaa X 5

There are various versions available and searching the internet will find some. Most have a free trial period.

One of the best, which you won't find by searching the internet, was written by me :) (which was used to get my results above)

It has a lot of features, display of how all the bars should be cut, allows any number of stock bar types, up to 20 lengths for each bar type, saw width adjustment, offcut trim required if any for new bars. Has options to print results, option to return unused offcuts to stock and more.

It has an excellent label printing feature and can produce instructions to drive an automatic saw.

If you are interested I can PM you a trial copy which will last for 28 days.

It might give you some ideas. You could also try to get better results than I can. Main problem with it would be that it is written fo metric use so you would need to enter everything in tenths of an inch to get sensible results, or 100th of an inch.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0