Page 1 of 1

Solving bin pack problem

Posted: Thu Nov 12, 2009 11:32 pm
by jeyo6an
Hi All

Solving bin pack problem

I have a single dimensional array of values which contains product weight. which are always a value equal to 40 or less than 40. I need to pack these container which has maximum capacity of 40 . We need an optimized way of packing which is should reduce the number of container and also each container should fill at a maximum weight of products.

Consider if there is product 40 it should be packed in single container

if on 35, 5. it should be packed in one container

if 35,3, 2 it should be in one packet

if we have 15, 15, 15 we should pack them in two container 30, 15 ..

I hope you all make sense, whats my issue .

Please help me to solve these issue.

thanks
joban
http://phpqa.in

Re: Solving bin pack problem

Posted: Fri Nov 13, 2009 4:30 am
by angelicodin
I'm new so keep that in mind.
Seems to me that you should use some operators that will figure out how much you can keep in one pack and echo that out.
HINT: Use "%" Modulus (division remainder) as one of the math operators.
:)

Re: Solving bin pack problem

Posted: Fri Nov 13, 2009 5:39 am
by Apollo
What number of products do you typically have to divide amongst containers? (i.e. is it brute-forcable?)