Post by Horizon on Feb 16, 2022 14:53:14 GMT
Hello,
I'm looking to create a Just BASIC program that can tell me the most efficient method of packing my items into boxes. I have 5 sizes of boxes and each box can hold the following number of items in them. Dimensions are unimportant as each item flits a slot in the box perfectly:
Box type A holds 8 items
Box type B holds 12 items
Box type C holds 16 items
Box type D holds 24 items
Box type E holds 32 items
The challenge I'm facing is to find the lowest number of boxes for the order from any quantity of items up to 1024. Of course odd numbers will create spaces in boxes (which is unavoidable) and numbers of items that don't divide exactly into the types boxes available (10 items being a good example, that leaves 2 empty slots in box type 'B').
1:1 is not a problem (a matched condition)
if items = box_type then [one box of that type required]
This of course would be the first item and box comparison in the program. When we have a larger number of items is where it gets more interesting...
if items / 2 = box_type without any remainders then [two boxes required of that type]
Perhaps a practical approach is how may time can you divide you items in to the largest box type (if your number is less than one then step down to the next box size and re calculate). Of course it's not practical to continue in this fashion.
So, the next steps are creating a formula (rules) that can be applied to any number of items entered.
I don't profess to have a great deal of mathematical skills but, a point in the right direction leads the way to discovery.
Any insight would be very welcome.
I'm looking to create a Just BASIC program that can tell me the most efficient method of packing my items into boxes. I have 5 sizes of boxes and each box can hold the following number of items in them. Dimensions are unimportant as each item flits a slot in the box perfectly:
Box type A holds 8 items
Box type B holds 12 items
Box type C holds 16 items
Box type D holds 24 items
Box type E holds 32 items
The challenge I'm facing is to find the lowest number of boxes for the order from any quantity of items up to 1024. Of course odd numbers will create spaces in boxes (which is unavoidable) and numbers of items that don't divide exactly into the types boxes available (10 items being a good example, that leaves 2 empty slots in box type 'B').
1:1 is not a problem (a matched condition)
if items = box_type then [one box of that type required]
This of course would be the first item and box comparison in the program. When we have a larger number of items is where it gets more interesting...
if items / 2 = box_type without any remainders then [two boxes required of that type]
Perhaps a practical approach is how may time can you divide you items in to the largest box type (if your number is less than one then step down to the next box size and re calculate). Of course it's not practical to continue in this fashion.
So, the next steps are creating a formula (rules) that can be applied to any number of items entered.
I don't profess to have a great deal of mathematical skills but, a point in the right direction leads the way to discovery.
Any insight would be very welcome.