How to find the best fit when you have a set of ideal ratios, but some of those are below a minimum?

23 Views Asked by At

Say you have a set of ideal ratios, whose sum = 1. For example,

input = [0.2, 0.2, 0.3, 0.3]

But suppose that there is a rule stating that every ratio should be either 0 or less than 0.25. Intuitively we can say some answers include:

output = [0, 0, 0.5, 0.5]
output = [0.25, 0.25, 0.25, 0.25] 
output = [0, 0.25, 0.375, 0.375]

But the sum of the differences from the ideal_set is 0.8 for the first answer, 0.2 for the second, 0.5 for the third, so the first is superior.

Is there an algorithm/formula to automatize this normalization?