I have a data set I need to allocate values from receipt points (RP) and delivery points (DP) that have varying connectivity relationships (one-to-one, one-to-few, one-to-many, many-to-one, many-to-few, many-to-many). These receipt and delivery values need to be allocated by a contract number, and values for each contract between the receipt and delivery points always sum equally (i.e receiptsums == deliverysums), but the individual receipt and delivery values may not (i.e not a bin packing problem). The one-to-one relationships are easily solved by filtering where contract number's receipt value and delivery value sum and only have one row of each (two rows total/contract).
Many-to-few (or vice versa) is proving problematic.
It does not matter from which RP the DP receives its allocation.
The solution for this question somewhat addresses the issue at hand, and is what I'm working off of R: Distributing an amount as evenly as possible II
I started learning R on saturday for this work project fwiw. In excel I would do a min function on an asc rank, but that doesn't work here as I need to create new rows in some instances while keeping the RP & DP names and contract number.
I've included an image below.
Any pointers would be helpful.
Thank you, Karl
Volume Datatables