## 1. Introduction

Demand forecasting and suitable pricing are two key factors in any business. In the hotel context in particular, and more specifically in the online segment, these tasks are of vital importance due to the dynamic nature of prices and high competitiveness. Automating these processes is key to a quick adaptation, which is why more and more hotels are supporting their decisions in recommendation systems or RMS.

In this article, we present a hotel **demand forecasting model** and a strategy for choosing the optimal price in order to maximize expected profits. The structure of the article is summarized below.

In section 2 we describe the data set used for this case study. In section 3, we present the demand forecasting model, based on time series. In section 4, we explain how the above prediction is used to generate possible future scenarios through Monte Carlo simulations. In section 5, we will study the effect of price on demand from historical data. These results will be used in section 6 to calculate the optimal price on the simulations generated in section 4. In section 7 we present the results obtained in each of the previous sections. Finally, in section 8 we summarize the work done and suggest further improvements.

## 2. Data description

The data set we use is a three-year simulation of bookings at a certain hotel, in whose data we have included the effect of weekly and yearly seasonality. We will use the data up to a certain date, the **in-sample period**, to predict future demand and propose an optimal price over the remaining dates, the **forecast period**.

It is assumed that the hotel accepts reservations for a specific day of arrival since π = 10 days in advance, up until the same day of arrival. The prices are fixed once a day, so at the beginning of each day the hotel manager sets the prices for the current day and the next πdays. These prices are kept during the whole day, so all reservations made on that day are charged these rates. However, the next day, the corresponding π + 1 prices are set again, which may be different from those set on the previous day. The hotel capacity is πΆ = 100 rooms.

We have detailed information of price and total demand for each day of arrival and each booking day. The dataset also provides the **period or season** in which each check-in day is included, both for historical data and for the dates to be predicted. In this case there are four distinct periods:

**Very Low Season***(Very Low)*: December, January and February.**Low season***(Low)*: March, October and November.**High season***(High)*: April, May and September.**Very High Season***(Very High)*: June, July and August.

Thus, the data set has the following columns:

**ReservationDate**: the day on which the reservation is made.**CheckInDate**: the day of check-in.**ADR**: the price set on the day of reservation for that day of check-in, in dollars.**Demand**: number of reservations on the reservation date for the check-in date.**Season:**the period in which the check-in day is included.

Figure 1 shows both aforementioned annual and weekly seasonality, as well as a slight upward trend in both demand and price over time. A strong positive correlation between price and demand is also observed, as is often the case in the hotel industry.

## 3. Prediction of future bookings

We now define the process by which we predict future demand. Let π
(π, π‘) be the total number of reservations made for a particular check-in day π‘, a number of days π in advance (difference in days between booking date and check-in date). Note that this number is a realization of the **bookings** random variable, which we denote by π΅(π, π‘). We model this random variable as the product of two independent functions as follows.

On the one hand, the **size** of demand according to arrival day, π (π‘), represents the total number of expected reservations for a π‘ check-in day. On the other hand, the **demand shape** as a function of advance, π΅'(π), represents the fraction of the total number of reservations for a particular arrival day that are made π days in advance.

### 3.1. Demand shape

We assume that the demand shape as a function of the booking advance time depends on the **season** (or **period**) in which the arrival day π‘ is included. As we mentioned in Section 2, there are four seasons in our data, corresponding to periods of very low, low, high or very high activity. Then, for each season π, we consider the set π_{π} of all days falling into that period, and we can estimate the form of demand as a function of anticipation as follows.

That is, for each arrival day of the season under consideration, the fraction of reservations made π days in advance is calculated. Finally,the average over all days is computed in order to obtain the demand shape average for period π. It is assumed that this pattern does not vary in the short term, so the calculated seasonal demand shape will be used in the estimation of future demand.

### 3.2. Demand size

Demand size represents the total expected demand for each check-in day. It is thus estimated from the sample data as the total number of reservations made for each particular stay date.

Remember that our data presents both annual and weekly seasonality. In order to predict the series behavior and thus be able to estimate demand in the future, we deseasonalize it as follows.

First, we calculate the seasonal index for each season π, using to the formula

