Skip to main content

Module rewards

Module rewards 

Source
Expand description

Common shapes of time-dependent rewards, for Route::reward.

Each takes the full reward, the finish time and the shape’s parameters, and returns what the task is worth at that finish time. deadline and linear_decay return None when it is too late; wrap halving in Some. None of them grows with later finish times.

Functions§

deadline
The full reward up to and including deadline, and None after it.
halving
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.
linear_decay
The full reward up to from, falling linearly to zero at until, and None after until. Rounds down. When until is not after from, this is a deadline at from.