There are $5$ customers $A, B, C, D, E$ in a shop looking to buy $35$ oranges in total.
$A$ wants to buy $5$ oranges
$B$ wants to buy $2$ oranges
$C$ wants to buy $15$ oranges
$D$ wants to buy $3$ oranges
$E$ wants to buy $10$ oranges
The shop does have $35$ oranges to sell but they have been bought in different prices (and hence need to be sold at different prices). There are $6$ different price categories:
$1$ orange of $O_1$ type that costs $\$16$
$2$ orange of $O_2$ type that costs $\$16.1$
$7$ orange of $O_3$ type that costs $\$16.2$
$10$ orange of $O_4$ type that costs $\$16.3$
$14$ orange of $O_5$ type that costs $\$16.4$
$1$ orange of $O_6$ type that costs $\$17$
The shopkeeper now needs to decide what is a "fair" way (algorithm) to allocate those oranges to his customers. There is no distinction between oranges of different price (all look th same).
I put it into Excel Sover and tried to minimize the Objective function: sum of squared disctances from the weighted average price, given the constraints we have (Integer Programming).
However, I am not sure if this is the most efficient way to do it, since if we increase the number of oranges or different prices the system gets too big.
Would you have any idea on how to approach that?
There is no single best / fairest objective function, but I would lean toward minimizing either the highest average price per orange paid by any customer or the largest total (not average) premium (above \$16 per orange) paid by any customer.