'Adds a distance penalty for `number1` as a ratio of `number2`.
`number1` is bound at 0 and `number2`.'

def add_ratio(self, key, number1, number2):

    number = float(max(min(number1, number2), 0))
    if number2:
        dist = (number / number2)
    else:
        dist = 0.0
    self.add(key, dist)
