We will first talk about remaining quantities in the context of concurrency model of compete within priority and compound across.
If all discounts are compoundable, then for each round of priority, the quantities available are the same for all the discounts. Let’s have an example,
|S99||20% off an ergo keyboard||99|
|S50||10% off all keyboards||50|
In the transaction, we have 2 ergo keyboards. Starting with priority 99, we can apply S99 for quantity 2. Next for priority 50, we apply S50 again for quantity 2.
Now, many retailers want to have certain discounts exclusive. Let's examine how we could accommodate exclusiveness in the concurrency model of compete with priority and compound across. Let’s add an exclusive mix and match with priority 50.
|S99||20% off an ergo keyboard||99||Compound|
|S50||10% off all keyboards||50||Compound|
|M50||Buy 1 keyboard get 1 mouse free||50||Exclusive|
In the transaction, we have 1 ergo keyboard and 1 mouse. First priority 99, we apply S99 to 1 ergo keyboard. Next priority 50, let’s examine the remaining quantities: for S50, it’s 1 for ergo keyboard; for M50 however, zero because exclusive means it can’t compound on top of S99. In summary, for priority 50, we have two knapsack sizes: one for exclusive, one for compoundable.
Dynamic programming works better and is simpler when it has the uniform knapsack size for all the available items. We could make two knapsack sizes work, but with more complexity and less efficiency.
To keep it simple, we decided, in the concurrency model of compete within priority and compound across, not to have exclusive discounts to compete with compoundable ones in the same priority. Instead, per priority, let exclusive discounts compete first, and then adjust remaining quantities by taking out quantities taken by exclusive discounts and let compoundable discounts compete. Across priority, we need to adjust remaining quantities again.