'Applies punishment and reward based on the principle leap up leap back.
Large interval jumps (more than a fifth) should be followed by moving back
in the same direction.
Args:
action: One-hot encoding of the chosen action.
resolving_leap_bonus: Amount of reward dispensed for resolving a previous
leap.
leaping_twice_punishment: Amount of reward received for leaping twice in
the same direction.
Returns:
Float reward value.'

def reward_leap_up_back(self, action, resolving_leap_bonus=5.0, leaping_twice_punishment=(-5.0)):

    leap_outcome = self.detect_leap_up_back(action)
    if (leap_outcome == rl_tuner_ops.LEAP_RESOLVED):
        tf.logging.debug('Leap    resolved,    awarding    %s', resolving_leap_bonus)
        return resolving_leap_bonus
    elif (leap_outcome == rl_tuner_ops.LEAP_DOUBLED):
        tf.logging.debug('Leap    doubled,    awarding    %s', leaping_twice_punishment)
        return leaping_twice_punishment
    else:
        return 0.0
