# An Integrated Capacity Allocation and Dynamic Pricing Model Designed for Air Cargo Transportation
## 2 Materials, Methods, and Models
### Dynamic Pricing
Actual data for the past period and results from the demand forecast for the future period. Total load factor: It shows the total load factor of the aircraft. It takes a value between 0 and 1. For the past period, actual data are used, and for the next period, the load factor generated by the results from the demand forecast is used. Real-time tonnage: Indicates the instantaneous total tonnage on board the aircraft at the time of the sales request. Real-time load factor: It shows the load factor of the aircraft's cargo capacity at the time of the sales request. It takes a value between 0 and 1. Minimum price: It shows the lowest price (USD) that can be offered for the selected departure and destination points during the period in which the flight will take place. Maximum Price: It shows the highest price (USD) that can be offered for the selected departure and destination points during the period in which the flight will take place. Revenue: It shows the revenue per AWB (Air Waybill) in USD. Past period data were used to train the model. The assumptions on which our study is based are as follows:  
Overbooking and cancellations are excluded. Discounts are not included in the model. The scheduled flight is assumed to operate on the date and route specified. Pricing is based on general cargo. Pricing of ancillary services is not included in the model. It is assumed that market conditions remain stable, excluding trade wars, pandemics, congestion in other modes of transport, and other extraordinary movements that may affect airfreight prices. The dynamic pricing model is applied to bookings made up to 30 days prior to the scheduled flight. We need a model that provides real-time pricing recommendations based on the inputs we provide. It is essential that the model can adapt to changing conditions and revise its output accordingly. Before looking at the results of the model, let us look at the SARSA algorithm in more detail. SARSA algorithm: The goal of reinforcement learning, a machine learning method designed to associate environmental states with actions, is to autonomously make decisions that maximize the expected cumulative payoff. The SARSA algorithm, one of the reinforcement learning algorithms, updates the value of each situation according to the current action and the action to be taken [31]. The basic principle of the algorithm is summarized by the acronym 'SARSA', which represents the sequence of events. 'S--State', 'A--Action', 'R--Reward', 'S--State', and 'A--Action'. In the algorithm, an agent connects from a given state and then performs a new action. After the action, it receives a reward and moves to the new state [32]. The computed values for the next state and action pairs are denoted as Q(s, a). A Q table is created with the calculated Q(s, a) values. An intelligent agent continuously updates the values in the Q-table and interacts with the environment in an iterative process. In this way, the agent makes decisions using probability-weighted greedy strategies that are a combination of the current Q-table values, previous experience, and the current situation [31]. The SARSA algorithm consists of the following steps:  
Initialisation: An initial state is usually chosen randomly, and the action is decided. Action implementation: The chosen action is implemented in the environment. The action results in a new state and a reward. New action selection: A new action is selected using existing policies. Learning: Q-values are updated using past action and new action information. The SARSA algorithm updates the Q-value using the formula in Equation (4) [33]. \[\text{Q}\left(\text{s},\text{a}\right)=\text{Q}\left(\text{s},\text{a}\right)+ \alpha\left[\text{r}+\gamma\text{Q}\left(\text{s}^{\prime},\text{a}^{\prime} \right)-\text{Q}\left(\text{s},\text{a}\right)\right]\] (4) where s is the current state, a is the current action, s\({}^{\prime}\) is the new state, a\({}^{\prime}\) is the new action, r is the reward, \(\alpha\) is the learning rate, and \(\gamma\) is the discount factor for future rewards. 5.