Alex
Alex

Reputation: 25

Maximum weight matching in bipartite graphs with constraints

Assume that we have two sets: A=(a_1,a_2,...,a_m) and B=(b_1,b_2,...,a_n) (Not necessarily of same size). A function F assigns a weight to each link from set A to set B: F:A*B->R. So, for example, F(a_1,b_1)=2 means that the weight of the link between a_1 and b_1 is 2. The problem is to connect the elements of set A to those of set B in order to maximize the sum of the link weights satisfying these constraints:

I have searched for some ideas and I looked into the assignment problems and the Hungarian algorithm. The additional thing is that none of these consider the second constraint I have. Do you have any ideas on how to solve this?

Thanks

Upvotes: 2

Views: 2000

Answers (1)

sdcvvc
sdcvvc

Reputation: 25654

It's NP-hard.

Take a subset-sum instance {x1, x2, ..., xn}, where xi > 0 and a number k. Create a bipartite graph where left vertices are {a1, ..., an}, right vertices are {b1,b2}, and:

F(ai, b1) = xi

F(ai, b2) = 0

C1 = k

C2 = 0

So you can take the number xi by connecting ai with b1, and leave it by connecting with b2. Obviously there is a weight k matching iff the subset sum instance has a solution.

Upvotes: 4

Related Questions