where the denominator represents the average of the series π (π‘) in the year which day π‘ belongs to. Thus, seasonal index for period π is just the average demand for this period, where each value is normalized by its annual average. Then, let *π*_{π‘} be the period to which day π‘ belongs, we calculate the yearly deseasonalized series, as follows

where the subindex π represents that this is an intermediate step where yearly seasonality has been removed.

To get rid of weekly seasonality, we follow a similar process. This time, the series π _{πππ ,π}(π‘) is considered and we use the day of the week π instead of the period π. We also use the median instead of the average to represent the seasonal index of each day of the week. This technique is common in the literature in order to preserve the shape of the weekly peaks. Therefore, we will calculate the seasonal index for day of the week π as

where π·_{π} represents the set of all days that are of type π (e.g. all Mondays). Here, the denominator represents the average of the series π _{πππ ,π}(π‘) over the week containing day π‘. Finally, the deseasonalized series is computed as

where π_{π‘} represents the day of the week of each day π‘.

Once we have stripped seasonality out of the series, we forecast it using the **Holt-Winters exponential smoothing model**, whose parameters are estimated from the sample data. Another option is to use SARIMA models, which require finding the hyperparameters (p, d, q, P, D, Q, m) that best fit the available data. In our case, since we have already deseasonalized the series, we have not found great improvements in the results when using these models. For this reason and due to its relative computational complexity, we use the exponential smoothing approach.

After making the projection of the deseasonalized series, we must undo the previous transformations in order to obtain the total estimated demand for each arrival day. This means that for each day π‘ of the forecast period, we must multiply the value of π _{πππ ,π}(π‘) by their respective seasonal indices and , where π_{π‘} and π_{π‘} are, respectively, the day of the week and the season corresponding to day π‘. In this way, we obtain the estimate for the future demand size. The results are shown in section 7.

## 4. Demand simulation

Next, we simulate the expected future demand projection assuming that the pricing policy will not change. Thus, the simulated demand is a reference value that will be affected by the pricing policy that is decided to be followed.

We modeled demand as a product of two independent functions, the demand size and the demand shape. For each day in the period to be predicted, we have predicted the demand size Ε(π‘) by projecting the deseasonalized series Ε_{πππ }(π‘), subsequently multiplying the value by the corresponding seasonality indices. On the other hand, we have obtained an estimate of the form of demand αΈ_{π}(π‘) for each period π from the historical data. Thus, the expected number of bookings made for a certain arrival day π‘ with an advance of π days is computed by means of the product

where π_{π‘} is the period in which day π‘ is included. In order to simulate the data, we also need to know the variance of the random variable π΅(π,π‘). Since we cannot calculate the variance explicitly, we approximate it from in-sample data as the mean squared error of the bookings variable for all days belonging to the same category, i.e., the same day of the week and the same period, and the same advance π. Thus, we compute the variance of the booking variable as

where π_{ππ‘} is the set of days belonging to the same season π_{π‘} as day π‘ and π·_{ππ‘} the set of days of the same day of the week π_{π‘} as day π‘.

From these statistics, we simulate the forward demand for each pair (π, π‘) as a normal distribution with average B(π,π‘) and variance Var( B(π,π‘)). This distribution is left-truncated at zero, since it is not possible to have negative demand values. Note that the normality assumption could be tested and, if rejected, a different model could be proposed. However, here we have considered enough to control for the average and the degree of dispersion of the demand.

Next, using the Monte Carlo method, we simulate π possible demand trajectories for the forecast period. Thus, for each day π‘ and each lead time π from 0 to π (the maximum lead time), we take π values from a normal distribution with mean and variance given by equations (8) and (9) respectively.

## 5. Estimation of the price – demand relationship

In order to find the optimal price to be set in order to optimize profits, one must take into account the effect that price has on demand. We know that in general the **law of demand** holds true: a rise in price leads to a fall in demand, and vice versa. However, when studying the data we generally find a **positive correlation** between price and demand. This is because there are common variables affecting both price and demand, a problem known as price **endogeneity**. For example, in general we have more potential customers in high season, so hotel managers raise prices, and yet demand is higher than in low season.

In this context, a simple estimate predicts a **positive elasticity value**, i.e., that a rise in price causes a rise in demand, contrary to the law of demand. This is shown in Figure 2.

