Designing a rationing algorithm for a store
This sounds like a maximization problem. The algoritm should try to maximize something, let us call it utility.  What You need to start with is to define the utility funktion: is it better to sell all to first customer or end the day with unsold goods?