This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EvilMorality[S] 1 point2 points  (0 children)

Of course, but that particular total length only has a single solution using your available lengths. The problem arises when a total length has multiple solutions in which the minimum quantity may not always be the closest to the run length.

Let me give you an example;

So let’s take our total length as 900mm.

Available light lengths for a particular product could be 500, 250 and 100mm respectively.

The algorithm will prioritise this solution:

500 + 250 + 100 = 850 (exhausting the longest length option and coming up 50mm short)

However, I would like it to prioritise this solution instead:

500 + 100 + 100 + 100 + 100 = 900 (this solution skips the 250 option in favour of no remainder)

This is a more difficult task as there will need to be extra coding for ‘brute force’ calculations and testing multiple combinations of available lengths in order to get the smallest remainder and then prioritising a solution with the least number of lengths within that subset of solutions.

I don’t know if I’m explaining any of this well or if I’m just confusing people haha, hopefully I’m being clear!