Therefore, we need to process the data in some way to find the real effect of price on demand, which in particular must be negative. To this end, we proceed as follows.

First, we divide the data into similar subsets, that is, we group together days that belong to the same season and are of the same day of the week. For each subset, we calculate the average of the prices and the number of reservations obtained, which will be the reference prices and demands for that subset. Finally, we normalize the historical prices and demands by dividing each of the prices and demands by its corresponding reference value.

In this way, we hope to isolate the causal effect of varying price on demand. For example, a normalized price greater than 1 means that the price set was higher than the average price under the same conditions (e.g. because the hotel was almost full). Such a choice might result in a lower demand than the average demand under the same conditions, so the normalized demand would be less than 1.

In this case, we consider a linear regression of normalized demand on normalized price for each of the 4 seasonality periods. After fitting each model using the data for each period, we have that

where π_{ππππ}(π,π‘) and π_{ππππ}(π,π‘) are the normalized price and demand for a certain arrival day π‘ and lead time π, and π_{π‘} is the period to which day π‘ belongs.

In the next section, we use this relationship to predict how expected demand will increase or decrease depending on the price we set on each particular day. In this way we can calculate the expected profits for a particular price choice more reliably.

## 6. Optimal price calculation

In this section we define the strategy followed to find the optimal price. The objective is to fix the set of prices that **maximizes profits** in the forecast period, which implies a choice of price for each day π‘ and each possible lead time π.

If we do not impose any restrictions on the behavior that the price should follow, this problem can become extremely complex. In particular, the choice of the optimal price given a certain time in advance π depends on the expected profits to be obtained in the forthcoming days, which in turn depend on the price to be set for each of these days. For example, if the hotel is not expected to fill up, the price to be set should be relatively low to ensure a certain occupancy, while the price may be higher if high demand is expected. Such an approach requires solving a recursive problem, for example using dynamic programming.

As we will see in a future post, this calculation can be relatively complex even in simplified situations. To simplify this calculation, we present a parametric model for price based on multipliers.

### 6.1. Dynamic pricing model using multipliers

Let us assume the following approach. The price to be set on each day π‘ and each advance π could depend on several factors, each of which contributes to setting the final price. In particular, these factors, centered at 1, are interpreted as discounts or premiums that will be multiplied to a reference price. Here, the main assumption of the model lies in the fact that the multipliers are linear with respect to their respective variables, as we will see below. In particular, we take into account two factors: the **number of rooms available** and the **number of days in advance** of booking.

#### 6.1.1. Availability multiplier

A common practice in the hotel industry is to increase the price as the number of rooms available for the day in question decreases. Thus, in our model the multiplier decreases linearly with the number of rooms available, as seen in Figure 3.

The multiplier is determined by two parameters. The minimum is given when the hotel is empty and the maximum 6.1.2. Advance multiplier

It is common that the room price for a particular day increases over time since the moment reservations are accepted, and that a discount occurs in the last days if rooms are still available. Thus, the multiplier starts from an initial value of , at the maximum advance of π days, and increases linearly up to a maximum of on the same day of arrival. The parameters of the advance multiplier are thus, .

#### 6.1.3. Restrictions on parameters

Let us note that the two multipliers that have been defined depend on a set of 6 parameters ( for the availability multiplier, for the advance multiplier). The form of the multipliers imposes the following constraints on these parameters so that they produce logical results:

Thus, the choice of the optimal price will consist of finding the set of parameters that maximizes profits in the forecast period. To reduce the number of parameters to be determined, we impose additional constraints on the parameters. The purpose of the multipliers, as explained, is to introduce variations from a reference price, so we impose the average of the multipliers over the range of possible values to be 1. Thus, the following additional constraints are obtained:

In this way, the set of parameters to be fixed is reduced to ( ). The remaining two parameters are determined from these by equations (14) and (15).

### 6.2. Optimization process

#### 6.2.1. The objective function

The first step in any optimization problem is to define the objective function to be optimized. In this case, what we want is to **maximize total profits in the forecast period**. It should be noted that this model could be adapted to different goals depending on the customer’s needs. For example, one might prefer to maximize occupancy instead of benefit, even adding the constraint of ensuring a certain profit.

