Algebra for calculating when value will equal zero: We project when value will equal zero, and compare number of seconds
v = (s - x) - (d * x)
Solve for the slope-intercept form:
v = -dx - x + s
v = -(d + 1)x + s
Slope = -(d + 1)
y-Intercept = s
When v = 0
, the item is, by definition, expired. So, solve for x when v = 0
to find the order age when it expires.
0 = -(d + 1)x + s ==> -s = -(d +1)x ==> x = s / (d + 1)
This gives us the number of seconds from the beginning of the order when the item will expire. But what if the decay rate changes at any point? For example, if the order was moved to the overflow shelf at some point, then how do we project the new projected expiration? For this, let's examine the relationship between shelfLife and value.
We know that s
is the y-intercept of the linear value equation. We can think of the initial shelfLife
as the current value of the item before it begins to decay. Now we want to calculate the number
of seconds before the item expires given any time t
between order start and expiration. For this we
can think of an entirely new function where s = [current value]
. This gives us:
v = -(d + 1)x + [current value]
And we already know how to calculate the number of seconds until the item expires, so:
x = [current value] / (d + 1)
This allows us to continually update the projected expiration, and make better decisions about how to minimize waste in the system.