Peter Nachtwey
Member
It doesn't make it impossible to minimize waste but it does make it impossible to ensure the waste will be 0.Another problem is that there are 6 pipes cut in parallel, but apparently all 6 are usually different lengths (+/- 5 feet)! That makes it impossible to minimize the waste for all of the 6.
Assume the acceptable cut length is 40-45 and the stock pipe is just two pieces at 160 and 180 ft long. The pipes could be cut into 40 ft sections and 8x40=320ft can be sold and 20ft would be scrap and the evaluation would be 340*CostOfStock/(320*SellPrice). I am assuming that all the pipe sells or cost the same and doesn't vary by length.
If the cut length is 45 ft then 7x45=315ft can be sold and 25ft will be wasted. It should be obvious that this combination is worse UNLESS 45 ft sections are worth more than 40 ft sections. Combinations of cuts between 40 and 45ft don't make much sense to try. The ratburger must not have a way of minimizing combinations and is trying lengths in between which is why his routine is sooo slow.
One could have a lot of fun with this if theratburger would ATFQs.
The way I would approach this is to pass then lengths of all the pipe to a subroutine. I would try taking a trial cut say at 40 ft. I have now 2 40ft sections of pipe. I would then pass the remaining pipe back to the same routine so it would now optimize a 120ft section of pipe and a 140ft section of pipe. At this level the same is done. Eventually there isn't enough pipe to make a cut and the lengths of the cut pipes are returned or better yet the value of ALL the cut pipe is returned to the level above which would then check to see if the valve of the pipe returned for that cut length is better than all the other cut lengths it tried. Eventually the function would return at the top level with the best value and the cuts that are necessary to achieve it but as I pointed out in a previous post, this maximizing just makes the best out of what could be a bad situation if the stock pipe lengths can't be cut economically. For instance, should subtract the cost of the stock used and the result could be negative. It would be better to be able to do the same routine and with all the available stock lengths so that picking the stock lengths was optimized too. This would minimize waste.
In my example above you are right but what if there are 3 180ft pipes and 1 160ft pipe. Then optimizing for the 180ft would be best because then there is still only 25ft of waste. If you optimized for 160 ft then you would waste 3 x 20ft of pipe.It seems the best that could be done would be to optimize the SHORTEST stock pipe (figuring out lengths of cuts that result in the most sellable length for the shortest stock pipe), and make the same cuts on all 6, leaving some waste on 5 of the 6 parallel pipes.
If you optimized the LONGEST stock pipe, then the other five might not be long enough for the last cut, resulting in 5 "nearly-long-enough" waste pieces.
At my first job out of the navy back in 1980 my first wood optimizing program for use with edger and trimmer optimizers. It would try various combinations of 2x3, 2x4, 2x6, 2x8, 2x10, and 2x12. I had to take into account the profile of the board and length out of a board. I may need to weigh cutting a 2x3 8f ,2x12 12ft , 2x4 10ft against 5 2x4s of different lengths. Each size board had a different value. Even the kerf between the pieces had a dimension and a value and woe to the mill manager that moved a decimal point on the value of chips. You could hear the wood scream and there is nothing like watching a 20ft 4x12 get turned into chips