+ Reply to Thread
Results 1 to 3 of 3

Determine smallest number of units to make a whole

  1. #1
    Registered User
    Join Date
    09-09-2008
    Location
    Fife
    Posts
    3

    Determine smallest number of units to make a whole

    I have a list of 11 items that are available in either 2, 3 or 4 lengths depending on the item being considered.

    The task is to find and list the smallest number of lengths that are required to construct the whole length.

    So, what I need is:-

    Required Length of item(2) = L

    item(1) - (available lengths) a,b,c,d
    item(2) - b,c,d
    item(3) - b,d
    ...
    item(11) - b,d

    There may be numerous solutions (n) to derive L, so I want

    L = x.a + y.b + z.c

    Where x+y+z is the minimum of x(n)+y(n)+z(n)

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626
    You can make you problem understood by using a sample not the xyzabcl
    I need your support to add reputations if my solution works.


  3. #3
    Registered User
    Join Date
    09-09-2008
    Location
    Fife
    Posts
    3
    Ok - here we go with no algebra!

    Items and available unit lengths

    items 1 to 3 - 0.25,0.5,0.75,1
    items 4 to 9 - 0.5,0.75,1
    items 10 & 11 - 0.5, 1

    We can check that the required length is valid by dividing by the smallest unit length and getting a whole number for items 1,2,3,10 and 11. For items 4 to 9 we ensure the length is at least 0.5 and a multiple of 0.25.

    Now we move on to find the most efficient number of units to use.

    So, say we need to make a length of 2.25 for item 1. We can start with the longest length, 1, and keep subtracting utill we get a remainder of 0.25 for a total of three units to get 2 x 1 + 1 x 0.25 = 2.25. But the following solutions are also valid 3 x 0.75 (3 units), 1 x 1 + 1 x 0.75 + 1 x 0.5 (3 units), 4 x 0.5 + 1 x 0.25 (5 units) etc. and they would have to be checked to make sure there are no solutions with less units.

    We then want a length of 5.25 for item 4 say. We can start subtracting the largest unit, 1, until we get a remainder of 0.25. But there is no 0.25 unit for item 4. So, we would go to the next unit length 0.75 and that gives us 7 x 0.75 = 5.25. All well, but if we took 3 x 1 + 3 x 0.75 = 5.25 we get 6 units. So, we need to look at the remainder after every subtraction to see if it is a function of the other units.

    As I said previously, there are numerous solutions to the required lengths but it seems (maybe obviously) that the solution with the most of the longest unit is the best.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1