Special line purchasing method, device and equipment based on flow prediction and medium
Through a dedicated line procurement method based on traffic prediction, combined with linear regression model and Nelder-Mead algorithm, the problems of resource waste and excessive costs in the traditional procurement model are solved, and refined management and in-depth optimization of procurement costs are achieved.
Patent Information
- Application Number
- CN202510121634.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-05-30
AI Technical Summary
The traditional dedicated line traffic procurement model is based on historical peaks, resulting in waste of resources and excessive costs, making it difficult to accurately allocate fixed and elastic bandwidth to minimize costs.
The dedicated line procurement method based on traffic prediction is adopted to predict future traffic through a linear regression model, and the procurement strategy is optimized with the Nelder-Mead algorithm to achieve the optimal combination of fixed bandwidth and elastic bandwidth.
It has achieved refined management and in-depth optimization of procurement costs, reduced dedicated line procurement costs, and improved operational economic benefits.
Smart Images

Figure CN120069189A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of professional procurement cost control, and particularly relates to a dedicated line procurement method, device, equipment and medium based on traffic prediction. Background Art
[0002] In modern network service operations, a company provides network acceleration services. To ensure the quality of customers' acceleration services every month, the company needs to purchase dedicated line traffic. However, customer traffic is affected by fluctuations in working hours, and the traffic varies significantly on different dates and time periods. The traditional procurement mode is based on historical peaks, resulting in waste of resources and inflated costs. Although there is potential in adopting a hybrid procurement strategy of fixed and flexible, determining the precise allocation ratio between the two to minimize costs has become a technical bottleneck in the industry. Therefore, it is urgent to develop an intelligent and precise procurement strategy optimization device. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a dedicated line procurement method, device, equipment and medium based on traffic prediction, so as to achieve refined management and in-depth optimization of procurement costs, save a large amount of dedicated line procurement costs for enterprises, and improve operational economic benefits.
[0004] In a first aspect, the present invention provides a dedicated line procurement method based on traffic prediction, including the following steps:
[0005] Step 1: Divide a specified period of time into working days, non-working days and holidays, and make identifications, integrate them into a data frame, and output a date file in the xlsx format;
[0006] Step 2: According to the time-sharing traffic data file of historical months, combine with the date file to extract the traffic data corresponding to the date, month, hour and working day, as training data;
[0007] Step 3: Based on the preprocessed historical traffic data, select hour, date, whether it is a working day and whether it is a holiday as input features to construct a feature matrix X_train, with traffic as the target variable y_train; at the same time, introduce the LinearRegression algorithm in the sklearn.linear_model library as a linear regression model; input the training data into the linear regression model to obtain the trained linear regression model;
[0008] Step 4: Use the trained linear regression model for prediction and output it as a prediction file;
[0009] Step 5: Read the prediction file, use the minimize function in the scipy.optimize library, combine with the Nelder-Mead algorithm, start the optimization algorithm to obtain the procurement fixed bandwidth traffic result that minimizes the total traffic cost, and perform dedicated line procurement according to the result.
[0010] In a second aspect, the present invention provides a dedicated line procurement device based on traffic prediction, including:
[0011] A date file module that divides a specified period of time into working days, non-working days, and holidays, identifies them, integrates them into a data frame, and outputs a date file in the xlsx format.
[0012] An acquisition data module that extracts the traffic data corresponding to the date date, month month, hour hour, and working day weekday according to the historical monthly time-sharing traffic data file and combines it with the date file as training data.
[0013] A training model module that, based on the preprocessed historical traffic data, selects hour, date, whether it is a working day, and whether it is a holiday as input features to construct a feature matrix X_train, with traffic as the target variable y_train; at the same time, introduces the LinearRegression algorithm in the sklearn.linear_model library as a linear regression model; inputs the training data into the linear regression model to obtain the trained linear regression model.
[0014] A prediction module that uses the trained linear regression model for prediction and outputs it as a prediction file.
[0015] A procurement module that reads the prediction file, uses the minimize function in the scipy.optimize library, combines with the Nelder-Mead algorithm, starts the optimization algorithm to obtain the procurement fixed bandwidth traffic result that minimizes the total traffic cost, and performs dedicated line procurement according to the result.
[0016] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method described in the first aspect.
[0017] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the method described in the first aspect.
[0018] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:
[0019] 1. Pioneeringly integrate the linear regression algorithm for traffic prediction with the Nelder-Mead algorithm for procurement cost optimization. Through traffic prediction, provide accurate traffic demand estimates for cost optimization. The cost optimization algorithm then adjusts the procurement strategy in reverse based on the prediction results, realizing an innovative model of two-way drive and collaborative optimization, and effectively breaking through the dilemma of the disconnection between traffic and cost in traditional procurement decisions.
[0020] 2. In the traffic prediction model, deeply mine the multi-dimensional features of traffic data. Not only consider the common time dimension (hour), but also innovatively incorporate the weekday dimension information. By constructing an input matrix containing multiple features such as hour, weekday, and is_work, the model can comprehensively capture the complex change laws of traffic under different time and weekday combinations. This multi-dimensional modeling method significantly improves the accuracy and adaptability of traffic prediction, providing more reliable traffic data support for formulating precise procurement strategies.
[0021] 3. In the cost calculation link, construct a fine and flexible cost calculation function system, fully considering the cost differences between fixed broadband and elastic broadband, the premium factors of elastic traffic, and the traffic characteristics in different time periods (weekdays and weekends). Use the Nelder-Mead algorithm for global optimization and solution, which can quickly and accurately search for the optimal procurement strategy combination in the complex cost function space, realize the refined management and in-depth optimization of procurement costs, save a large amount of dedicated line procurement costs for enterprises, and improve operational economic benefits.
[0022] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following specifically illustrates the specific embodiments of the present invention. Brief Description of the Drawings
[0023] The following further describes the present invention with reference to the accompanying drawings in conjunction with embodiments.
[0024] Figure 1 It is the flowchart of the method in Embodiment 1 of the present invention;
[0025] Figure 2 It is the structural schematic diagram of the device in Embodiment 2 of the present invention. Detailed Description of the Invention
[0026] The overall idea of the technical solution in the embodiments of the present application is as follows:
[0027] By deeply mining historical traffic data, predict the hourly traffic trend within the next month, and then use an optimization algorithm to calculate the optimal combination strategy of fixed broadband and flexible billing, ensuring that while meeting the customer's traffic demand, the dedicated line procurement cost is minimized to improve the enterprise's operational efficiency and resource utilization rate.
[0028] 1. Data preparation stage
[0029] Date data generation: Execute the workday_generate.py code. This code first imports the pandas library for data processing, the numpy library for assisting numerical calculations, and the datetime library for date and time operations. By defining the date_range function, a continuous date sequence between the specified start date (2024-01-01) and end date (2024-12-31) is generated in a loop. Subsequently, based on the generated date sequence, the corresponding day-of-week sequence weekday_list and holiday flag sequence holiday_list (temporarily set to all 0 in this example, which can be further improved according to actual holiday data) are calculated respectively. Finally, the is_work_list indicating whether it is a working day is generated based on the day-of-week information. The above data is integrated into a data frame df and output as the workday_2024.xlsx file. This file provides basic data support for date feature extraction in the subsequent traffic prediction model and weekday differentiation in cost calculation. The following is the header and field description of the workday_2024.xlsx data table:
[0030] date: Date, in the format yyyy-mm-dd;
[0031] weekday: Day of the week, a numerical value from 1 to 7, representing Monday to Sunday;
[0032] is_holiday: Whether it is a legal holiday, 0 for no and 1 for yes;
[0033] is_work: Whether it is a working day, 0 for no and 1 for yes.
[0034] During ordinary non-working days, the traffic usage will decrease significantly, and it will decrease even more significantly during holidays. Distinguish it so that the model can learn more information and make more accurate predictions.
[0035] Historical traffic data preprocessing: Use the data reading function in traffic_predict_by_LR_hour.py to load the hourly traffic data file bytes_by_hour_202401-202403.xlsx for historical months (such as January 2024 - March 2024). Utilize the powerful data processing capabilities of the pandas library to convert the time column dt_hour to the standard date and time format, and extract key feature information such as date, month, hour, and weekday. This step provides a rich and accurate input feature set for the training of the subsequent traffic prediction model through the structured processing of the original traffic data, enabling the model to fully learn the internal correlation laws between traffic and factors such as time and weekdays; obtain the traffic values corresponding to the month, day of the week, whether it is a weekday, whether it is a legal holiday, and which hour.
[0036] 2. Traffic prediction model development and training phase
[0037] Feature engineering and model initialization: In the traffic_predict_by_LR_hour.py code, based on the preprocessed historical traffic data, carefully select hour (hour), weekday (weekday), and is_work (whether it is a weekday) as input features to construct the feature matrix X_train, and use traffic (traffic) as the target variable y_train. At the same time, introduce the LinearRegression algorithm in the sklearn.linear_model library to initialize the linear regression model model. This process is the core link of traffic prediction. By reasonably selecting features, the key factors affecting traffic changes are included in the model consideration range, laying a foundation for subsequent accurate prediction.
[0038] Model training and fitting: Call the model.fit(X_train,y_train) method to start the training process of the linear regression model. During this process, the model gradually adjusts the internal parameters (such as weights and biases) according to the relationship between the input feature matrix X_train and the target variable y_train, using mathematical principles such as the least squares method to minimize the error function between the predicted value and the actual value. Through learning a large amount of historical traffic data, the model gradually masters the linear law pattern of traffic changing with hours and weekdays, thus acquiring the ability to predict future traffic.
[0039] LinearRegression uses the least squares method to solve for parameters internally. For small datasets, it directly solves without iteration, so there are no stopping conditions for the number of iterations or error convergence. For larger datasets, LinearRegression uses an optimization algorithm, usually a solver for Ridge regression or Lasso regression, which use iterative optimization algorithms. However, in sklearn's LinearRegression, there is no explicit setting of stopping conditions because it uses a matrix factorization-based method rather than traditional gradient descent. In this case, the algorithm automatically calculates until the matrix factorization is completed or a certain computational accuracy is reached.
[0040] 3. Next month's time-of-use traffic prediction phase
[0041] Test data preprocessing: Set the traffic data file bytes_by_hour_202404.xlsx for the month to be predicted. The number of columns included in this file:
[0042] date: Date, in the format yyyy - mm - dd;
[0043] weekday: Day of the week, a numerical value from 1 to 7 representing Monday to Sunday;
[0044] is_holiday: Whether it is a legal holiday, 0 for no and 1 for yes;
[0045] is_work: Whether it is a working day, 0 for no and 1 for yes;
[0046] The hour of the day;
[0047] Traffic.
[0048] Traffic prediction: Use the trained linear regression model to input the traffic data file into the linear regression model to predict and fill the month to be predicted. Obtain the predicted traffic value y_pred through the statement y_pred = model.predict(X_test). Integrate the predicted traffic data and the actual traffic data into a data frame df_compare, record the prediction time dt_hour and the predicted traffic predict_traffic in detail, and output it as the compare_202404.xlsx file.
[0049] 4. Cost optimal solution calculation phase
[0050] Traffic data statistics and cost function definition: In the min_cost_calc_by_hour.py code, first read the hourly traffic data file data / bytes_by_hour_202404.xlsx for April 2024. By looping through each row of the data frame, count the actual traffic value for each hour and store them in the traffics list (containing all hourly traffic) and the workday_traffics list (only containing weekday hourly traffic) respectively. Based on the dedicated line procurement cost structure, define the fixed broadband cost per hour as 35.0 / 744 yuan, and the elastic broadband cost per hour as 110.0 / 744 yuan. Construct the traffic cost calculation function compute_Yi, which takes the fixed broadband hourly purchased traffic x and the actual hourly used traffic mi as parameters. When mi > x, calculate the cost according to the formula 35.0 / 744 * x + 110.0 / 744 * (mi - x) * 1.25 (where 1.25 is the possible premium coefficient for elastic traffic and can be adjusted according to the actual market situation), indicating that when the actual traffic exceeds the fixed broadband purchase volume, an additional elastic traffic fee needs to be paid. mi is the traffic megabytes per hour obtained by traversal, and x is the optimal value finally required; when mi <= x, calculate the cost according to 35.0 / 744 * x, indicating the cost when only using fixed broadband can meet the traffic demand.
[0051] compute_Yi is a self-constructed function, and the specific code and comments are as follows:
[0052] # **Function for calculating the traffic cost Yi for the i-th hour**
[0053] # 1. Let x be the fixed broadband hourly purchased traffic bandwidth
[0054] # 2. Let mi be the actual used traffic bandwidth for the i-th hour
[0055] # 3. Let the fixed broadband cost per hour be 35.0 / 744 yuan, that is, the cost per megabyte bandwidth per hour; the elastic broadband cost per hour is 110.0 / 744 yuan
[0056] # 4. Then when mi > x, elastic traffic needs to be used, and its cost is 35.0 / 744 * x + 110.0 / 744 * (mi - x)
[0057] # 5. Then when mi <= x, elastic traffic does not need to be used, and its cost should be 35.0 / 744 * x def compute_Yi(x, mi):
[0058] if mi > x:
[0059] return 35.0 / 744*x+110.0 / 744*(mi-x)*1.25
[0060] else:
[0061] return 35.0 / 744*x。
[0062] Construction of the total cost function and solution of the optimal solution: Construct a calculation function compute_z for the total traffic cost z in the current statistical period, which is achieved by summing the compute_Yi function over all hourly traffic, that is, compute_z(x, arr) returns sum(compute_Yi(x, mi) for mi in arr), where arr represents the array of hourly traffic. Use the minimize function in the scipy.optimize library, combined with the Nelder-Mead algorithm, with lambda x: compute_z(x, traffics) as the objective function, and start the optimization algorithm with the initial value x0 = 0. The algorithm continuously iterates and adjusts the fixed broadband purchase traffic number x within the search space, and searches for the optimal solution result that minimizes the total traffic cost z by evaluating the change in the compute_z function value. Obtain and output the optimization results, including the hourly peak traffic max(traffics), the purchase cost that should be incurred for purchasing fixed broadband according to the hourly peak len(traffics) * max(traffics) * 35.0 / 744, the minimum cost result.fun of the fixed broadband + flexible billing combination purchase, and the fixed broadband should be purchased traffic number result.x[0]. The final result is the fixed bandwidth traffic number result.x[0] that should be purchased, and the other printed information is for comparing the cost optimization effect.
[0063] The compute_Yi function is used to calculate the hourly cost, and another function is needed to traverse and calculate the monthly cost, as follows:
[0064] # **Calculation function for the total traffic cost z in the current statistical period**
[0065] # Equal to the sum of the traffic costs of each hour
[0066] def compute_z(x, arr):
[0067] return sum(compute_Yi(x, mi) for mi in arr)。
[0068] Example 1
[0069] As Figure 1 shown, this embodiment provides a dedicated line procurement method based on traffic prediction, including the following steps:
[0070] Step 1: Divide a specified period into working days, non-working days, and holidays, identify them, integrate them into a data frame, and output a date file in the xlsx format.
[0071] Step 2: According to the historical hourly traffic data file, combined with the date file, extract the traffic data corresponding to the date, month, hour, and working day as training data.
[0072] Step 3: Based on the preprocessed historical traffic data, select hour, date, whether it is a working day, and whether it is a holiday as input features to construct the feature matrix X_train, and use traffic as the target variable y_train. At the same time, introduce the LinearRegression algorithm in the sklearn.linear_model library as the linear regression model. Input the training data into the linear regression model to obtain the trained linear regression model.
[0073] Step 4: Use the trained linear regression model for prediction and output it as a prediction file.
[0074] Step 5: Read the prediction file, use the minimize function in the scipy.optimize library, combined with the Nelder-Mead algorithm, start the optimization algorithm to obtain the purchased fixed bandwidth traffic result that minimizes the total traffic cost, and conduct dedicated line procurement according to the result.
[0075] In this embodiment, preferably, Step 3 is specifically as follows: Based on the preprocessed historical traffic data, select hour, date, whether it is a working day, and whether it is a holiday as input features to construct the feature matrix X_train, and use traffic as the target variable y_train. At the same time, introduce the LinearRegression algorithm in the sklearn.linear_model library as the linear regression model.
[0076] Call the model.fit(X_train, y_train) method, input the traffic data corresponding to the date, month, hour, and working day into the linear regression model for model training. During the training, the linear regression model gradually adjusts the internal parameters of the linear regression model according to the relationship between the input feature matrix X_train and the target variable y_train, using mathematical principles such as the least squares method. When the error between the predicted value and the actual value reaches the set value, the trained linear regression model is obtained.
[0077] In this embodiment, preferably, step 4 is specifically as follows: Use the trained linear regression model for prediction, and obtain the predicted traffic value y_pred through the statement y_pred = model.predict(X_test); it includes: prediction time dt_hour and predicted traffic predict_traffic, and output them as a prediction file.
[0078] In this embodiment, preferably, step 5 is specifically as follows: Read the prediction file, count the predicted traffic values per hour, and store them as traffics list and workday_traffics list respectively. The traffics list contains the predicted traffic values for all hours; the workday_traffics list contains the hourly traffic on weekdays; Based on the dedicated line procurement cost structure, define the fixed broadband cost per hour as a, and the elastic broadband cost per hour as b, and construct a traffic cost calculation function compute_Yi, which takes the fixed broadband hourly purchased traffic x and the hourly predicted traffic mi as parameters; when mi > x, calculate the cost according to the formula a×x + b×(mi - x)×1.25; when mi ≤ x, calculate the cost according to a multiplied by x;
[0079] Construct a calculation function compute_z for the total traffic cost z in the current statistical period, which is realized by summing the function compute_Yi over all hourly traffic;
[0080] Use the minimize function in the scipy.optimize library, combined with the Nelder - Mead algorithm, with lambdax:compute_z(x,traffics) as the objective function, and start the optimization algorithm; the optimization algorithm continuously iteratively adjusts the fixed broadband procurement traffic x within the search space, and by evaluating the change of the compute_z function value, obtains the procurement fixed bandwidth traffic result that minimizes the total traffic cost z, and perform dedicated line procurement according to result.
[0081] Based on the same inventive concept, the present application also provides a device corresponding to the method in Embodiment 1, details can be seen in Embodiment 2.
[0082] Embodiment 2
[0083] As Figure 2 shown, in this embodiment, a dedicated line procurement device based on traffic prediction is provided, including:
[0084] A date file module, which divides a specified period of time into weekdays, non - weekdays, and holidays, and makes identifications, integrates them into a data frame, and outputs a date file in the format of xlsx;
[0085] The data acquisition module extracts the traffic data corresponding to the date `date`, month `month`, hour `hour`, and weekday `weekday` from the time-sharing traffic data file of historical months in combination with the date file as training data;
[0086] The training model module, based on the preprocessed historical traffic data, selects the hour, date, whether it is a weekday, and whether it is a holiday as input features to construct the feature matrix `X_train`, and uses the traffic as the target variable `y_train`; at the same time, introduces the `LinearRegression` algorithm in the `sklearn.linear_model` library as the linear regression model; inputs the training data into the linear regression model to obtain the trained linear regression model;
[0087] The prediction module uses the trained linear regression model for prediction and outputs it as a prediction file;
[0088] The procurement module reads the prediction file, uses the `minimize` function in the `scipy.optimize` library, combines the Nelder-Mead algorithm, starts the optimization algorithm, obtains the result of purchasing a fixed bandwidth traffic that minimizes the total traffic cost `result`, and conducts dedicated line procurement according to `result`.
[0089] In this embodiment, preferably, the training model module is specifically: based on the preprocessed historical traffic data, selects the hour, date, whether it is a weekday, and whether it is a holiday as input features to construct the feature matrix `X_train`, and uses the traffic as the target variable `y_train`; at the same time, introduces the `LinearRegression` algorithm in the `sklearn.linear_model` library as the linear regression model;
[0090] Calls the `model.fit(X_train, y_train)` method, inputs the traffic data corresponding to the date `date`, month `month`, hour `hour`, and weekday `weekday` into the linear regression model for model training; during the training, the linear regression model gradually adjusts the internal parameters of the linear regression model according to the relationship between the input feature matrix `X_train` and the target variable `y_train` using mathematical principles such as the least squares method. When the error between the predicted value and the actual value reaches the set value, the trained linear regression model is obtained.
[0091] In this embodiment, preferably, the prediction module is specifically configured to: perform prediction using a trained linear regression model, and obtain the predicted traffic value y_pred through the statement y_pred = model.predict(X_test); it includes: the prediction time dt_hour and the predicted traffic predict_traffic, and outputs them as a prediction file.
[0092] In this embodiment, preferably, the procurement module is specifically configured to: read the prediction file, count the predicted traffic values per hour, and store them as a traffics list and a workday_traffics list respectively. The traffics list contains the predicted traffic values for all hours; the workday_traffics list contains the hourly traffic on weekdays. Based on the dedicated line procurement cost structure, define the fixed broadband cost per hour as a, and the elastic broadband cost per hour as b, and construct a traffic cost calculation function compute_Yi, which takes the fixed broadband hourly purchased traffic x and the hourly predicted traffic mi as parameters; when mi > x, calculate the cost according to the formula a×x + b×(mi - x)×1.25; when mi ≤ x, calculate the cost by multiplying a by x.
[0093] Construct a calculation function compute_z for the total traffic cost z in the current statistical period, which is achieved by summing the function compute_Yi over all hourly traffic.
[0094] Use the minimize function in the scipy.optimize library, combined with the Nelder - Mead algorithm, with lambdax:compute_z(x,traffics) as the objective function, and start the optimization algorithm; the optimization algorithm continuously iteratively adjusts the fixed broadband procurement traffic x within the search space, and by evaluating the change in the compute_z function value, obtains the procurement fixed bandwidth traffic result that minimizes the total traffic cost z, and performs dedicated line procurement according to the result.
[0095] Since the device introduced in the second embodiment of the present invention is the device used to implement the method of the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, those skilled in the art can understand the specific structure and variations of the device, so it will not be elaborated here. Any device used in the method of the first embodiment of the present invention falls within the scope of protection of the present invention.
[0096] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, as detailed in the third embodiment.
[0097] Embodiment Three
[0098] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, any implementation manner in Embodiment 1 can be implemented.
[0099] Since the electronic device introduced in this embodiment is the device used to implement the method in Embodiment 1 of this application, based on the method introduced in Embodiment 1 of this application, those skilled in the art can understand the specific implementation manners and various variations of the electronic device in this embodiment. Therefore, the specific implementation of how this electronic device implements the method in the embodiments of this application will not be introduced in detail here. As long as the device used by those skilled in the art to implement the method in the embodiments of this application belongs to the scope protected by this application.
[0100] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.
[0101] Embodiment 4
[0102] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any implementation manner in Embodiment 1 can be implemented.
[0103] The technical solutions provided in the embodiments of this application at least have the following technical effects or advantages:
[0104] Through the technical solution of this embodiment, the usage traffic in a certain future month can be accurately predicted, and the traffic prediction value for each hour can be obtained. According to the prediction value, the fixed bandwidth value that the company needs to purchase each month can be obtained, and the other part uses dynamic bandwidth traffic, so that the enterprise does not need to use the maximum peak value as the purchase value, greatly reducing the cost of the enterprise.
[0105] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0106] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to produce a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices produce means for implementing the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0107] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including instruction means for implementing the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0108] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are performed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0109] Although the specific embodiments of the present invention have been described above, those skilled in the art of this technology should understand that the specific embodiments we described are illustrative rather than limiting the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered by the scope of the claims of the present invention.
Claims
1. A dedicated line purchasing method based on traffic prediction, characterized by: The steps include: Step 1: Divide the specified period of time into working days, non-working days and holidays, mark them, integrate them into a data frame, and output them as a date file in xlsx format; Step 2: Based on the time-sharing traffic data files of historical months, combined with the date files, extract the traffic data corresponding to date, month, hour, and weekday as training data; Step 3: Based on the preprocessed historical traffic data, select the hour, date, whether it is a working day, and whether it is a holiday as input features to construct the feature matrix X_train, and use the traffic as the target variable y_train; at the same time, introduce the LinearRegression algorithm in the sklearn.linear_model library as the linear regression model; input the training data into the linear regression model to obtain the trained linear regression model; Step 4: Use the trained linear regression model to make predictions and output them as prediction files; Step 5: Read the prediction file, use the minimize function in the scipy.optimize library, and start the optimization algorithm in combination with the Nelder-Mead algorithm to obtain the result of purchasing fixed bandwidth traffic that minimizes the total traffic cost, and purchase dedicated lines based on the result.
2. A dedicated line purchasing method based on traffic prediction according to claim 1, characterized in that: The step 3 is specifically as follows: based on the pre-processed historical traffic data, the hour, date, whether it is a working day, and whether it is a holiday are selected as input features to construct a feature matrix X_train, and the traffic is used as the target variable y_train; at the same time, the LinearRegression algorithm in the sklearn.linear_model library is introduced as a linear regression model; Call the model.fit(X_train,y_train) method, input the traffic data corresponding to date, month, hour, and weekday into the linear regression model for model training; during the training, the linear regression model gradually adjusts the internal parameters of the linear regression model based on the relationship between the input feature matrix X_train and the target variable y_train, using mathematical principles such as the least squares method. When the error between the predicted value and the actual value reaches the set value, the trained linear regression model is obtained.
3. A dedicated line purchasing method based on traffic prediction according to claim 1, characterized in that: The step 4 is specifically as follows: using the trained linear regression model to make predictions, obtaining the predicted traffic value y_pred through the statement y_pred=model.predict(X_test); including: predicted time dt_hour and predicted traffic predict_traffic, and outputting them as a prediction file.
4. A dedicated line purchasing method based on traffic prediction according to claim 1, characterized in that: The step 5 is specifically as follows: read the prediction file, count the predicted traffic values per hour, and store them as the trafficics list and the workday_traffics list respectively, wherein the trafficics list contains the predicted traffic values for all hours; the workday_traffics list contains the hourly traffic on weekdays; based on the dedicated line procurement cost structure, define the hourly fixed broadband fee as a, the hourly elastic broadband fee as b, and construct a traffic cost calculation function compute_Yi, which uses the fixed broadband purchased traffic x per hour and the predicted traffic mi per hour as parameters; when mi>x, the cost is calculated according to the formula a×x+b×(mi-x)×1.25; when mi≤x, the cost is calculated according to a multiplied by x; Construct the calculation function compute_z of the total traffic cost z of the current statistical period by summing the function compute_Yi over all hourly traffic; Use the minimize function in the scipy.optimize library in combination with the Nelder-Mead algorithm, start the optimization algorithm with lambdax:compute_z(x,traffics) as the objective function; the optimization algorithm iteratively adjusts the fixed broadband purchase traffic x in the search space, and obtains the purchase fixed bandwidth traffic result that minimizes the total traffic cost z by evaluating the changes in the compute_z function value, and performs dedicated line purchases based on the result.
5. A dedicated line purchasing device based on traffic prediction, characterized in that: include: The date file module divides a specified period of time into working days, non-working days and holidays, marks them, integrates them into a data frame, and outputs them as a date file in the xlsx format; The data acquisition module extracts the traffic data corresponding to date, month, hour and weekday according to the time-sharing traffic data files of historical months and the date files as training data; The training model module selects hour, date, whether it is a working day, and whether it is a holiday as input features to construct the feature matrix X_train based on the preprocessed historical traffic data, and uses traffic as the target variable y_train; at the same time, the LinearRegression algorithm in the sklearn.linear_model library is introduced as a linear regression model; the training data is input into the linear regression model to obtain the trained linear regression model; The prediction module uses the trained linear regression model to make predictions and outputs them as prediction files; The procurement module reads the prediction file, uses the minimize function in the scipy.optimize library, and combines it with the Nelder-Mead algorithm to start the optimization algorithm to obtain the result of purchasing fixed bandwidth traffic that minimizes the total traffic cost, and then purchases dedicated lines based on the result.
6. A dedicated line purchasing device based on traffic prediction according to claim 5, characterized in that: The training model module specifically includes: based on the pre-processed historical traffic data, selecting the hour, date, whether it is a working day and whether it is a holiday as input features to construct the feature matrix X_train, and using the traffic as the target variable y_train; at the same time, introducing the LinearRegression algorithm in the sklearn.linear_model library as a linear regression model; Call the model.fit(X_train,y_train) method, input the traffic data corresponding to date, month, hour, and weekday into the linear regression model for model training; during the training, the linear regression model gradually adjusts the internal parameters of the linear regression model based on the relationship between the input feature matrix X_train and the target variable y_train, using mathematical principles such as the least squares method. When the error between the predicted value and the actual value reaches the set value, the trained linear regression model is obtained.
7. The dedicated line purchasing device based on traffic prediction according to claim 5 is characterized in that: The prediction module specifically includes: using the trained linear regression model to perform prediction, obtaining the predicted traffic value y_pred through the statement y_pred=model.predict(X_test); including: predicted time dt_hour and predicted traffic predict_traffic, and outputting them as a prediction file.
8. The dedicated line purchasing device based on traffic prediction according to claim 5 is characterized in that: The purchasing module specifically includes: reading the prediction file, counting the predicted traffic value per hour, and storing them as the trafficics list and the workday_traffics list respectively, wherein the trafficics list contains the predicted traffic value for all hours; the workday_traffics list contains the hourly traffic on weekdays; based on the dedicated line procurement cost structure, defining the hourly fixed broadband fee as a, the hourly elastic broadband fee as b, and constructing the traffic cost calculation function compute_Yi, which uses the fixed broadband purchased traffic x per hour and the predicted traffic mi per hour as parameters; when mi>x, the cost is calculated according to the formula a×x+b×(mi-x)×1.25; when mi≤x, the cost is calculated according to a multiplied by x; Construct the calculation function compute_z of the total traffic cost z of the current statistical period by summing the function compute_Yi over all hourly traffic; Use the minimize function in the scipy.optimize library in combination with the Nelder-Mead algorithm, start the optimization algorithm with lambdax:compute_z(x,traffics) as the objective function; the optimization algorithm iteratively adjusts the fixed broadband purchase traffic x in the search space, and obtains the purchase fixed bandwidth traffic result that minimizes the total traffic cost z by evaluating the changes in the compute_z function value, and performs dedicated line purchases based on the result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.