This is my first time posting on this forum so thank you to everyone in advance.
The simplest way for me to describe my problem is as follows: I have two datasets. The first dataset consists of a list of suppliers and their capacities. It looks like
Code:
<supplierid> <capacity> A 20 B 30 C 10 D 15
Code:
<buyerid> <quantity> <preference> <supplierid> 1 15 1 A 1 15 2 C 2 10 1 A 2 10 2 C 3 20 1 B 3 20 2 A
What I want to do is make my way down the list of buyers and assign a supplier to each buyer (to the extent that I can). So for example, buyer 1 will buy 15 units from supplier A. Buyer 2 will buy 10 units from supplier C (since supplier A won't have 10 units of capacity left after buyer 1 has purchased 15 units), and buyer 3 will buy 20 units from supplier B. I want my final dataset to look as follows:
Code:
<buyerid> <quantity> <sellerid> 1 15 A 2 10 C 3 20 B
Any help will be greatly appreciated.
Thanks!
0 Response to How to match two datasets with constraints?
Post a Comment