How to club the orders in such a way that maximum number of items are common amongst them? Consider the following data set:
The above table shows the quantity of each item used in the orders SO1 SO2 etc. I need to club the orders in such a way that maximum number of items are common amongst them.
For example:  



SO1 SO3 SO5  can be clubbed for 8 items ( Item 1,2,3,5,6,8,9,11) and SO2 and SO4 can clubbed together because 9 items are common ( Item 1,3,4,5,6,8,9,10,11).

The approach I followed was:
 I found out the number of combinations possible as in (SO1 SO2), (SO1 SO3), (SO1 SO4)……(SO1 SO2 SO3), (SO1 SO2 SO4),….(SO1 SO2 SO3 SO4),…(SO1 SO2 SO3 SO4 SO5). For n number of SOs I would be getting around 2^n -n -1 combinations. 
Later I compared the data in each combination for equality. 

Based on the number of matches, I thought I would be able to select the combinations. But this process would become cumbersome for 300 shop orders with around 2000 items. And it is taking a lot of time to compute as well.
Have you tried using frequent itemset mining?

It finds the most frequent item combinations.

The key idea is that when item A is not frequent, you don't need to further explore any combinations including A.