The above multiplier model allows us to reduce the search space to the four aforementioned parameters (). Thus, the price optimization problem is reduced to finding the best combination of these parameters. Next, let’s see how we calculate the expected profits given a set of parameters, using the generated Monte Carlo simulations and the effect of price on demand.

Note that, given a combination of parameters, for each arrival day π‘ and number of days in advance π, the value of the multipliers will be different. This is because each multiplier depends on a state variable, in particular on the **number of rooms available** π(π,π‘) for day π‘ when we are in π days in advance, and on the **advance** π itself. Thus, the price set for each pair (π,π‘) is calculated as

where the subscripts π΄ and π· denote the advance and availability multipliers respectively, and the values π_{πππ}(π,π‘) represent the reference price. This reference price can be set by the hotel manager himself. However, in this case we take it as the seasonal average obtained from historical data.

To calculate the effect of price on demand, we must take into account the relationship found in section 5. Recall that the normalized price is obtained by dividing each price by its reference price. Thus, according to equation (16), in this case normalized price is just the product of the multipliers. Using equation (10) we can then estimate the normalized demand, which represents the variation with respect to the reference demand caused by the price. Therefore, the number of expected bookings for those values of (π,π‘) should increase or decrease depending on whether the normalized demand is greater or less than 1, respectively. We do this as follows:

- If the normalized demand is higher than 1, i.e. 1 + π₯, each existing reserve is kept and a duplicate is created with probability π₯.
- If the normalized demand is less than 1, say π₯, each existing reserve is maintained with probability π₯.

Thus, given a set of parameters (), we will loop over each Monte Carlo simulation as follows:

- The profit is initialized to zero.
- For each day of arrival π‘ and each day of reservation π days in advance:
- The
**price set**is calculated according to the value of the multipliers. - The
**normalized demand**associated with the normalized price is calculated. - The
**new demand is calculated**according to the procedure explained above. - The
**realized demand**is calculated: the minimum between the new demand and the number of rooms available. The number of available rooms is updated.

- The

After this process, the total expected profit for each Monte Carlo simulation is obtained. By averaging over all of them, we obtain the expected value of the benefit using the set of parameters ().

Note that, in this setting, the objective function is a stochastic function, since different objective values can be obtained in successive runs of the function, taking as input the same set of parameters. For this reason, it is important that the number of Monte Carlo simulations be large enough to minimize spurious effects when averaging the results.

#### 6.2.2. Optimization strategy

Once the objective function has been defined, the optimization strategy to be followed must be determined. In case of differentiable functions, such as loss functions used in *machine learning* problems, it is common to use methods based on the calculation of the derivative such as gradient descent. However, as we have seen, in our case the objective function is relatively complex and in particular it is not deterministic. This makes the calculation of its derivative unfeasible, so we must take a different approach

In this case, we use an optimization technique based on an evolutionary algorithm. Such algorithms, in general, follow the general laws of biological evolution (in particular mutation, combined inheritance and natural selection). Thus, starting from an initial number of possible solutions, represented by valid combinations of parameters, the value of the objective function (called the fitness function, which must be minimized) is calculated for all of them. Then, natural selection is simulated by some selection method in which the fittest individuals (this is, the sets of parameters with lower value of the fitness function) are rewarded. Selected individuals breed with each other such that offspring represent a combination of parentsβ parameters. In turn, mutations (variations with normal distribution) are introduced in order to explore new sets of parameters. The process is then iterated simulating successive generations, obtaining better and better combinations of parameters.

In particular, for this problem we use the method called **CMA-ES** (*Covariance Matrix Adaptation Evolution Strategy*). This model is very flexible, so that it only needs as input the ranges of possible values for each parameter (specified by the constraints of section 6.1.3). Then, the evolutionary strategy is iteratively followed until the value of the objective function is stabilized or a certain fixed number of generations is reached. Finally, the individual with the minimum value of the objective function (here the maximum value of expected total benefits) is chosen as the optimal solution.

Note that this method is not deterministic, even if the objective function was. Due to the intrinsic randomness of the evolutionary strategy, different runs of the algorithm lead to different results, even with the same initial population. Therefore, it is not guaranteed to find the best combination of parameters, but it is suitable for exploring continuous state spaces, as is our case. Thus, we can run the algorithm several times to test with different initial populations, and finally we choose with the combination of parameters that gives the highest total benefit.

