# Is there any algorithms I can look into for this bin-packing like problem?

I'm attempting to find a method to solve a problem that I believe is similar to bin packing, but to my understanding is slightly different. In my case the goal is to fit as many bags as possible into each bin, instead of using the least bins. Maybe it's a best fit algorithm?

In my example I have a number bins that can fit a number of bags, with each bin only taking bags that contain a specific attribute. Each bag can have a number of attributes. The goal is to make use of the largest number of bags as possible. I feel like there may be a better term to use for my problem but Im not sure.

In my case, I have full knowledge of what bins and bags are available whenever I have to sort them.

an simple example

``````bin 1 allows attribute X with 1 slot
bin 2 allows attribute Y with 1 slot
bin 3 allows attribute Z with 1 slot

1 bag has attribute X, Y and Z
2 bags have attribute X and Y
``````

In this example, it's clear that the Z bag should go to bin 3. My initial idea is to loop through the bins with the lowest amount of attributes to fill them first.

Im wondering if there is any established algorithm of solving a problem like mine.

### Content Attribution

This content was originally published by Fabricio Ferreira at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.