Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.