Practical Question - How to Optimise Times over a Timeline

264 Views Asked by At

Let's assume you want to buy a blueberry muffin at your local bakery.

But, there are a few things that complicate the matter:

  • The bakery is open from 6am - 1pm.
  • Blueberry muffins are in high demand and they are only made one time per day. They sell out fast.
  • You do not know the exact time that the muffins are made. However, you know at which times the bakery made them historically for the last 5 previous days. Let's say, those times are t1 = 6:45am, t2=8:00am, t3=8:45am, t4=7:10am and t5=11:30am.
  • You have good reason to assume that there is some consistency in those times. But there might be outliers (such as t5).
  • You really like blueberry muffins. But you think you should not walk to the bakery to check if the muffins are available more than 10 times per day.

A quick graphic to illustrate the issue: Illustration

Now my question is: How can I mathematically optimise the time for my 10 visits to the bakery, based on the 5 historic data points? Goal is to optimise my overall chances to go home with some delicious muffins.

2

There are 2 best solutions below

3
On

Use the historical times to estimate a probability distribution function - then integrate this probability distribution function to interpolate regions with high probabilities corresponding to availability of muffins. Then visit the bakery around those times.

0
On

First, I would find out the time to expect before they are sold out. Then just match 2 visits to each data point. If you expect 30 minutes for a "window" of muffin sales, and 11:30 was a previous start time, divide it up evenly 3 ways (visit at 11:40 and 11:50). Do the same for the other 4 times. Or, if the times tend to be random, spread your visits out more, focusing on the most common data points (earlier in the day).