Search code examples
algorithmlanguage-agnosticneural-networkbin-packing

Minimum message length algorithm


I have bundles of objects different size ( lot of objects can have same size, example: I have 54 object of 6B, 76 of 10B, 79 of 24B etc.

The size of the objects are 6, 8 ,10 .... bytes ). I need to pack that bundle in couple messages ( each message has maximum length 256 bytes).

Problem is how to get the solution with the minimum number of messages?

Is there any known algorithm for this? Do I need Hopfield neural network for this?


Solution

  • This is an example of the bin packing problem which is a combinatorial NP-hard problem. The simplest algorithm is "First Fit Decreasing (FFD)" in which you would first sort your objects by decreasing size, and then insert each object into the first message in the list with sufficient remaining space.