loris has asked for the wisdom of the Perl Monks concerning the following question:
Dear DIY-Monks,
The following is a bit OT, but bear with me please. I need to fit some skirting boards in my house. So I have measured out all the bits of wall and now need to know many pieces of skirting board I need to buy, so that the amount left over once I have completed the work is minimized. This is obviously an example of the general problem of having a set of numbers and trying to find the minimum number of groups, the sum of whose members does not exceed a certain value. I am currently a bit stuck regarding an elegant approach to this problem.
I can conceive of a sort of brute force approach of just trying out a whole bunch of combinations, but there must be a more intelligent way. I assume that the best way could depend of the distribution of the numbers, e.g. whether I have and even spread or, say, large numbers and small numbers with not much in between. On the one hand I am sure some of you can tell me what the proper name of this problem is, so that I can google for information about it more easily. On the other hand, I am sure that some of you have good ideas about how to go about solving the problem in a perly way.
Thanks,
Update: This is homework, but only in the literal, DIY-sense.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "The Skirting Board Problem"
by hipowls (Curate) on Jan 22, 2008 at 10:22 UTC | |
by loris (Hermit) on Jan 22, 2008 at 11:13 UTC | |
by hipowls (Curate) on Jan 22, 2008 at 14:21 UTC | |
|
Re: "The Skirting Board Problem"
by BrowserUk (Patriarch) on Jan 22, 2008 at 10:01 UTC | |
|
Re: "The Skirting Board Problem"
by GrandFather (Saint) on Jan 22, 2008 at 09:40 UTC | |
|
Re: "The Skirting Board Problem"
by blokhead (Monsignor) on Jan 22, 2008 at 15:06 UTC | |
|
Re: "The Skirting Board Problem"
by McDarren (Abbot) on Jan 22, 2008 at 10:11 UTC | |
by loris (Hermit) on Jan 22, 2008 at 11:08 UTC | |
by Gavin (Archbishop) on Jan 22, 2008 at 11:39 UTC | |
|
Re: "The Skirting Board Problem"
by kretch (Initiate) on Jan 23, 2008 at 00:14 UTC |