---
# System prepended metadata

title: 'Title Challenge 3: Scheduling/Resource Management'

---

# Title Challenge 3: Scheduling/Resource Management

Recovery from the Pandemic: Hospitality & Leisure
12th - 14th October 2021

----------------------
# Presentation


## BLUF - Bottom Line Up Front

Data + Collaboration + Optimisation Algorithm = Money for all + Happy Customers 

## Introduction

- Context
- Proposal
- Analysis and insights
- Conclusion and proposed future work

## Context

- There are staff shortages and supply chain problems
- COVID effect
    - The hospitality and leisure industry has taken a big economic hit and needs to draw in maximum revenue
    - Certain customer sectors haven't yet come back (e.g. overseas tourists)
    - Risk of further government restrictions over the winter
    - revenues are also down because of a change in cancellation time windows to meet customer expectations that has led to more no shows 
    - Some evidence though says spend per customer is up 
    - Companies such as uber eats, deliveroo, just eats etc. have thrived in the pandemic, but they take a large commission which has also led to lost revenue
- Actors
    - Restaurants 
        - Individual v collective
        - Small v large
    - Customers

So

- Can we match resource (staff) to demand in the presence of a more uncertain demand profile after the pandemic?
- Can we even up use over time (making the assumption that this will also maximise revenue)?