## 7. Results

In this section we present the main results obtained in this work. With the purpose of showing how predicted demand preserves annual seasonality, we have used a one-year length forecast period. Specifically, data from 2010 and 2011 are used to train the model in order to predict demand and recommend the optimal pricing strategy for 2012. Data from 2012 is only used to benchmark the obtained results.

In general, the longer the forecast period, the more difficult it will be to achieve realistic results, since there may be factors such as the entry of new competitors into the market or social changes (economic improvements, health crises) that affect demand in the short and medium term. In this case, since the data are simulated, the results are acceptable even for long-term projections. However, for the reasons given above, it will generally only be safe to forecast a few weeks beyond the last day for which data are available.

### 7.1. Demand projection

As explained in section 2, we have considered the time series consisting of total demand for each check-in day of the in-sample period and studied its future projection. To do so, we have adjusted the seriesβ both annual and weekly seasonality, and predicted its trend using the Holt-Winters exponential smoothing method. The result of this projection is shown in Figure 5.

Finally, after undoing the previous transformations, we obtain the total predicted demand for the forecast period. As we can see in Figure 6, in general the prediction is able to capture the annual seasonality, although in the months from March to June the actual demand is somewhat lower. On the other hand, it is generally observed that the predicted series presents weekly peaks that mainly coincide with those of the real series. However, in general the latter exhibits larger fluctuations that the model is not able to adjust.

### 7.2. Form of the demand according to the time in advance

Figure 7 shows the fraction of total reservations made at each advance time for each season considered in the data. In this case we assume that reservations are allowed from π = 10 days before the day of arrival.

In general, demand is concentrated on the days closest to the day of check-in. This tendency is accentuated in the lower seasons, when more than 50% of reservations are made on the same day of check-in. On the other hand, in the higher seasons, demand is distributed somewhat more evenly throughout the booking period, as clients generally book more in advance.

This demand shape calculated from historical data is considered to not change much in the short term.This, it is used, together with the forecasted demand size, to simulate demand in the forecast period, as shown in section 7.4.

### 7.3. Effect of price on demand

We have studied the effect of price on demand from the in-sample period onwards. As shown in Figure 2, a linear regression of total demand on average price would result in a positive slope, contradicting the law of demand. Therefore, we instead estimated the effect of normalized price on normalized demand, where both quantities were divided by reference values.

A linear regression has been considered for each labelled period in the data, in order to detect different patterns depending on the season. Similarly, different regressions could have been performed for different days in advance or different days of the week. However, due to the limited volume of data, such a detailed analysis could result in an excessive dispersion in the coefficients. As can be seen in Figure 8, after normalization we obtain a **negative effect of price on demand** in all cases, thus matching the law of demand.

### 7.4. Optimal pricing strategy

First, we performed π = 100 Monte Carlo simulations for the demand in the period to be predicted. Each simulation has a demand value for each check-in day (all days of the year 2012) and each possible value of advance (from 0 to 10 days, both included). Figure 9 shows some results of the simulations.

From these simulations, we search for the optimal price using the evolutionary strategy explained in Section 6. In this case, we find that the optimal price is given by the set of parameters () = (1.279, 0.801, 0.979, 0.146). The resulting multipliers are shown in Figure 10.

It can be seen that the recommended price varies considerably depending on the number of rooms available. In fact, the availability multiplier is almost twice as high when the hotel is almost full (few rooms available) as compared to when it is empty (πΆ = 100 rooms available).

Regarding the advance multiplier, we see it is recommended to keep the price very close to the reference value, slightly increasing its value until one day before check-in. A large discount is offered for the day of arrival in order to obtain a higher last day demand.

In Figure 11, we compare the actual results with the results that would be expected to be obtained with this pricing policy, for a particular check-in day. Note that we assume a demand response in line with that estimated in section 6.2. As an example, July 7, 2012, corresponding to a very high season Saturday, is shown.

As seen in the top panel, the model recommends a generally lower price than the one currently being charged. This is due to the fact that the reference price has been calculated as a seasonal average from historical data. The dataset presents an increasing trend, so the in-sample period price is lower than that in the forecast period.

