Suppose there are three categories of people. Type X, Type Y, Type Z. In each type, there are two objects of subtype Type 'a' and type 'b'.
For example.
X: a1 , a2 , b1 , b2
Y: a3 , a4 , b3 , b4
Z: a5 , a6 , b5 , b6
Each object of type 'a' should be assigned with an object of type 'b'. But it is desirable not necessary to assign a type 'a' with type 'b' from different classes (X, Y, Z).
In this example, the optimal solution would be: a1 with b5 , a2 with b6 , a3 with b1 , a4 with b2 , a5 with b3 , a6 with b4 .
Non -optimal solution would be :
a1 with b5 , a2 with b6 , a5 with b1 , a6 with b2 , a3 with b3 , a4 with b4 .
(Non -optimal because a3 and a4 are assigned with b's of same type Y)
If we generalize, there can be n- number of Types (X,Y,Z, .....and so on) with different number of a's and b's in each (but total number of a's = total number of b's).
How to find an optimal solution?