![](https://i.imgur.com/qoeFEQ2.jpg)


## The Big Idea
App promoting cooperation

![](https://i.imgur.com/2Z2YQhO.jpg)


# Analysis and Insights

## Edgardo Utility Equation

$$
  u(x_0,o)= o\left[\underline{C} y +  C x - D \max\left\{x -x_0,0\right\} - \left(P+Gx_0\right)\right] - (16-o)K
  $$
- $u$ Utility function: profit
- $o$ Opening hours, up to a maximum of 16
- Income
-- $\underline{C}y$ booking fee collected from no shows, $y$
-- $Cx$ income from customers, $x$, including booking fee
- Costs
-- $P+Gx_0$ cost of being open with staffing levels for $x_0$ customers
-- $D \max\left\{x -x_0,0\right\}$ lost revenue and reputation cost of turning customers away $(D>C)$
-- $(16-o)K_i$ operating costs while closed




## Edgardo Model: Stochastic Demand Single Business
- Sochastic demand
$$
  u(x_0,o)=\sum_{i=1}^o \left(\underline{C} y_i +  C \left(x_i + \hat x_i\right) - D \max\left\{x_i + \hat{x}_i -x_0,0\right\} - \left(P+Gx_0\right)\right) - \sum_{i=1}^{16-o} K_i
  $$


  
  

### Managing Demand
Python code
- Implements stochastic demand ($\hat x_i<0$ no shows, $\hat x_i>0$ walk ins)
- Optimises over staffing numbers $x_0$ and opening hours $o$
- Monte Carlo simulation: average over many sampled $\hat{x}_i$ 
- Allows a business owner to predict how many tables should be available given the owner is able to open for a certain number of hours

![](https://i.imgur.com/Gx7QC0j.png)
- Current parameter values suggest staying open as long as possible
- However, choices may not be totally realistic

## Busra's Model: Integer Programming Single Business

 ### Problem Setting 
 - From the viewpoint of a small business owner
 - No show-ups in bookings, cancellations, walk-ins: **stochastic demand**
 - **Resource management <--> Infection risk**
     - Implementing a framework for infection risk
 - **Research questions:**
     - How can the owner maximize their utility with improved operational decisions?
     - What is the benefit of being a member of that network, which is expected to provide
         - easier updates of bookings, hence better demand information,
         - decreased cost of lost sales with the help of cooperation?

### The Model
 - **Objective:** Maximizing their utility, consisting of:
     - (+) Revenue from booking fee = (bookings - MIN (demand, bookings)* fee
     - (+) Revenue from service = MIN (demand, service capacity) * revenue per customer
     - (-) Cost of opening the restaurant = fixed cost
     - (-) Cost of running the service capacity = service capacity * variable cost
     - (-) Lost sales or reputation cost = MAX (demand-service capacity, 0) * lost sales or reputation cost
     - (-) Cost of infection risk = f(MIN(demand, service capacity)/maximum capacity)

$$
  u(x_{0,m},o_m)=\sum_{j=1}^m \sum_{i=1}^o \left((b_{j,i} - min(d_{j,i}, b_{j,i})) \underline{C} + min(d_{j,i}, x_{0,m})C \\ - \left(P+Gx_{0,m}\right) - max(d_{j,i}-x_{0,m},0)L - f(min(d_{j,i}, x_{0,m})/x_R)\right)
  $$

- **Decision variables:** Simultanous decisions for **the service capacity** of the restaurant and **the number of hours** the resturant would be open on each day.
- **Constraints:** Maximum service capacity, maximum number of hours that the restauant can be open
- **Major inputs:** Bookings, expected demand, revenues and costs per unit

### Example Results
- A restaurant, maximum service capacity of 20 people
- Bookings vary between (1,10) per hour
- The expected demand is 10 people in the earlier times of the day, whereas drops to 5 people in later hours
- Customers arrive based on a uniformly distribured stoshastic demand
- Determine the best integer values for "beginning hour", "ending hour", "service capacity" of the business for each day

![](https://i.imgur.com/DPUfXbS.jpg)

- Allows a business owner to identify the profits to be gained from demand smoothing such as the app would provide

## Abi Model: Integer Programming Multiple Businesses  

![](https://i.imgur.com/xWr0FtJ.png)

- Deterministic demand
- Integer constraints for:
-- Staff availability/opening hours
-- Minimum numbers of customer (for viability)
-- Maximum number of customers
- Maximise sum of fractions of target customer numbers



### Non Cooperation
- Greedy businesses hoover up all available customers
- Three out of five restaurants go out of business, when there are 1100 total customers in a week. 
![](https://i.imgur.com/sVsvRAb.png)

![](https://i.imgur.com/2QeBTTn.jpg)


### Cooperation
- Customer allocation optimised respecting minimum viable thresholds
- Five out of five restaurants stay in business as long as a minimum threshold of customers is met (around 1100)



![](https://i.imgur.com/tFPvCFT.png)





# Conclusion

- Proof of Concept that a well designed app implementing optimisation of resourcing against consumption has potential to improve returns. 
-- for a single business and a group of businesses
-- can cope with complex constraints


## Suggestions for future work

- Further work needed to quantify benefits of cooperation/burden sharing
-- Preliminary analysis suggests it can help businesses stay viable
-- Particularly for marginal cases
- Agent based modelling to provide insight into customer benefit
- Include infection risk / customer density score
- Realistic parameter values






-------------------

## Idea 1

The problem is one of matching resource availability and demand, while also encouraging the rather fickle customers who do not want to be peed off by having a booking cancelled or being in a restaurant where they don't feel too full.

The big idea is to have some kind of middleman agent that matches customers to restaurants that have capacity. 

Could an honest third-party broker, like a local tourist board 
or industry association run an online booking system for restaurants. - streamlines booking system for the customer, as sometimes they aren't professional/convenient etc

The customer pays a booking fee to reserve a table. But if the restaurant at the last minute has to cancel (due to staff shortages, or supply chain problems) then the app suggests another similar restaurant, thus minimising disappointment.
The deposit then shifts to the new restaurant. 

Other features: 

- pre-order on the app
- order in the restaurant on the app 
- real time information on busy-ness of the  restaurant 
- aggregates information such as hygeine rating, covid mitigations, cost range, type of food etc
- Ability for customer and restaurant to feed back on each other.
- a funding model where the upfront costs are met by the industry body or local agency, but eventually pays for itself through a footfall 



# Mathematical model 

## model 1 - a simple optimisation model at the level of a single business 

Q) As an owner of a small business how benificial is it for me to be a member of the new network?

Success = how close the tables being used are to my declared capacity all the time that I am open. 

  penalty = having to meet a declared capacity when I am short staffed + upsetting customers with poor service if I am over-capacity + cost of keeping an under-used restaurant open
  
$$
  u(x_0,o)=\sum_{i=1}^o \left(\underline{C} y_i +  C \left(x_i + \hat x_i\right) - D \max\left\{x_i + \hat{x}_i -x_0,0\right\} - \left(P+Gx_0\right)\right) - \sum_{i=1}^{16-o} K_i
  $$
  
  
  
  where $x_i$ is the number of people you are expecting and arrive at time $i$, $\hat x_i$ is the number of people you weren't expecting that appeared into your place at time $i$, $y_i$ is the number of people that books a table but do not appear at time $i$, $\underline{C}\approx5$ is a booking cost, $C\approx 15$ is the average amount of money that each person spends at your place, $D\approx 5$ is a reputational cost from turning customers away expressed as a financial cost,   $x_0$ is the amount of people you are expecting at your place, $o$ is the number of hours in which your place is open, $P\approx 10$ is the cost for having the place open, $G\approx 2$ is the price for being open related to each person that is at your place, $K_i\approx 20 \cdot U(0,1)$ is the amount you do not earn because of your place is closed.
  
  At the end, if we take into account that $x_0$ is an integer that ranges from 0 to 30, and $o$ ranges from 0 to 16, then we can see that the best utilities you can get are given by
  
  {0: [-158.7178411341557, 22.58291398079369],
 1: [166.85639125576523, 187.41775286755203],
 2: [483.63003416077805, 267.83449301038536],
 3: [801.7663415637784, 337.93165798554827],
 4: [1123.8490767458127, 385.08109391736775],
 5: [1451.6112312806601, 439.1383322074899],
 6: [1772.5333964353583, 484.7945050799274],
 7: [2086.7270141166937, 531.221521550456],
 8: [2412.4822095370546, 519.023529478393],
 9: [2731.0796589943116, 602.5961415700922],
 10: [3055.8165903574686, 607.2632805821172],
 11: [3356.7827106785094, 628.4050796109725],
 12: [3699.0844499831933, 715.6625598568588],
 13: [4008.5479308194863, 670.5189008489826],
 14: [4377.639323186155, 721.4355124308357],
 15: [4667.853993523037, 726.6323646112019],
 16: [4970.775, 783.2935748332167]}
 
 These dictionary is set as follows: the key value is the value of o, and the value is a list containing the best average value obtained for that value of $o$, and the standard deviation (after running the code 1000 times with the corresponding values of $x_0$ and $o$). In particular, these values where obtained with the following values of $x_0$:
 
 {0: 15,
 1: 27,
 2: 27,
 3: 30,
 4: 27,
 5: 28,
 6: 30,
 7: 28,
 8: 26,
 9: 30,
 10: 26,
 11: 26,
 12: 29,
 13: 27,
 14: 30,
 15: 28,
 16: 28},
 
 where this dictionary shows the value of $o$ and the corresponding value of $x_0$ associated with the maximum utility attained according to the previous dictionary.
 
 In particular, here we assumed that the number of people at the place could range from 0 to 50. This clearly proves that, if the number of people can be greater than the maximum amount of people you can serve at the same time, then to have the maximum availability is better on average. Furthermore, notice that the more hours you are open, the less the standard deviation of the sample, which means that if you open for a long amount of hours in a day, then the possible utility results in a day vary less.
 
  
 Some of these parameters are going to be stochastic inputs. For example E(t) could represent the availability of your key staff. x(t) is the demand for my restaurant. As decision variables I have o(t) and x_0(t). There is a staff cost associated with being open which will be a function of $x_0(t)$. Also $x_0$ may not be completely a decision variable if it changes unexpectedly due to staff shortages.  
 
 Perhaps we have to run a Monte Carlo simulation where staffing becomes a random variable. 
 
### Model 1b Integer Programming

Could we adapt the integer programming method described here https://ocw.mit.edu/courses/sloan-school-of-management/15-071-the-analytics-edge-spring-2017/integer-optimization/operating-room-scheduling-making-hospitals-run-smoothly-recitation/ to handle staffing/opening constraints? 
(Operating rooms -> tables/restaurants, surgical teams -> chefs? tables? waiting staff?) How to change the merit function if each restaurant optimises individually vs all optimising together? 

 Next step: how would these variables change if the restaurant was now part of the community app.
 
 
 We've created an example which contains 5 restaurants, which each have maximum opening hours, and a maximum number of tables that can be used for each day in a week. For each restaurant, there's a minimum number of covers per week that must be sold in order to stay afloat. This model tries to optimise the whole hospitality sector, and represents our app idea distributing customers "fairly", so that no one goes out of business. 
 
 The value optimised by our method is:
 $$
 \sum_{j\in N} o_j/t_j
 $$ where $o_j$ is the total number of covers restaurant $j$ has served in the week, and $t_j$ is their target. 
 In Layman's terms, this is the sum of all of the proportions of targets met. Eg. if restaurant A received half of their target, and restaurant B received 3/4 of their target, this sum would be 1.25, and the maximum it could be with 2 restaurants would be 2, provided there are enough people who would like to eat out. 
 
 
 Each restaurant aims to maximise their profits, so their "targets" are the maximum number of covers they could sell in a week. 


 
 ## Utilization Optimization Model - Capacity and Working Hours
 
 As a restaurant owner, one would like to make the best operational decisions depending on their available knowledge about **the bookings** and **the expected demand**.
 
 The restarurant owner tries to maximize their utility by adjusting their decision variables for *each day*: **capacity** of the restarurant and **the number of hours** it is open.
 
 The utiliy function of the restaurant owner constsists of:
 - (+) Revenue from booking fee = fee * bookings  
 - (+) Revenue from service = MIN (demand, capacity)
 - (-) Cost of opening the restaurant = fixed cost
 - (-) Cost of running the capacity = capacity * variable cost
 - (-) Lost sales of reputation cost = MAX (demand-capacity, 0) * lost sales cost
 - (-) Cost of infection risk = f(MIN(demand,capacity)/maximum capacity)
 
 An example input sample:

| Days | Hours | Booking | Demand Expected |
|:----:|:-----:|:-------:|:---------------:|
|  1   |   1   |    1    |       10        |
|  1   |   2   |    8    |      10        |
|  1   |   3   |    3    |      10        |
|  1   |   4   |    7    |      10        |
|  ...   |   ...   |    ...    |      ...        |

 
Example output sample which maximizes the expected utility: 

| Day | Beginning Hrs | Ending Hours | Capacity |
|:---:|:-------------:|:------------:|:--------:|
|  1  |       1       |      12      |    12    |
|  1  |       1       |      13      |    10    |
|  1  |       1       |      16      |    9    |
|  1  |       1       |      13      |    13    |
|  1  |       1       |      9      |    11    |

  
  ## model 2 - some kind of multiagent model
  
  - how can we avoid the prisoners dilemma of another business offering a cheaper product that does not use the app
          
