Working on a personal project, I have encountered a problem that I'll try to generalize here.
Given a list of resources of different value (e.g. resources = [1, 0.8, 1.5, 0.8, 1.2...]
), I want to share them among a group of N people in a way that is as fair as possible (i.e. no one ends up hoarding too much value while others have too little).
I assume a good way of tackling this issue is to minimize the function:
f(r1,...,rN) = (avg - r1)^2 + (avg - r2)^2 + ... + (avg - rN)^2
Where avg = sum(resources) / N
and rx
is the resources assigned to person x
.
I have stumbled upon scipy.optimize.minimize
, and I think it might be helpful, but I can't figure out how to describe the constrain that the values of r1, ..., rn
cannot be arbitrary but instead need to be taken from resources
(and in a way that the same resource is not given to more than one person in a solution), since I don't have any experience with this module nor a strong mathematical background applicable to this type of problem.
Is there an easy way of solving this problem with scipy
?