Solving bin pack problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeyo6an
Forum Newbie
Posts: 1
Joined: Thu Nov 12, 2009 11:11 pm

Solving bin pack problem

Post 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
User avatar
angelicodin
Forum Commoner
Posts: 81
Joined: Fri Nov 13, 2009 3:17 am
Location: Oregon, USA

Re: Solving bin pack problem

Post 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.
:)
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Solving bin pack problem

Post by Apollo »

What number of products do you typically have to divide amongst containers? (i.e. is it brute-forcable?)
Post Reply