On the other hand, we observe that a price decrease is recommended on the same day of check-in, according to the advance multiplier. The middle panel shows that this decrease results in a much higher demand on the day of check-in. As can be seen in the lower panel, despite charging a lower price, a higher overall profit is obtained by using the recommended strategy.

The behavior described is similar for all seasons and days of the week: the recommended price is lower than the current price. Intuitively, the increase in demand is expected to compensate for the lower price and thus the expected total profit than the actual one. It must be noted that our dataset is actually a simulation, in which the pricing strategy was not intended to be optimal. In particular, this strategy only takes into account a multiplier based on the number of rooms available and not on booking advance.

Figure 12 compares the results obtained using the optimal strategy and the current strategy for each check-in day in February and March.

Again, the top panel shows that the recommended average price per room is lower to the one actually charged. This discount causes the expected demand to be significantly higher than the actual demand, as observed in the middle panel. Finally, the bottom panel shows that total profits are generally higher using the optimal pricing strategy than those achieved with the current strategy, which proves that the expected increase in demand compensates the lower rates and thus the strategy is optimal.

Finally, we have computed the expected total profit using the proposed strategy, which corresponds to the average obtained over all the Monte Carlo simulations. On the other hand, the actual total profit obtained in the forecast period (year 2012) has been calculated in order to compare the results. Table 1 summarizes the results obtained.

Actual profit | Expected profit | Percentage of increase | |

Mean value | $990,953 | $1,062,903 | 7.16% |

Standard deviation | β | $12,741 | 1.29% |

**Table 1.**Actual and expected total profits using the proposed strategy. The mean value and standard deviation over all Monte Carlo simulations are shown.

The proposed strategy is expected to increase total benefits by an average of around 7%. Taking into account the standard deviation over all simulations, the expected total benefit is between 6 and 8% above the total profit obtained with the current basic pricing strategy.

## 8. Conclusions and future work

In this article we have presented a demand forecasting model and a dynamic pricing strategy in the hotel context.

First, demand has been modeled as the product of two functions: the total demand size, which depends on the day of check-in, and the shape of demand according to the time in advance. After a previous step of deseasonalization, we have forecasted the demand size series using the Holt-Winters exponential smoothing method. After reintroducing seasonality in the projected series, we have seen that the prediction reasonably approximates the real demand in the forecast period. On the other hand, we have calculated the shape of the demand from the historical data, differentiating by each seasonality period. Using these two functions, we simulated the future demand for each check-in day and booking day using the Monte Carlo method.

On the other hand, the effect of price on demand has been inferred from historical data. In order to obtain a negative elasticity, both variables have been normalized with respect to reference values. Then, normalized demand has been linearly fitted on normalized price for each seasonal period, obtaining negative slopes in all cases.

This information was then used to calculate the optimal price to be set to maximize profits in the study period. To do this, a parametric model for the price has been presented, based on multipliers according to the lead time and the number of rooms available. We have reproduced the inferred effect of the price on the previously simulated reference demand, and in this way we have calculated the expected profits with each choice of multiplier parameters. Using an evolutionary strategy we calculated the best set of parameters, and found that it is indeed expected to improve the results obtained with the current strategy.

Finally, it is worth mentioning that this study can be extended in several directions. To begin with, we could consider a data set with information broken down to a booking. For example, if we have information such as the number of nights or the number of rooms in each reservation, we can infer the distribution of these variables and include them in our simulation. We could also try to include multipliers for these variables in the optimal pricing model, for example based on discounts for long stays or large groups. Of course, different predictions can also be considered for different types of rooms and, if we have a segmentation of customers, the price elasticity of demand for each segment can be studied in a differentiated way.

On the other hand, more complex models could be used for the various problems that have been addressed throughout the paper. For example, algorithms based on recurrent neural networks can be used to predict future demand. Non-linear models can also be considered to estimate the effect of demand on price, taking into account saturation effects for very high and very low prices.

Lastly, one could add complexity to the multiplier model that has been used for price, for example by adding more multipliers if we have more variables, as discussed above. However, one could consider a completely different parametric model, or even non-parametric models that would require solving an optimization problem in order to find the optimal price for each day.