View the source for desertify
Why desertify?
You & a buddy are hungry and take a trip to a restaurant. It’s just the 2 of you.
You enter the restaurant, and the there aren’t any 2 seaters. No worries, your waiters thinks quickly and seats you in a table of 4. Great!
Not so fast. 2 of the seats in your 4seater are being unused. You & your friend might not care, but the restaurant is not using their table space efficiently & thus losing out on potential profit ($$).
Let’s add another event to this scenario.
Say, like 2 minutes after you & your buddy enter, a group of 4 enters. Oh no, you & your friend took the last 4 seater. Now what? Well, the group of 4 decided to leave. Bam, the restaurant loses 4 customers.
In hindsight, your vision is 20/20. The restaurant could have asked you & your friend to simply wait till the next 2 seater becomes empty. Then when the group of 4 arrive, seat them at the free 4seater.
But wait, how do we know *before* the fact, that this is an ideal solution for the restaurant? Simple, with a little probability/Math, we can make some smart decisions about seating customers to optimize our seating space.
It’s just an inefficiency , and we can easily bridge this gap. That’s what desertify attempts to achieve.
desertify takes 2 key inputs

The seating capacity of each table & its quantity (i.e four 2seaters, three 3seaters, etc)
/* * The key represents the seating capacity in terms of # of people * The value represents the quantity of the table */ const tablesAvailableTemplate = { 2: 4, 3: 3, 4: 2, 5: 2 }

The average number of times per day each quantity of customers arrive (i.e groups of 4 arrive 15 times, groups of 2 arrive 20 times, etc)
/* * The key represents the number of people in a group who enter a restaurant * The value represents the number of times a day a group of size [key] enters */ const arrivalNumbersDaily = { 1: 5, 2: 20, 3: 20, 4: 15, 5: 10 }
With this, desertify derives all other calculations necessary to optimize the amount of table space a restaurant uses during hours of operation.
View the source for desertify