pub fn halving(reward: u64, finish: u64, half_life: u64) -> u64Expand description
The full reward at time zero, halving every half_life, with linear steps in between,
and never None. Rounds down. A half_life of zero gives the full reward at time zero
and zero after.
This is the integer counterpart of CBBA’s classic time-discounted reward λ^t · reward.
use task_allocation::route::rewards::halving;
assert_eq!(halving(100, 0, 10), 100);
assert_eq!(halving(100, 10, 10), 50);
assert_eq!(halving(100, 15, 10), 37);
assert_eq!(halving(100, 20, 10), 25);