Air ticket sales volume prediction model construction method, system and electronic device
By constructing an air ticket sales forecasting model and utilizing particle swarm optimization and random forest models, the problems of low efficiency and high labor costs in air ticket sales forecasting were solved, achieving efficient and accurate air ticket sales forecasting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGLONG (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2026-04-22
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies for predicting airfare sales are inefficient and costly in terms of manpower, and relying on manual analysis of historical flight information leads to inefficiency and insufficient accuracy.
An air ticket sales prediction model is adopted, and the model parameters are iteratively optimized by the basic particle swarm optimization algorithm. The initial air ticket sales prediction model is constructed by combining the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the mean air ticket demand. The second objective random forest model is then used for prediction.
It has achieved automation and accuracy in predicting air ticket sales, significantly improving forecasting efficiency and accuracy, reducing labor costs, and enabling batch processing of forecasting tasks for multiple flights and routes.
Smart Images

Figure CN122089378A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aviation information technology, specifically to a method, system, and electronic device for constructing a flight ticket sales prediction model. Background Technology
[0002] As a core component of the transportation system, the level of revenue management in the air passenger transport industry directly impacts airlines' operating efficiency and market competitiveness. Ticket pricing, a crucial aspect of revenue management, requires precise matching of market demand fluctuations throughout the entire sales cycle to maximize revenue while ensuring capacity utilization.
[0003] However, currently, determining ticket sales volume at different times involves relevant staff collecting historical flight information and then analyzing and predicting ticket sales volume for the next period, which is inefficient and has high labor costs. Summary of the Invention
[0004] This invention aims to address one of the technical problems in related technologies to a certain extent. To this end, this invention provides a method, system, and electronic device for constructing an airline ticket sales forecasting model, which has the advantages of improving work efficiency and reducing labor costs.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: A method for constructing an airline ticket sales forecasting model includes: Obtain historical sales information for each flight within the historical sales period; The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage; Based on the historical sales information, an initial airfare sales prediction model is constructed, including: The historical airfare price, the sales stage identifier, and the historical reference airfare price are used as input data, and the historical airfare sales volume is used as a label. The initial air ticket sales prediction model is trained by using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the mean air ticket demand as model parameters. The model parameters are iteratively optimized using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target airfare sales volume prediction model.
[0006] In some feasible implementations, the step of iteratively optimizing the model parameters using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, to generate a target airfare sales prediction model, includes: The position vector of each particle is constructed based on the cumulative parameter of ticket demand over time, the price elasticity coefficient, and the initial value of the mean of ticket demand. Determine the particle velocity vector for each particle; The position vector of each particle is used as the model parameter of the initial air ticket sales prediction model to calculate the predicted air ticket sales for each particle. The error between the predicted ticket sales volume and the corresponding historical ticket sales volume is used as the fitness value; Based on the fitness value of each particle, update the individual optimal position vector of each particle and the global optimal position vector of all particles. Based on the particle velocity vector of each particle, the individual optimal position vector, and the global optimal position vector, the particle velocity vector of each particle is updated, and the target particle velocity vector is determined. The position vectors of each particle are updated based on the position vectors of each particle and the velocity vector of the target particle, and the target position vector is determined. The target position vector of each particle is used as the model parameter of the initial air ticket sales prediction model. The corresponding predicted air ticket sales are recalculated until the number of iterations of the basic particle swarm optimization algorithm is not less than the preset number. Then, the global optimal position vector is used as the target parameter combination of the air ticket sales prediction model to generate the target air ticket sales prediction model.
[0007] In some feasible implementations, the step of constructing an initial air ticket sales volume prediction model based on the historical sales information further includes: The initial airfare sales prediction model is constructed based on the following formula: , , Indicates the flight before takeoff Forecasted daily airfare sales This represents the average demand for air tickets. Indicates the first Stage identifiers for each sales phase. , This represents the cumulative sales demand over time for sales stages 0 through 3. This represents the cumulative sales demand over time for sales stages 4 through 14. This represents the cumulative sales demand over time for sales stages 15 to 18. This represents the price elasticity coefficient of airfares in the 0th to 3rd sales stages. This represents the price elasticity coefficient of airfares in sales stages 4 through 14. This represents the price elasticity coefficient of airfares during the 15th to 18th sales phases. Indicates the first Airfare prices at each sales stage This indicates the reference airfare price. This represents the sum of the cumulative parameters of sales demand over time at each sales stage during the sales period, without considering the price elasticity coefficient of airfares.
[0008] In some feasible implementations, after iteratively optimizing the model parameters using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number to generate the target airfare sales prediction model, the method further includes: Obtain historical sales information corresponding to the current sales period of the flight to be predicted, as well as the reference ticket price corresponding to the flight to be predicted; The current sales period includes multiple sales stages divided in chronological order; The historical sales information includes historical airfare prices corresponding to each of the aforementioned sales stages; Based on the historical airfare prices corresponding to each sales stage, determine the airfare price range for each sales stage; Input the airfare price, stage identifier, and reference airfare price from the airfare price range for each sales stage into the target airfare sales volume prediction model; Based on the target air ticket sales volume prediction model, the predicted air ticket sales volume is output corresponding to the air ticket price at each sales stage; Based on the ticket prices at the sales stage and the corresponding predicted ticket sales volume, determine the target ticket price and the target ticket sales volume; Based on the target ticket price and target ticket sales volume at each sales stage, generate and output a list of ticket prices and a list of ticket sales volume.
[0009] In some feasible implementations, determining the target ticket price and target ticket sales volume based on the ticket prices at each sales stage and the corresponding predicted ticket sales volume includes: Obtain the total number of available seats for the flight to be predicted; For each sales stage, determine the larger value of the product of the ticket price and the corresponding predicted ticket sales volume; The larger value of the airfare at each sales stage is used as the candidate airfare price, and the predicted airfare sales volume is used as the candidate airfare sales volume. If the sum of the candidate ticket sales volume in all sales stages is not greater than the total number of available seats, the candidate ticket price in each sales stage shall be used as the target ticket price, and the candidate ticket sales volume shall be used as the target ticket sales volume. If the sum of the candidate ticket sales volume in all sales stages is greater than the total number of available seats, the total number of available seats is used as a constraint to construct a price-sales-volume dynamic programming equation based on ticket prices and predicted ticket sales volume. Solve the dynamic programming equation for price and sales volume to determine the target ticket price and target ticket sales volume corresponding to each sales stage.
[0010] In some feasible implementations, generating and outputting a list of ticket prices and a list of ticket sales based on the target ticket price and the target ticket sales volume at each sales stage includes: Based on the departure date, flight identifier, reference ticket price, target ticket price, stage identifier, and sales date of the flight to be predicted, construct a target input feature vector corresponding to each sales stage; The target input feature vectors corresponding to each sales stage are input into the second objective random forest model; The second objective random forest model is used to output the target predicted air ticket sales volume corresponding to each sales stage; Obtain the historical target ticket price corresponding to each sales stage of the flight to be predicted, and the historical target ticket sales volume corresponding to the historical target ticket price; The first revenue is determined based on the target ticket price and the target ticket sales volume; The second revenue is determined based on the target ticket price and the target projected ticket sales volume for each sales stage; The third revenue is determined based on the historical target ticket price and the historical target ticket sales volume; If both the first and second revenues are greater than the third revenue, a list of ticket prices and a list of ticket sales volumes are generated and output based on the target ticket prices and target ticket sales volumes for each sales stage.
[0011] In some feasible implementations, constructing a target input feature vector corresponding to each sales stage based on the departure date of the flight to be predicted, the flight identifier, the reference ticket price, the target ticket price for each sales stage, the stage identifier, and the sales date includes: A price feature vector is generated by concatenating the target ticket price and the reference ticket price for each of the sales stages in chronological order. Generate price identifier feature vectors and sales volume identifier feature vectors corresponding to each of the aforementioned sales stages; Wherein, the price identifier feature vector and the sales volume identifier feature vector are both 0 / 1 vectors with a dimension equal to the number of sales stages, the position feature corresponding to the sales stage takes a value of 1, and the other positions take a value of 0; The time weight of each sales stage is determined based on the departure date of the flight to be predicted and the sales date of each sales stage. Based on each of the aforementioned sales stages, the flight identifier, the price feature vector, the corresponding price identifier feature vector, the corresponding sales volume identifier feature vector, and the corresponding time weight are concatenated to generate the target input feature vector for each of the aforementioned sales stages.
[0012] In some feasible implementations, the second objective random forest model is obtained based on the following steps: Based on the flight identifier, historical reference ticket price, historical departure date, historical ticket price at each sales stage, and historical ticket sales volume, construct multiple historical input feature vectors; Each of the historical input feature vectors is used as sample data, and the historical air ticket sales volume corresponding to each sales stage is used as a label. The sample data is then divided into training data and test data. The initial random forest model is trained based on the training data until the number of node samples of the decision tree in the initial random forest model is less than a preset threshold, or the number of features available for feature splitting at the node is exhausted, thus obtaining the first target random forest model. The first objective random forest model was tested based on the test data to obtain test results; wherein, the test results include the predicted air ticket sales volume; The evaluation metrics for the first objective random forest model are determined based on the predicted ticket sales volume and the corresponding historical ticket sales volume. If the evaluation index meets the preset conditions, the first objective random forest model will be used as the second objective random forest model.
[0013] Secondly, the present invention also provides a system for constructing an air ticket sales volume prediction model, comprising: The acquisition module is used to obtain historical sales information for each flight during the historical sales period; The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage; The construction module is used to build an initial air ticket sales volume prediction model based on the historical sales information, including: The data processing unit is used to take the historical ticket price, the sales stage identifier, and the historical reference ticket price as input data, and the historical ticket sales volume as a tag; The training unit is used to train the initial air ticket sales prediction model by using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the average air ticket demand as model parameters. The optimization module is used to iteratively optimize the model parameters using the basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target air ticket sales volume prediction model.
[0014] Thirdly, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method for constructing a ticket sales volume prediction model as described in any of the above claims.
[0015] In this invention, an initial airfare sales volume prediction model is constructed by using historical airfare prices, corresponding sales stage identifiers, and historical reference airfare prices as input data, and historical airfare sales volume as labels, thus automating the prediction process. Compared to existing technologies that rely on manual collection and analysis of historical flight information by staff, this invention embeds the prediction logic into the model, avoiding the subjectivity and experience dependence of manual analysis, and significantly improving the objectivity and stability of the prediction results. Simultaneously, this invention employs a basic particle swarm optimization algorithm to optimize the model parameters until the number of iterations reaches a preset condition. Through this technique, the airfare sales volume prediction model can automatically search for the optimal parameters for cumulative demand over time, price elasticity coefficient, and average airfare demand, enabling the model to accurately fit the market demand patterns of different sales stages. Compared to manual experience-based judgment or simple statistical methods, the particle swarm optimization algorithm can efficiently find the global optimal solution in a high-dimensional parameter space, avoiding the efficiency loss and insufficient accuracy problems caused by manual trial and error adjustments, thereby significantly improving the accuracy of the target airfare sales volume prediction model in predicting airfare sales volume.
[0016] In addition, since the model can automatically output predicted ticket sales volume based on the input ticket price, stage indicator, and ticket reference price after training, it eliminates the need for repeated manual intervention in the data analysis process, thus effectively reducing labor costs. At the same time, the model can batch process prediction tasks for multiple flights and routes, overcoming the shortcomings of large workload and long time consumption when manually processing massive amounts of data, and significantly improving prediction efficiency.
[0017] These features and advantages of the present invention will be disclosed in detail in the following specific embodiments and accompanying drawings. The preferred embodiments or means of the present invention will be shown in detail in conjunction with the accompanying drawings, but are not intended to limit the technical solutions of the present invention. In addition, each of these features, elements and components appearing in the following text and drawings is a plurality of, and different symbols or numbers are used for convenience of representation, but all represent parts with the same or similar construction or function. Attached Figure Description
[0018] The present invention will be further described below with reference to the accompanying drawings: Figure 1 A flowchart illustrating a method for constructing an air ticket sales volume prediction model provided by the present invention; Figure 2 This is a flowchart illustrating the iterative optimization of model parameters for a flight ticket sales prediction model using a basic particle swarm optimization algorithm, as provided by the present invention. Figure 3 This is a flowchart illustrating a process for determining the sales volume of a flight ticket to be predicted based on a target ticket sales volume prediction model, provided by the present invention. Figure 4 This invention provides a flowchart illustrating how to determine the target ticket price and target ticket sales volume for each sales stage based on the total number of available seats. Figure 5 This is a flowchart illustrating a process for generating a list of airfare prices and a list of airfare sales based on a second-objective random forest model, as provided by the present invention. Figure 6 This is a flowchart illustrating the process of constructing a target input feature vector provided by the present invention. Figure 7 This is a schematic diagram illustrating the training process of an initial random forest model provided by the present invention. Figure 8 This is a structural schematic diagram of an electronic device provided by the present invention.
[0019] Explanation of reference numerals in the attached figures: 101: Processor; 102: Memory; 103: I / O interface; 104: Bus. Detailed Implementation
[0020] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described are intended to explain the present invention and should not be construed as limiting the invention.
[0021] The terms "an embodiment," "example," or "trademark" used in this specification refer to a particular feature, structure, or characteristic described in connection with the embodiment itself that may be included in at least one embodiment disclosed in this invention. The phrase "in an embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment.
[0022] As a first aspect of the present invention, a method for constructing an air ticket sales volume prediction model is provided, such as... Figure 1 As shown, the method includes: In step S110, historical sales information for each flight during the historical sales period is obtained.
[0023] The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage.
[0024] In this embodiment, since passengers at different times have different price sensitivities and booking habits, such as price-sensitive leisure travelers or long-haul travelers with plans 35-60 days before flight departure, and business travelers or travelers with urgent travel needs 0-7 days before flight departure, their demand is extremely rigid and their price elasticity is low. Therefore, in order to capture the differences in passenger behavior at different sales periods and to accurately predict the market demand for air tickets in different time periods, the 60-day sales period of the flight can be divided into 18 sales stages, as shown in Table 1. Table 1 is a schematic table of the divided sales stages.
[0025] Table 1
[0026] After obtaining historical sales information for different flights during their historical sales period, the historical sales information can be classified according to dimensions such as season and route to ensure that flights of the same type have similar demand patterns and to remove outliers in historical ticket prices and historical ticket sales volumes.
[0027] In step S120, an initial air ticket sales prediction model is constructed based on the historical sales information, including: The historical airfare price, the sales stage identifier, and the historical reference airfare price are used as input data, and the historical airfare sales volume is used as a label. The initial air ticket sales prediction model is trained using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the mean air ticket demand as model parameters.
[0028] In this embodiment, when constructing an initial air ticket sales volume prediction model based on historical sales information, the initial air ticket sales volume prediction model can be constructed based on the following formula: (1), (2), Indicates the flight before takeoff Forecasted daily airfare sales This represents the average demand for air tickets. Indicates the first Stage identifiers for each sales phase. , This represents the cumulative sales demand over time for sales stages 0 through 3. This represents the cumulative sales demand over time for sales stages 4 through 14. This represents the cumulative sales demand over time for sales stages 15 to 18. This represents the price elasticity coefficient of airfares in the 0th to 3rd sales stages. This represents the price elasticity coefficient of airfares in sales stages 4 through 14. This represents the price elasticity coefficient of airfares during the 15th to 18th sales phases. Indicates the first Airfare prices at each sales stage This indicates the reference airfare price. This represents the sum of the cumulative parameters of sales demand over time at each sales stage during the sales period, without considering the price elasticity coefficient of airfares.
[0029] Specifically, for the same type of flight, the average historical ticket sales volume of each sales stage throughout the entire historical sales period can be used as the initial value of the average ticket demand. The initial value of the cumulative ticket demand over time parameter can be determined by uniform random sampling within the interval [0,6], and the initial value of the price elasticity coefficient can be determined by uniform random sampling within the interval [-5,0]. After obtaining the initial values of the average ticket demand, the cumulative ticket demand over time parameter, and the price elasticity coefficient, the historical ticket price, the corresponding sales stage identifier, and the historical reference ticket price can be used as input data, the corresponding historical ticket sales volume as the label, and the cumulative ticket demand over time parameter, price elasticity coefficient, and average ticket demand as model parameters to train the initial ticket sales volume prediction model.
[0030] In step S130, the model parameters are iteratively optimized using the basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target air ticket sales volume prediction model.
[0031] It is worth mentioning that the model parameters of the initial air ticket sales forecasting model are complex nonlinear functions that integrate the average air ticket demand, the cumulative parameters of sales demand over time in different stages, and the air ticket price elasticity coefficient. This makes the initial air ticket sales forecasting model have the following characteristics, making it difficult to iteratively optimize the model parameters using traditional gradient descent or least squares methods: 1. Non-convexity and multimodality: The loss function may have multiple local optima in the parameter space of the model parameters. Traditional gradient-based optimization methods are prone to getting trapped in local optima and thus cannot find the global optimum. 2. High parameter coupling: The initial airfare sales prediction model... The complex combination of multiple sales demand parameters accumulated over time leads to mutual influence between parameters, making it difficult to solve directly using analytical methods; 3. Lack of explicit gradient information: The initial air ticket sales prediction model is complex in form, making it difficult to directly derive the gradient expression of the loss function with respect to each parameter. Therefore, it is difficult to iteratively optimize the model parameters using the gradient descent method.
[0032] Therefore, in this embodiment, during the training of the initial airfare sales prediction model, the model parameters can be iteratively optimized using the basic particle swarm optimization algorithm, as detailed below. Figure 2 As shown, Figure 2 This is a flowchart illustrating the iterative optimization of model parameters for the airfare sales prediction model using a basic particle swarm optimization algorithm. Step S130 specifically includes: In step S210, the position vector of each particle is constructed based on the cumulative parameter of the ticket demand over time, the price elasticity coefficient, and the initial value of the mean of the ticket demand.
[0033] In this embodiment, the particle's position vector can be defined as a 7-dimensional vector, corresponding sequentially to... , , , , , , In the vector, the value of each dimension represents the position of the particle in the solution space of the corresponding parameter dimension.
[0034] The solution space for the mean demand for air tickets can range from 0 to 200, the solution space for the cumulative sales demand over time can range from 0 to 6, and the solution space for the price elasticity coefficient of air tickets can range from -5 to 0. This embodiment does not impose any special restrictions on these values.
[0035] For example, before performing the optimization iteration, i.e., at the current iteration number... When it is 0, for For example, with 20 particles, we can randomly sample values within the solution space corresponding to each model parameter to obtain the initial values of each model parameter. These initial values are then used as feature values for each dimension of the position vector, and the i-th particle is... The particles in the iteration number The position vector when it is 0 is denoted as , The value range is 1 to .
[0036] In step S220, the particle velocity vector of each particle is determined.
[0037] In this embodiment, the particle velocity vector is a multi-dimensional velocity vector whose dimension perfectly matches the particle position vector. Its dimension is consistent with the number of model parameters to be optimized, and the velocity component of each dimension corresponds to the position update step size and direction of the particle in that model parameter dimension.
[0038] For example, before performing the optimization iteration, i.e., at the current iteration number... When it is 0, for For example, with 20 particles, the initial velocity values of each model parameter can be randomly sampled within the velocity range to determine the initial velocity values. Based on the position of each model parameter in the position vector, the initial velocity values of each model parameter are sequentially concatenated to obtain the particle velocity vector of each particle. The particle velocity vector is then set as follows: The particles in the iteration number The particle velocity vector when it is 0 is denoted as .
[0039] The velocity value can be limited to -1 to 1 to avoid the particle movement step being too large, which could lead to the search going out of control.
[0040] In step S230, the position vector of each particle is used as the model parameter of the initial air ticket sales prediction model, and the predicted air ticket sales corresponding to each particle are calculated.
[0041] For example, in the current iteration number When the value is 0, the position vector of each particle is determined. and particle velocity vector Then, fixed parameters in the basic particle swarm optimization algorithm can be set, such as the inertia weight. Set to 0.8, learning factor and Set all values to 2 to set the maximum number of iterations. The value is set to 10, and each particle is treated as a set of independent model parameters to be optimized.
[0042] Subsequently, during the first iteration of optimization, the position vector of each particle was... The optimal initial position of this particle. It uses historical airfare prices, corresponding sales stage identifiers, and historical reference airfare prices as input data for each particle. Substitute the data into the initial air ticket sales prediction model to calculate the predicted air ticket sales volume for each particle.
[0043] In step S240, the error between the predicted ticket sales volume and the corresponding historical ticket sales volume is used as the fitness value.
[0044] In this embodiment, minimizing the error between the predicted ticket sales volume and the corresponding historical ticket sales volume can be taken as the core optimization objective of the basic particle swarm optimization algorithm, and a fitness function can be constructed as follows: (3), in, The fitness value represents the predicted ticket sales volume. Corresponding historical air ticket sales volume The mean absolute error, This represents the number of training samples consisting of input data and labels. The smaller the value, the higher the prediction accuracy of the corresponding model parameter combination.
[0045] For example, after obtaining the predicted ticket sales volume corresponding to the position vector of each particle, the fitness value of each particle after the first iteration of optimization can be calculated using formula (3). .
[0046] In step S250, the individual optimal position vector of each particle and the global optimal position vector of all particles are updated according to the fitness value of each particle.
[0047] For example, in step S240, the fitness value of each particle is determined. After that, it is possible to obtain from all particles Select The smallest particle position vector, as Global optimal position of each particle At the same time, update the current iteration count to 1.
[0048] In step S260, based on the particle velocity vector of each particle, the individual optimal position vector, and the global optimal position vector, the particle velocity vector of each particle is updated to determine the target particle velocity vector.
[0049] For example, after completing step S250, the particle velocity vector of each particle can be updated based on the particle velocity vector of each particle, the individual optimal position vector, the global optimal position vector, and the velocity update formula, so as to determine the target particle velocity vector of each particle.
[0050] As a preferred implementation, the speed update formula (4) is as follows: (4), Indicates the first The particle in the first The particle velocity vector during the next iteration of optimization, i.e., the target particle velocity vector. Indicates the first The particle in the first The particle velocity vector during the next iteration of optimization. Indicates the first The particle in the first The optimal position of an individual during the iteration optimization. Indicates the first The globally optimal position vector during the iteration optimization. It represents a random number in the range [0, 1].
[0051] Among them, When it is 0, for During the first... In the next iteration, each particle's Compare it with the particle's fitness value at the previous time step. If If it is smaller, then the individual optimal position vector of the particle is updated to... Otherwise keep And from the updated individual optimal position vector of all particles The position vector of the particle with the smallest fitness value is selected and compared with the global optimal position vector at the previous time step. The fitness values are compared, and if the former is smaller, the global optimal position vector is updated to the latter. Otherwise keep .
[0052] In step S270, the position vectors of each particle are updated based on the position vectors of each particle and the velocity vector of the target particle to determine the target position vector.
[0053] Specifically, after determining the target particle velocity vector for each particle, the position vector of each particle can be updated using the position update formula (5) to determine the target position vector, i.e.: (5), Where, if the target position vector If the solution space is exceeded, then the target position vector Truncation is performed to confine it to the solution space.
[0054] In step S280, the target position vector of each particle is used as the model parameter of the initial air ticket sales prediction model, and the corresponding predicted air ticket sales are recalculated until the number of iterations of the basic particle swarm optimization algorithm is not less than the preset number. Then, the global optimal position vector is used as the target parameter combination of the air ticket sales prediction model to generate the target air ticket sales prediction model.
[0055] For example, after completing the above operations, the historical airfare price, the corresponding sales stage identifier, and the historical reference airfare price are then used as input data, along with the target position vector for each particle. The predicted ticket sales volume is then substituted into the initial ticket sales volume prediction model as model parameters to calculate the predicted ticket sales volume for each particle. Finally, the predicted ticket sales volume and the corresponding historical ticket sales volume are substituted into the fitness function to calculate the fitness value of each particle at the target position vector. Next, each particle's... Compare it with the particle's fitness value at the previous time step. If If it is smaller, then the individual optimal position vector of the particle is updated to... Otherwise keep And from the updated individual optimal position vector of all particles The position vector of the particle with the smallest fitness value is selected and compared with the global optimal position vector at the previous time step. The fitness values are compared, and if the former is smaller, the global optimal position vector is updated to the latter. Otherwise keep Repeat the above steps and determine the current iteration number of the update. Is it not less than the maximum number of iterations? If it is less than, then the result obtained in this iteration will be... , , , As new prerequisite data, the particle velocity and position vectors are iteratively updated. If the velocity and position vectors are not less than the specified values, the basic particle swarm optimization algorithm terminates, and the current globally optimal position vector of the particle swarm is output. , This refers to the optimal parameter combination of the trained airfare sales prediction model, which includes the optimal... , , , , , , .
[0056] In this embodiment, an initial airfare sales volume prediction model is constructed by using historical airfare prices, corresponding sales stage identifiers, and historical reference airfare prices as input data, and historical airfare sales volume as labels, thus automating the prediction process. Compared with existing technologies that rely on manual collection of historical flight information and manual analysis for prediction, this invention embeds the prediction logic into the model, avoiding the subjectivity and experience dependence of manual analysis, and significantly improving the objectivity and stability of the prediction results. Simultaneously, this invention uses a basic particle swarm optimization algorithm to optimize the model parameters until the number of iterations reaches a preset condition. Through this technique, the airfare sales volume prediction model can automatically search for the optimal parameters for cumulative demand over time, price elasticity coefficient, and average airfare demand, enabling the model to accurately fit the market demand patterns of different sales stages. Compared to manual experience-based judgment or simple statistical methods, the particle swarm optimization algorithm can efficiently find the global optimal solution in a high-dimensional parameter space, avoiding the efficiency loss and insufficient accuracy problems caused by manual trial and error adjustments, thereby significantly improving the accuracy of the airfare sales volume prediction model in predicting airfare sales volume.
[0057] In addition, since the model can automatically output predicted ticket sales volume based on the input ticket price, sales stage indicator, and ticket reference price after training, it eliminates the need for repeated manual intervention in the data analysis process, thus effectively reducing labor costs. At the same time, the model can batch process prediction tasks for multiple flights and routes, overcoming the shortcomings of large workload and long time consumption when manually processing massive amounts of data, and significantly improving prediction efficiency.
[0058] After obtaining the trained ticket sales prediction model, in order to accurately predict the ticket sales volume of subsequent flights at different sales stages, further, as an optional real-time method, refer to... Figure 3 As shown, Figure 3 This is a flowchart illustrating a process for determining the sales volume of a flight ticket to be predicted based on a target ticket sales volume prediction model. Following step S130, the process further includes: In step S310, historical sales information corresponding to the current sales period of the flight to be predicted and reference ticket prices corresponding to the flight to be predicted are obtained.
[0059] The current sales period includes multiple sales stages divided in chronological order; The historical sales information includes historical airfare prices corresponding to each of the aforementioned sales stages.
[0060] Specifically, the historical sales information of the flight to be predicted can be extracted through the data acquisition module, including historical sales information for the same period, route, season, and flight type. Key information such as sales date, flight departure date, and historical ticket price can then be extracted from this historical sales information to obtain a historical price dataset. After obtaining the historical price dataset, the sales stage corresponding to the historical ticket price can be determined based on the sales date and flight departure date, resulting in a price sample set corresponding to each sales stage.
[0061] In step S320, the airfare price range for each sales stage is determined based on the historical airfare prices corresponding to each sales stage.
[0062] For example, after obtaining the price sample sets for each sales stage, the core statistical values of the price sample sets for each sales stage are calculated, including the historical minimum price, historical maximum price, historical mean price, historical median price, historical upper quartile, and historical lower quartile. The interquartile range method is then used to remove extreme abnormal prices such as temporary special offers and high-end customized tickets from the price sample sets, resulting in an optimized price sample set. After obtaining the optimized price sample sets corresponding to each sales stage, for each sales stage, the minimum ticket price in its optimized price sample set can be used as the initial price lower limit, and the maximum ticket price as the initial price upper limit. The initial price range for each sales stage is then obtained using the initial price lower limit and the initial price upper limit.
[0063] After obtaining the initial price range for each sales stage, the minimum and maximum prices of the routes for the flights to be predicted can be used to constrain and correct the initial price range. That is, if the lower limit of the initial price is not less than the minimum price of the route, the lower limit remains unchanged; otherwise, the minimum price of the route is used as the lower limit of the price. If the upper limit of the initial price is not greater than the maximum price of the route, the upper limit remains unchanged; otherwise, the maximum price of the route is used as the upper limit of the price. Thus, the corrected initial price range is used as the ticket price range for each sales stage.
[0064] After obtaining the airfare price range for each sales stage, multiple airfare prices corresponding to the airfare price range for each sales stage can be determined by using the upper price limit, lower price limit, and price deviation distance for each sales stage. The price deviation step can be set according to actual needs. For example, the price deviation distance for sales stage 1 to sales stage 3 can be 20, and the price deviation distance for sales stage 15 to sales stage 18 can be 50. This embodiment does not impose any special restrictions on this.
[0065] In step S330, the ticket price, stage identifier, and reference ticket price in each sales stage's ticket price range are input into the target ticket sales volume prediction model.
[0066] In step S340, based on the target ticket sales volume prediction model, the predicted ticket sales volume corresponding to the ticket price at each sales stage is output.
[0067] In step S350, the target ticket price and target ticket sales volume are determined based on the ticket price at the sales stage and the corresponding predicted ticket sales volume.
[0068] After obtaining the price range for each sales stage, for each sales stage, the airfare price in its price range, the corresponding stage identifier, and the reference airfare price can be input into the target airfare sales volume prediction model to obtain the predicted airfare sales volume output by the target airfare sales volume prediction model, which corresponds to the airfare price for each sales stage. Then, the target airfare price and target airfare sales volume for each sales stage can be determined from the multiple airfare prices and multiple predicted airfare sales volumes for each sales stage.
[0069] It should be noted that when determining the target ticket price and target ticket sales volume for each sales stage, since the total number of available seats for the flight to be predicted is a fixed value and the total number of available seats is shared by each sales stage, the sum of the predicted ticket sales volume for all sales stages should not exceed the total number of available seats for the flight to be predicted when determining the target ticket price and target ticket sales volume for each sales stage.
[0070] Therefore, to avoid overbooking of tickets, further, as an optional real-time method, refer to Figure 4 As shown, Figure 4 This is a flowchart illustrating the process of determining the target ticket price and target ticket sales volume for each sales stage based on the total number of available seats. Step S340 specifically includes: In step S410, the total number of available seats for the flight to be predicted is obtained.
[0071] In this embodiment, a mapping table of flights and the total number of available seats can be stored locally on the electronic device. When executing step S410, the total number of available seats corresponding to the flight to be predicted can be directly extracted from the mapping table. Alternatively, the total number of available seats for the flight to be predicted can be received from the user through human-computer interaction. This embodiment does not impose any special restrictions on this.
[0072] In step S420, for each sales stage, the larger value of the product of the ticket price and the corresponding predicted ticket sales volume is determined.
[0073] In step S430, the ticket price corresponding to the larger value of each sales stage is used as the candidate ticket price, and the predicted ticket sales volume is used as the candidate ticket sales volume.
[0074] In step S440, if the sum of the candidate ticket sales volumes in all sales stages is not greater than the total number of available seats, the candidate ticket price in each sales stage is taken as the target ticket price, and the candidate ticket sales volume is taken as the target ticket sales volume.
[0075] For example, after obtaining multiple ticket prices for each sales stage and the corresponding predicted ticket sales volume, the product of the ticket price and the corresponding predicted ticket sales volume can be calculated. The larger value of the product can then be selected, and the ticket price corresponding to the larger value for each sales stage can be used as the candidate ticket price, and the predicted ticket sales volume as the candidate ticket sales volume. After determining the candidate ticket sales volume for each sales stage, the sum of the candidate ticket sales volumes for all sales stages is calculated. If the sum of the candidate ticket sales volumes for all sales stages is not greater than the total number of available seats, the candidate ticket price for each sales stage can be used as the target ticket price, and the candidate ticket sales volume can be used as the target ticket sales volume.
[0076] In step S450, if the sum of the candidate ticket sales volume in all sales stages is greater than the total number of available seats, the total number of available seats is used as a constraint to construct a price-sales-volume dynamic programming equation based on the ticket price and the predicted ticket sales volume.
[0077] Correspondingly, when determining the target ticket price and target ticket sales volume for each sales stage, the sum of candidate ticket sales volumes for all sales stages may exceed the total number of available seats. In this case, the optimal ticket price for each sales stage cannot be directly applied independently; instead, global optimization is needed to coordinate the ticket sales volume for each sales stage to ensure that the total ticket sales volume does not exceed the total number of available seats. Therefore, as an optional real-time approach, when the sum of candidate ticket sales volumes for all sales stages exceeds the total number of available seats, the total number of available seats can be used as a constraint. A dynamic programming equation for price and sales volume can be constructed using the ticket price and the predicted ticket sales volume. That is, the dynamic programming equation for price and sales volume includes: (6), (7), in, This indicates the maximum revenue in the first sales phase. This indicates the airfare price in the first sales phase. This indicates the price range for air tickets in the first sales phase. This indicates that the ticket price for the first sales phase is... Forecasted airfare sales at that time This indicates the total number of remaining available seats in the first sales phase. Indicates the first Airfare price range for each sales stage Indicates the first Airfare prices at each sales stage Indicates the first The airfare price at each sales stage is Forecasted airfare sales at that time Indicates the first The total number of remaining available seats in each sales phase. Indicates the first The airfare price range for each sales stage is as follows: The total number of remaining available seats is At that time, sales stage 1 to sales stage The maximum benefit obtained, Indicates the first The price range for air tickets at each sales stage is as follows: The total number of remaining available seats is At that time, sales stage 1 to sales stage The maximum benefit achieved.
[0078] In step S460, the dynamic programming equation for price and sales volume is solved to determine the target ticket price and the target ticket sales volume corresponding to each sales stage.
[0079] After obtaining the dynamic programming equation for price and sales volume, based on the aforementioned sales stage division logic, sales stage 1, which is 0-1 days before departure, is the end of the sales process and has no subsequent sales stages. Its ticket price decision only needs to consider the total number of remaining available seats and ticket demand at sales stage 1, thus the optimal solution can be directly calculated as the initial base value for the entire recursive process. However, sales stage 18, as the starting point of the sales process, requires consideration of the capacity consumption and revenue of the subsequent 17 sales stages, and cannot be solved directly. Therefore, the dynamic programming equation for price and sales volume can be solved by combining the logic of available seat consumption with the state transition logic of reverse recursion in dynamic programming. The reasons are as follows: Assuming that the sales stage has been obtained Optimal revenue function from the start to the end of the sales phase Now we need to calculate the sales stage. Optimal payoff function During the sales stage At that time, the total number of remaining available seats was If you choose airfare Then the ticket sales volume is The profit obtained is Accordingly, the total number of remaining available seats becomes and will As a sales stage The total number of remaining available seats can be used to determine the sales stage. The maximum profit is This is because in actual sales, the sales stage... The sale occurs during the sales stage. Previously, during the sales stage The total number of remaining available seats is in the sales phase. The remaining number of available seats minus the sales stage The number of airline tickets sold. In the recursive formula, in calculating... At that time, based on each ticket price within its price range, the total number of remaining available seats after sales can be calculated, and then the system can be called... Function to control the sales stage The total number of remaining available seats and the sales stage The decision is tied to the sales stage. Conversely, if one tries to use the sales stage... The number of available seats remaining after all seats have been sold determines the sales phase. The total number of remaining available seats means that using decisions made in later sales stages to influence the total number of remaining available seats in earlier sales stages would violate the temporal causal order that the sales results of earlier stages should determine the total number of remaining available seats in later stages. Therefore, when solving the dynamic programming equation for price and sales volume, it is necessary to combine the consumption logic of the total number of available seats with the state transition logic of dynamic programming in reverse order.
[0080] To facilitate a better understanding of the solution in this embodiment, a specific example is provided below.
[0081] Specifically, assuming a total of 100 seats are available, the current sales period is divided into three sales phases: Phase 3, 5-6 days before departure; Phase 2, 3-4 days before departure; and Phase 1, 1-2 days before departure.
[0082] For sales phase 1, assuming the ticket price range for sales phase 1 is [300, 400], the sales phase 1... The value range of is [0, 100]. Assuming... The value is 50. When it is 300, The value is 40, and in this case, the profit is 12000; When it is 400, For 30, for all and Calculations were performed to obtain multiple revenue streams for sales phase 1. .
[0083] For sales phase 2, let's assume the airfare price range for sales phase 2. For [200, 250], the total number of all possible remaining available seats in sales phase 2. ,enumerate All airfare prices Corresponding forecast of airfare sales Calculate the optimal revenue for sales stage 2. ,Right now .
[0084] Assumption The value is 80. When it is 200, The revenue for stage 2 is 60, and the revenue for stage 2 is 12,000. The value is 20. Assuming the query finds... It is 5000, which can be confirmed. It is 17,000; When it is 250, The revenue for stage 2 is 45, and the revenue for stage 2 is 11250. The value is 35. Assuming the query finds... It is 6000, which can be confirmed. For all and Calculations were performed to obtain the revenue statement for sales stage 2. .
[0085] For sales stage 3, The value is 100, assuming the airfare price range is in sales stage 3. For [150, 180], the total number of all possible remaining available seats in sales phase 3. ,enumerate All airfare prices Corresponding forecast of airfare sales volume Assuming When it is 150, The revenue for stage 3 is 12,000, which is 80. The value is 20, query The revenue from sales phase 2 is determined to be 4000, and the total revenue is 16000; assuming... When it is 180, The revenue for stage 3 is 11,700, which is 65. The value is 35. Assuming the query... The revenue for sales phase 2 is determined to be 7000, and the total revenue is 18700.
[0086] After obtaining the price, by backtracking to the optimal strategy, we can determine that the ticket price for sales stage 3 is 180, and the predicted ticket sales volume is 65. The optimal price for sales stage 2 is 200, and the predicted ticket sales volume is 35. The maximum profit can be obtained when the predicted ticket sales volume for sales stage 1 is 0. Therefore, we can determine that the target ticket price for sales stage 3 is 180, and the target ticket sales volume is 65; the target ticket price for sales stage 2 is 200, and the target ticket sales volume is 30; and the target ticket sales volume for sales stage 1 is 0.
[0087] In this embodiment, when determining the target ticket price and target ticket sales volume for each sales stage, the total number of available seats for the flight to be predicted is first obtained. Then, for each sales stage, the larger value of the product of the ticket price and the corresponding predicted ticket sales volume is determined. The ticket price and predicted ticket sales volume corresponding to the larger value are used as candidate ticket prices and candidate ticket sales volumes for each stage. Finally, the target ticket price and target ticket sales volume are determined if the sum of the candidate ticket sales volumes for all sales stages is not greater than the total number of available seats. If the sum of the candidate ticket sales volumes for all sales stages is greater than the total number of available seats, a dynamic programming equation for price and sales volume is constructed. This equation is solved by combining the consumption logic of the total number of available seats with the state transition logic of dynamic programming in reverse order, thereby optimizing ticket pricing. This approach, based on maximizing revenue at each sales stage and using the total number of available seats as a core constraint, ensures that the pricing strategy aligns with the price and sales volume patterns of market demand at each stage while strictly matching the actual flight capacity. This avoids revenue losses and operational problems caused by sales estimates exceeding capacity. By combining a dynamic programming equation for price and sales volume to comprehensively and recursively solve for revenue throughout the entire sales cycle, it achieves a transformation from optimizing revenue in a single stage to optimizing overall revenue for the entire flight sales cycle. This effectively resolves the contradiction between single-stage optimization and overall revenue optimization in traditional pricing, significantly improving the fit between the dynamic ticket pricing scheme and the actual operational scenarios of air passenger transport. Furthermore, this constraint determination and objective value setting method provides clear decision variable boundaries and solution directions for the dynamic programming equation for price and sales volume, simplifying the model's solution complexity, improving the efficiency of finding the optimal price and sales volume list, and ensuring rapid output of the pricing scheme.
[0088] In step S360, a list of ticket prices and a list of ticket sales are generated and output based on the target ticket prices and the target ticket sales volume for each sales stage.
[0089] Understandably, when outputting lists of airfare prices and sales volumes, relying solely on a single model's predictions to determine pricing strategies can easily lead to forecasting biases, causing pricing schemes to deviate from actual market conditions. To compensate for the accuracy limitations of a single prediction model, further, as an optional real-time method, referencing... Figure 5As shown, Figure 5 This is a flowchart illustrating the process of generating a list of airfare prices and airfare sales based on a second-objective random forest model. Step S360 specifically includes: In step S510, a target input feature vector corresponding to each sales stage is constructed based on the departure date, flight identifier, reference ticket price, target ticket price, stage identifier, and sales date of the flight to be predicted.
[0090] It's worth noting that since the entire sales period for the flights to be predicted is divided into multiple sales phases, logically, a separate random forest model should be trained for each sales phase. However, training a separate random forest model for each sales phase would present the following problems: 1. The large number of models results in high training and maintenance costs; 2. The random forest model for each sales stage can only use the data of that sales stage. When the sample size is too small, overfitting is likely to occur. 3. Since the random forest model for each sales stage can only use the data of that sales stage, the trained random forest model cannot learn the common patterns and differences between different sales stages.
[0091] In view of this, to reduce the training and maintenance costs of random forest models, a single random forest model can achieve unified prediction of demand for all sales stages throughout the entire sales cycle. Furthermore, as an optional real-time method, refer to... Figure 6 , Figure 6 This is a flowchart illustrating the process of constructing a target input feature vector. Step S510 specifically includes: In step S610, the target ticket price and the reference ticket price for each of the sales stages are concatenated according to the time sequence of the sales stages to generate a price feature vector.
[0092] For example, after obtaining the target airfare price for each sales stage, the price feature vector can be obtained by concatenating the target airfare price and the reference airfare price for each sales stage in chronological order.
[0093] In step S620, a price identifier feature vector and a sales volume identifier feature vector corresponding to each of the sales stages are generated.
[0094] The price identifier feature vector and the sales volume identifier feature vector are both 0 / 1 vectors with a dimension equal to the number of sales stages. The position feature corresponding to the sales stage has a value of 1, and the other positions have a value of 0.
[0095] Specifically, based on the number of sales stages within the sales cycle, price identifier feature vectors and sales volume identifier feature vectors for each sales stage can be constructed. That is, the price identifier feature vector is an 18-dimensional 0 / 1 vector. The feature value of dimension 1 is taken as 1, and the rest are 0, indicating that the current price identifier feature vector focuses on the th dimension. The ticket price at each sales stage. Correspondingly, the sales volume identifier feature vector is also an 18-dimensional 0 / 1 vector, the first... The feature vector of dimension 1 takes a value of 1 and the rest take a value of 0, indicating that the current sales volume identifier feature vector focuses on the th dimension. Ticket sales volume at each sales stage.
[0096] In step S630, the time weight of each sales stage is determined based on the departure date of the flight to be predicted and the sales date of each sales stage.
[0097] After obtaining the price feature vector, price identifier feature vector, and sales volume identifier feature vector, the time weight of each sales stage can be determined based on the departure date of the flight to be predicted and the sales date of the sales stage.
[0098] The time weight can be calculated using formula (8), that is: (8), in, Indicates the first Time weighting for each sales stage This represents the number of days until departure, calculated from the predicted flight's departure date and the sales dates for each sales phase. The number of days until departure can be the midpoint between each sales phase; for example, 0.5 days for sales phase 1 and 1.5 days for sales phase 2. This represents the attenuation coefficient.
[0099] In step S640, based on each of the sales stages, the flight identifier, the price feature vector, the corresponding price identifier feature vector, the corresponding sales volume identifier feature vector, and the corresponding time weight are concatenated to generate the target input feature vector for each of the sales stages.
[0100] Finally, for each sales stage, the corresponding flight identifier, price feature vector, price identifier feature vector, sales volume identifier feature vector, and time weight are concatenated to obtain the target input feature vector corresponding to each sales stage.
[0101] To facilitate a better understanding of this embodiment, a specific example is provided below for illustration.
[0102] Suppose that the 18 sales stages are simplified into 3 sales stages: sales stage R1 (0-1 days before departure), sales stage R2 (1-2 days before departure), and sales stage R3 (2-3 days before departure). Assume that the time weight of R1 is 1, the time weight of R2 is 0.8, and the time weight of R3 is 0.6, and simultaneously introduce the reference ticket price of the reference stage R0.
[0103] For flight A, assume the flight data for flight A is as follows: R1's target ticket price is 500, and the target ticket sales volume is 20; R2's target ticket price is 400, and the target ticket sales volume is 30; R3's target ticket price is 300, and the target ticket sales volume is 40; R0's reference ticket price is 450; and flight A's flight identifier is 1.
[0104] Based on the ticket price data for flight A, the price feature vector can be determined as: [450, 500, 400, 300].
[0105] The price identifier feature vector of R1 is [1,0,0], and the sales volume identifier feature vector is [1,0,0].
[0106] The price identifier feature vector of R2 is [0,1,0], and the sales volume identifier feature vector is [0,1,0].
[0107] The price identifier feature vector of R3 is [0,0,1], and the sales volume identifier feature vector is [0,0,1].
[0108] Accordingly, the target input feature vector of R1 is: [1,450,500,400,300,1,0,0,1,0,0,1], with a label of 20.
[0109] The target input feature vector for R2 is: [1,450,500,400,300,0,1,0,0,1,0,0.8], with a label of 30.
[0110] The target input feature vector for R3 is: [1,450,500,400,300,0,0,1,0,0,1,0.6], with a label of 40.
[0111] In this embodiment, when inputting the target feature vector, the sales stage information is first displayed and encoded as features in the form of price identifier feature vector and sales volume identifier feature vector. This not only clarifies the sales stage attribution of the input data and avoids cross-interference of feature information from different sales stages, but also unifies the prediction task of multiple sales stages into a regression task of a single model. This allows the model to accurately learn the independent price-demand correlation patterns of each sales stage while avoiding the problems of a large number of models, high training costs, and inconsistent prediction results between stages caused by the need to train a separate prediction model for each stage in traditional methods. This ensures the logical consistency and smoothness of the entire lifecycle demand forecast.
[0112] Furthermore, this embodiment constructs a price feature vector by concatenating historical ticket prices for the entire flight sales cycle in chronological order, ensuring that each input data point contains price information for the entire sales cycle. Compared to existing methods that only use single-stage prices as input, this approach can fully preserve the dynamic patterns of flight price changes over time within a unified feature space, greatly enriching the dimensions of the input information and providing a high-quality data foundation for subsequent random forest models to mine deeper demand patterns.
[0113] Finally, this embodiment introduces a time-weighted feature into the training data, assigning different weight values based on the proximity of the sales stage to the takeoff date. This feature, as one of the input dimensions, allows the random forest model to directly learn the prior business knowledge that demand fluctuations are significant and have a critical impact on revenue in the approaching takeoff stage. During training, the model automatically captures demand change patterns across different time stages, thereby significantly improving the accuracy of demand forecasting for this critical window of opportunity.
[0114] In step S520, the target input feature vectors corresponding to each sales stage are input into the second target random forest model.
[0115] The second objective random forest model is used to output the target predicted air ticket sales volume corresponding to each sales stage.
[0116] Specifically, after obtaining the target input feature vectors corresponding to each sales stage, the target input feature vectors of each sales stage can be input into the second objective random forest model to obtain the target predicted air ticket sales volume output by the second objective random forest model corresponding to each sales stage.
[0117] Understandably, flight identifiers, historical departure dates, historical ticket prices at each sales stage, and historical ticket sales volume are core dimensions of air passenger demand. These dimensions comprehensively cover key influencing factors of ticket demand, such as flight attributes, time patterns, phased pricing, and sales volume correlations. Therefore, to ensure that the secondary objective random forest model can learn the price and sales volume correlation patterns at different sales stages, further, as an optional real-time method, refer to... Figure 7 As shown, Figure 7 This is a schematic diagram of the training process for an initial random forest model. Before step S520, the following steps are also included: In step S710, multiple historical input feature vectors are constructed based on the flight identifier, historical reference ticket price, historical departure date of the flight, historical ticket price at each sales stage, and historical ticket sales volume.
[0118] Specifically, historical flight data, such as flight identifiers, historical departure dates, historical reference ticket prices, historical ticket prices corresponding to each sales stage within the historical sales period, and historical ticket sales volume, can be stored locally on the electronic device. During step S710, this historical flight data can be directly retrieved from the local storage. Alternatively, historical flight data can be received from user input via human-computer interaction; this implementation does not impose any special restrictions on this approach.
[0119] After obtaining historical flight data, steps S610 to S640 can be used to process the flight identifier, historical reference ticket price, historical departure date of the flight, historical ticket price of each sales stage, and historical ticket sales volume in the historical flight data to obtain multiple historical input feature vectors corresponding to each sales stage.
[0120] In step S720, each of the historical input feature vectors is used as sample data, the historical air ticket sales volume corresponding to each sales stage is used as a label, and the multiple sample data are divided into training data and test data.
[0121] For example, historical input feature vectors corresponding to each sales stage can be used as sample data, and historical air ticket sales volume corresponding to each sales stage can be used as labels. The sample data can be divided according to a preset ratio to obtain training data and test data, such as dividing the sample data into training data and test data according to an 8:2 ratio.
[0122] In step S730, the initial random forest model is trained based on the training data until the number of node samples of the decision tree in the initial random forest model is less than a preset threshold, or the number of features available for feature splitting at the node is exhausted, thus obtaining the first target random forest model.
[0123] In this embodiment, the preset threshold for the number of node samples can be set according to actual needs, such as setting the preset threshold for the number of node samples to 2. This embodiment does not impose any special restrictions on this. The number of decisions in the initial random forest model is set to 100, and other hyperparameters use default values, such as unlimited maximum depth and a minimum leaf node sample count of 1.
[0124] Specifically, after obtaining the training and testing data, the sample data from the training data can be used as input to the initial random forest model, and the historical airfare sales volume corresponding to each sample data can be used as the regression prediction target, i.e., the label. This allows the initial random forest model to learn the non-linear mapping relationship between the sample data and the label. Simultaneously, during training, the decision trees in the initial random forest model are trained independently using randomly sampled samples and features to accurately regress and fit the airfare demand at each sales stage. This process continues until the number of node samples in all decision trees of the initial random forest model is less than a preset threshold or the number of features available for splitting a node is exhausted, resulting in the first target random forest model.
[0125] In step S740, the first target random forest model is tested based on the test data to obtain test results.
[0126] The test results include predicted ticket sales volume; After obtaining the first-objective random forest model, the sample data from the test data can be input into the first-objective random forest model. Based on the feature-demand mapping rules learned during training, the first-objective random forest model outputs the corresponding predicted ticket sales volume for each sample data in the test data.
[0127] In step S750, the evaluation index of the first objective random forest model is determined based on the predicted ticket sales volume and the corresponding historical ticket sales volume.
[0128] In this embodiment, the evaluation metrics include mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), and coefficient of determination. .
[0129] After obtaining the predicted ticket sales volume, the evaluation index can be calculated based on the predicted ticket sales volume and the corresponding tags, that is, the mean absolute error can be calculated using formula (9): (9), in, Indicates the mean absolute error. This indicates the total number of sample data in the test data. Indicates the first in the test data Predicted airfare sales based on a sample of data. Indicates the data related to the first... The historical airfare sales volume corresponding to each sample data point.
[0130] The mean square error is calculated using formula (10): (10) in, This represents the mean square error, and the root mean square error is derived from the mean square error. , This represents the root mean square error.
[0131] The coefficient of determination is calculated using formula (11): (11), in, The coefficient of determination is represented by the coefficient of determination. This represents the average historical ticket sales volume in the test data.
[0132] In step S760, if the evaluation index meets the preset conditions, the first objective random forest model is used as the second objective random forest model.
[0133] After obtaining the evaluation metrics, and provided that the evaluation metrics meet the preset conditions, the first objective random forest model is used as the second objective random forest model, i.e. , as well as All are less than the corresponding preset threshold, and If the target value exceeds the corresponding preset threshold, the first objective random forest model is used as the second objective random forest model. If the evaluation metric does not meet the preset conditions, the hyperparameters of the random forest model can be adjusted, such as limiting the maximum depth, and the training and testing data can be re-split. The first objective random forest model can then be trained again until the evaluation metric meets the preset conditions.
[0134] In this embodiment, training and testing data for a random forest model are constructed by fusing flight identifiers, historical flight departure dates, historical ticket prices at each sales stage, and historical ticket sales volume. The initial random forest model is trained using this training data until the number of decision tree node samples is less than a preset threshold or the number of features available for feature splitting at a node is exhausted. The model is then tested using the test data, and an evaluation index is calculated by combining predicted and historical ticket sales volume. Only the trained model whose evaluation index meets preset conditions is used as the final second-target random forest model. This approach ensures that the model training data comprehensively covers the core influencing dimensions of ticket sales, guaranteeing that the model fully learns the price-sales correlation patterns of phased air passenger sales. At the same time, the clearly defined training termination condition ensures the model's depth of feature mining and fitting effect, avoiding underfitting. Furthermore, the independent test data and quantitative evaluation index enable accurate verification and single modeling of the model's performance, effectively guaranteeing that the final second-target random forest model possesses high-precision ticket sales prediction capabilities, providing stable and reliable demand data support for dynamic ticket pricing.
[0135] In step S530, the historical target ticket price corresponding to each sales stage of the flight to be predicted and the historical target ticket sales volume corresponding to the historical target ticket price are obtained.
[0136] For example, historical flights with the same route, season, and cabin class attributes as the flight to be tested can be retrieved from the historical database. The historical sales period corresponding to the maximum revenue of the historical flights in the same period is taken as the historical target sales period, the historical ticket prices of each sales stage within the historical target sales period are taken as the historical target ticket prices, and the historical ticket sales volume corresponding to the historical target ticket prices is taken as the historical target ticket sales volume.
[0137] In step S540, the first revenue is determined based on the target ticket price and the target ticket sales volume.
[0138] In step S550, the second revenue is determined based on the target ticket price and the target predicted ticket sales volume for each sales stage.
[0139] In step S560, a third revenue is determined based on the historical target ticket price and the historical target ticket sales volume.
[0140] In step S570, if both the first revenue and the second revenue are greater than the third revenue, a list of ticket prices and a list of ticket sales are generated and output based on the target ticket price and the target ticket sales volume for each sales stage.
[0141] Specifically, the first revenue can be determined using the target ticket price and corresponding target ticket sales volume for each sales stage. The second revenue can be determined using the target ticket price and corresponding new target predicted ticket sales volume for each sales stage. The third revenue can be calculated using historical ticket prices for each sales stage within the historical target sales period as historical target ticket prices and corresponding historical target ticket sales volumes. Finally, if both the first and second revenues are greater than the third revenue, a list of ticket prices and a list of ticket sales volumes based on the target ticket prices and target ticket sales volumes for each sales stage are generated and output.
[0142] Correspondingly, if either the first or second benefit is less than the third benefit, the target ticket price and target ticket sales volume for each sales stage are recorded as infeasible solutions. Then, through steps S410 to S460, and with constraints or penalties, the target ticket price column, target ticket sales volume, and their equivalent solutions are excluded. The reverse recursive solution is then performed again to generate new target ticket prices and new target ticket sales volumes until both the first and second benefits are greater than the third benefit.
[0143] In this embodiment, the target predicted airfare sales volume is obtained by inputting the target input feature vectors of each sales stage into a pre-trained random forest model. Then, the first, second, and third revenues are determined by combining the target airfare price with the corresponding target predicted airfare sales volume and the historical target airfare price with the corresponding historical target airfare sales volume. An airfare price and sales volume list is generated and output only when the first and second revenues are greater than the third revenue. This method relies on the random forest model to achieve accurate secondary prediction of airfare sales volume. The pricing scheme is verified through multi-dimensional comparison of the dual revenue indicators with historical revenue benchmarks, effectively compensating for the accuracy deficiencies of single prediction models, significantly reducing the revenue risk caused by prediction bias, and ensuring that the output pricing scheme has better revenue performance than historical pricing strategies. It also avoids the overfitting risk that machine learning models may produce, ensuring an optimal balance between optimization and robustness. Furthermore, when verification fails, the system marks the current scheme as infeasible and drives dynamic programming to be solved again, forming a closed-loop iterative optimization, enabling the pricing strategy to adapt to market changes and continuously approach the global optimal revenue. Compared with existing technologies, this invention significantly reduces the risk of revenue loss due to model errors and improves the decision-making quality and anti-interference capability of automated pricing systems.
[0144] As a second aspect of this invention, this embodiment also provides a system for constructing an air ticket sales volume prediction model, comprising: The acquisition module is used to obtain historical sales information for each flight during the historical sales period; The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage; The construction module is used to build an initial air ticket sales volume prediction model based on the historical sales information, including: The data processing unit is used to take the historical ticket price, the sales stage identifier, and the historical reference ticket price as input data, and the historical ticket sales volume as a tag; The training unit is used to train the initial air ticket sales prediction model by using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the average air ticket demand as model parameters. The optimization module is used to iteratively optimize the model parameters using the basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target air ticket sales volume prediction model.
[0145] Meanwhile, this embodiment also provides an electronic device, referring to Figure 8 As shown, Figure 8 The structural diagram of the electronic device includes: One or more processors; A memory having stored one or more computer programs that, when executed by one or more processors, cause the one or more processors to implement the method for constructing an air ticket sales forecasting model according to the first aspect of the invention.
[0146] The electronic device may also include one or more I / O interfaces connected between the processor and the memory, configured to enable information interaction between the processor and the memory.
[0147] Among them, the processor is a device with data processing capabilities, including but not limited to the central processing unit (CPU); the first memory is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) is connected between the processor and the memory, enabling information exchange between the processor and the memory, including but not limited to the data bus (Bus).
[0148] In some embodiments, the processor, memory, and I / O interfaces are interconnected via a bus, and thus connected to other components of the computing device.
[0149] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Those skilled in the art should understand that the present invention includes, but is not limited to, the contents described in the accompanying drawings and the specific embodiments above. Any modifications that do not depart from the functional and structural principles of the present invention will be included within the scope of the claims.
Claims
1. A method for constructing a flight ticket sales volume prediction model, characterized in that, include: Obtain historical sales information for each flight within the historical sales period; The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage; Based on the historical sales information, an initial airfare sales prediction model is constructed, including: The historical airfare price, the sales stage identifier, and the historical reference airfare price are used as input data, and the historical airfare sales volume is used as a label. The initial air ticket sales prediction model is trained by using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the mean air ticket demand as model parameters. The model parameters are iteratively optimized using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target airfare sales volume prediction model.
2. The method according to claim 1, characterized in that, The step of iteratively optimizing the model parameters using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, to generate a target airfare sales prediction model, includes: The position vector of each particle is constructed based on the cumulative parameter of ticket demand over time, the price elasticity coefficient, and the initial value of the mean of ticket demand. Determine the particle velocity vector for each particle; The position vector of each particle is used as the model parameter of the initial air ticket sales prediction model to calculate the predicted air ticket sales for each particle. The error between the predicted ticket sales volume and the corresponding historical ticket sales volume is used as the fitness value; Based on the fitness value of each particle, update the individual optimal position vector of each particle and the global optimal position vector of all particles. Based on the particle velocity vector of each particle, the individual optimal position vector, and the global optimal position vector, the particle velocity vector of each particle is updated, and the target particle velocity vector is determined. The position vectors of each particle are updated based on the position vectors of each particle and the velocity vector of the target particle, and the target position vector is determined. The target position vector of each particle is used as the model parameter of the initial air ticket sales prediction model. The corresponding predicted air ticket sales are recalculated until the number of iterations of the basic particle swarm optimization algorithm is not less than the preset number. Then, the global optimal position vector is used as the target parameter combination of the air ticket sales prediction model to generate the target air ticket sales prediction model.
3. The method according to claim 1, characterized in that, The step of constructing an initial airfare sales prediction model based on the historical sales information further includes: The initial airfare sales prediction model is constructed based on the following formula: , , Indicates the flight before takeoff Forecasted daily airfare sales This represents the average demand for air tickets. Indicates the first Stage identifiers for each sales phase. , This represents the cumulative sales demand over time for sales stages 0 through 3. This represents the cumulative sales demand over time for sales stages 4 through 14. This represents the cumulative sales demand over time for sales stages 15 to 18. This represents the price elasticity coefficient of airfares in the 0th to 3rd sales stages. This represents the price elasticity coefficient of airfares in sales stages 4 through 14. This represents the price elasticity coefficient of airfares during the 15th to 18th sales phases. Indicates the first Airfare prices at each sales stage This indicates the reference airfare price. This represents the sum of the cumulative parameters of sales demand over time at each sales stage during the sales period, without considering the price elasticity coefficient of airfares.
4. The method according to claim 1, characterized in that, After iteratively optimizing the model parameters using a basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, and generating the target airfare sales prediction model, the process further includes: Obtain historical sales information corresponding to the current sales period of the flight to be predicted, as well as the reference ticket price corresponding to the flight to be predicted; The current sales period includes multiple sales stages divided in chronological order; The historical sales information includes historical airfare prices corresponding to each of the aforementioned sales stages; Based on the historical airfare prices corresponding to each sales stage, determine the airfare price range for each sales stage; Input the airfare price, stage identifier, and reference airfare price from the airfare price range for each sales stage into the target airfare sales volume prediction model; Based on the target air ticket sales volume prediction model, the predicted air ticket sales volume is output corresponding to the air ticket price at each sales stage; Based on the ticket prices at the sales stage and the corresponding predicted ticket sales volume, determine the target ticket price and the target ticket sales volume; Based on the target ticket price and target ticket sales volume at each sales stage, generate and output a list of ticket prices and a list of ticket sales volume.
5. The method according to claim 4, characterized in that, The determination of the target ticket price and target ticket sales volume based on the ticket prices at each sales stage and the corresponding predicted ticket sales volume includes: Obtain the total number of available seats for the flight to be predicted; For each sales stage, determine the larger value of the product of the ticket price and the corresponding predicted ticket sales volume; The larger value of the airfare at each sales stage is used as the candidate airfare price, and the predicted airfare sales volume is used as the candidate airfare sales volume. If the sum of the candidate ticket sales volume in all sales stages is not greater than the total number of available seats, the candidate ticket price in each sales stage shall be used as the target ticket price, and the candidate ticket sales volume shall be used as the target ticket sales volume. If the sum of the candidate ticket sales volume in all sales stages is greater than the total number of available seats, the total number of available seats is used as a constraint to construct a price-sales-volume dynamic programming equation based on ticket prices and predicted ticket sales volume. Solve the dynamic programming equation for price and sales volume to determine the target ticket price and target ticket sales volume corresponding to each sales stage.
6. The method according to claim 4, characterized in that, The process of generating and outputting a list of ticket prices and a list of ticket sales based on the target ticket price and the target ticket sales volume at each sales stage includes: Based on the departure date, flight identifier, reference ticket price, target ticket price, stage identifier, and sales date of the flight to be predicted, construct a target input feature vector corresponding to each sales stage; The target input feature vectors corresponding to each sales stage are input into the second objective random forest model; The second objective random forest model is used to output the target predicted air ticket sales volume corresponding to each sales stage; Obtain the historical target ticket price corresponding to each sales stage of the flight to be predicted, and the historical target ticket sales volume corresponding to the historical target ticket price; The first revenue is determined based on the target ticket price and the target ticket sales volume; The second revenue is determined based on the target ticket price and the target projected ticket sales volume for each sales stage; The third revenue is determined based on the historical target ticket price and the historical target ticket sales volume; If both the first and second revenues are greater than the third revenue, a list of ticket prices and a list of ticket sales volumes are generated and output based on the target ticket prices and target ticket sales volumes for each sales stage.
7. The method according to claim 6, characterized in that, The step of constructing a target input feature vector corresponding to each sales stage based on the departure date, flight identifier, reference ticket price, target ticket price, stage identifier, and sales date of the flight to be predicted includes: A price feature vector is generated by concatenating the target ticket price and the reference ticket price for each of the sales stages in chronological order. Generate price identifier feature vectors and sales volume identifier feature vectors corresponding to each of the aforementioned sales stages; Wherein, the price identifier feature vector and the sales volume identifier feature vector are both 0 / 1 vectors with a dimension equal to the number of sales stages, the position feature corresponding to the sales stage takes a value of 1, and the other positions take a value of 0; The time weight of each sales stage is determined based on the departure date of the flight to be predicted and the sales date of each sales stage. Based on each of the aforementioned sales stages, the flight identifier, the price feature vector, the corresponding price identifier feature vector, the corresponding sales volume identifier feature vector, and the corresponding time weight are concatenated to generate the target input feature vector for each of the aforementioned sales stages.
8. The method according to claim 6, characterized in that, The second objective random forest model is obtained based on the following steps: Based on the flight identifier, historical reference ticket price, historical departure date, historical ticket price at each sales stage, and historical ticket sales volume, construct multiple historical input feature vectors; Each of the historical input feature vectors is used as sample data, and the historical air ticket sales volume corresponding to each sales stage is used as a label. The sample data is then divided into training data and test data. The initial random forest model is trained based on the training data until the number of node samples of the decision tree in the initial random forest model is less than a preset threshold, or the number of features available for feature splitting at the node is exhausted, thus generating the first target random forest model. The first objective random forest model is tested based on the test data, and test results are generated; wherein, the test results include the predicted air ticket sales volume; The evaluation metrics for the first objective random forest model are determined based on the predicted ticket sales volume and the corresponding historical ticket sales volume. If the evaluation index meets the preset conditions, the first objective random forest model will be used as the second objective random forest model.
9. A system for constructing a flight ticket sales volume prediction model, characterized in that, include: The acquisition module is used to obtain historical sales information for each flight during the historical sales period; The historical sales period includes multiple sales phases divided in chronological order; The historical sales information includes: historical airfare prices, historical airfare sales volume, historical reference airfare prices, and sales stage identifiers for each sales stage; The construction module is used to build an initial air ticket sales volume prediction model based on the historical sales information, including: The data processing unit is used to take the historical airfare price, the sales stage identifier, and the historical reference airfare price as input data, and the historical airfare sales volume as a tag; The training unit is used to train the initial air ticket sales prediction model by using the cumulative parameters of air ticket demand over time, the price elasticity coefficient, and the average air ticket demand as model parameters. The optimization module is used to iteratively optimize the model parameters using the basic particle swarm optimization algorithm until the number of iterations is not less than a preset number, thereby generating a target air ticket sales volume prediction model.
10. An electronic device, characterized in that, include: One or more processors; A memory having stored thereon one or more computer programs that, when executed by the one or more processors, cause the one or more processors to implement the method according to any one of claims 1 to 8.