1 Reply Latest reply: Nov 12, 2007 5:08 PM by 807600 RSS

    Bin packing array

    807600
      Hi all. I am trying to create some form of array in order to 'pack' 500 items into 10 bins. The bins would obviously need to hold the weights of the items put into each bin, and go through the array until all the items have been 'packed'. How can I do this? The main problem is that a random_ bin needs to be chosen at each step in the array, and then a random_ item from the Item array needs to be put in it. I can't get my head round how I would implement it like this, making sure that all items only get 'packed' once, and that they all get 'packed'. Hope this all makes sense and that some clever soul can assist me in some way!

      P.S. the bins have no weight limit.
        • 1. Re: Bin packing array
          807600
          Google for Bin Packing Algorithm for lots more information on this problem.

          If your only problem right now is finding how to make random numbers in java, look into java.util.Random. Have items in a list (Queue, Stack, etc) that can be popped so they aren't doubly added.