Refinery plan optimization method containing pre-training agent model

A pre-trained agent model for refinery planning optimizes shadow price computation by leveraging historical data to reduce computation time and ensure real-time refinery planning accuracy.

CN120317440APending Publication Date: 2025-07-15NANJING RICHISLAND INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510479286.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

In the optimization of refinery production plan, the shadow price calculation time of the nonlinear planning model is too long to meet the needs of on-site use, and it is not possible to effectively use the refinery plan to optimize the stability characteristics of crude oil procurement in China.

Method used

The pre-trained proxy model is adopted to train the basic oil seeds and fluctuating oil seed agent models, optimize historical data using refinery plans, build and fine-tune the proxy model, and reduce shadow price calculation time.

Benefits of technology

The calculation time of shadow price is greatly shortened, which can meet the needs of on-site use and improve the accuracy and real-time calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120317440A_ABST
    Figure CN120317440A_ABST
Patent Text Reader

Abstract

The invention discloses a pre-training agent model-containing refinery plan optimization method. The method is characterized by comprising the following steps of S1, obtaining an original optimization result; s2, in all the constraint conditions, the numerical value of the right-end item is changed, and a refinery plan optimization new mathematical model is obtained; s3, solving the new mathematical model by using the agent model containing pre-training to obtain an optimization result f (coni) of each constraint coni in the new mathematical model; s4, the shadow price of the constraint coni is equal to f (coni)-fori, and the fori represents the value of the constraint cons1 in the original optimization result. By adopting the method for optimization, the shadow price calculation time is greatly shortened, and the field use requirement can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of refinery production optimization, belonging to the new generation of information technology, and specifically relates to a refinery planning optimization method containing a pre-trained agent model. Background Art

[0002] In the scenario of refinery production planning optimization, the shadow price is a key indicator for measuring resource scarcity and decision-making priority. It guides resource allocation and investment decisions by reflecting the marginal contribution of constraint conditions to the objective function. However, the model for refinery production planning optimization is relatively complex:

[0003] Nonlinear relationship: In actual production, variable interactions often exhibit nonlinearity (such as the product relationship between chemical reaction rate and temperature and pressure), and a nonlinear programming (NLP) model needs to be constructed.

[0004] Large-scale constraints: The refinery optimization model usually contains tens of thousands of constraints, covering multi-dimensional conditions such as equipment production capacity, raw material supply, and environmental protection restrictions.

[0005] Therefore, in the scenario of refinery production planning optimization, especially the calculation of the shadow price of the nonlinear programming model has become a difficult point.

[0006] In the traditional solution, an optimization solver is used to calculate the shadow price, such as Figure 1 and Figure 2 which includes the following steps:

[0007] 1. Model construction: Convert the actual production rules into mathematical expressions (such as maximizing profit for the objective function and describing equipment production capacity limitations for the constraint conditions).

[0008] 2. Solver selection: Use nonlinear solvers such as IPOPT and KNITRO, and rely on the interior point method or sequential quadratic programming (SQP) algorithm to find the optimal solution.

[0009] 3. Calculate the current plan optimization and obtain the optimal solution f ori ;

[0010] 4. Calculate the shadow price for all constraints until all are completed:

[0011] For each constraint con i perturb the right-hand side by one unit (such as 1) to form a new model

[0012] Use the solver to re-solve and calculate the new optimal solution f(con i )

[0013] And calculate the difference between the optimal solutions, Δf i = f(con i ) - f ori

[0014] The shadow price of the constraint con i is Δf i .

[0015] Example 1:

[0016] The mathematical model for optimizing the refinery plan is as follows. That is, when the value range of all variables is 0 ≤ x i ≤ ∞, and simultaneously satisfying the constraint conditions cons1 to cons5 (where cons1 to cons4 are all non-linear constraints), how to take the values of x1 to x5 so that f ori = x1 + x2 + x3 + x4 + x5 takes the maximum value.

[0017] max f ori = x1 + x2 + x3 + x4 + x5

[0018] 0 ≤ x i ≤ ∞

[0019]

[0020] Using a solver to solve this model, when x1 = 10, x2 = 20, x3 = 0, x4 = 0, x5 = 0, f ori can reach the maximum value of 30.

[0021] Calculate the shadow prices of the constraints cons1 to cons5. For example:

[0022] When adding one unit to the right - hand side of the constraint cons1, that is, cons1: x1 + x2x4 + x3 ≤ 11, use the solver to solve the new model again. The maximum value of f(con1) is 30.05. So, Δf1 = f(con1) - f ori = 30.05 - 30 = 0.05, that is, the shadow price of the constraint cons1 is 0.05;

[0023] When adding one unit to the right - hand side of the constraint cons2, that is, cons2: x2 + 5x3x4 + x3 + x5 ≤ 21, use the solver to solve the new model again. The maximum value of f(con2) is 31. So, Δf2 = f(con2) - f ori = 31 - 30 = 1, that is, the shadow price of the constraint cons2 is 1.

[0024] Example 2:

[0025] For a non - linear programming problem with 2000 constraints, it takes 1 minute to solve it once. Calculating the shadow prices of all constraints in total requires 2000 * 1 = 2000 minutes = 33.33 hours. This time completely exceeds the on - site usage requirements.

[0026] The above - mentioned solution has the following disadvantages:

[0027] Disadvantage 1: The calculation time of shadow prices is too long to meet the on - site usage requirements. For example, for a refinery planning optimization problem, it can be modeled as a non - linear programming problem with 2000 constraints. It takes 1 minute to perform one optimization. Therefore, calculating 2000 shadow prices requires 2000 * 1 / 60 = 33.33 hours, which cannot meet the production requirements.

[0028] Disadvantage 2: Each time the plan is optimized, it is necessary to recalculate, without making use of the stability characteristics of crude oil procurement in refinery plan optimization. Summary of the Invention

[0029] In view of the problems existing in the background technology, the present invention proposes a refinery plan optimization method containing a pre - trained proxy model.

[0030] Technical Solution:

[0031] A refinery plan optimization method containing a pre - trained proxy model, which includes the following steps:

[0032] S1. Obtain the original optimization result;

[0033] S2. In all constraint conditions, change the numerical value of the right - hand side term to obtain a new mathematical model for refinery plan optimization;

[0034] S3. Use the proxy model with pre - training to solve the new mathematical model, and obtain the optimization result f(con i of each constraint con in the new mathematical model. i )

[0035] S4. The shadow price of constraint con i = f(con i ) - f ori , where f ori represents the value of constraint cons1 in the original optimization result.

[0036] Preferably, the proxy model with pre - training is obtained through the following steps:

[0037] S3 - 1. According to the historical data of refinery plan optimization, train the basic oil type proxy model; according to the current refinery plan optimization, construct a training set for the fluctuating oil type proxy model;

[0038] S3 - 2. Use the training set of the fluctuating oil type proxy model to perform fine - tuning training on the basic proxy model to obtain the proxy model with pre - training.

[0039] Preferably, the construction steps of the basic oil type proxy model are as follows:

[0040] (1) Data preparation: Process the historical data of refinery planning optimization to facilitate subsequent calculations;

[0041] (2) Construct basic crude oil types;

[0042] (3) Use Latin hypercube sampling to construct multiple groups of optimization tasks for the procurement quantity range [lower j , upper j of each oil type;

[0043] (4) Perform the following calculations for each group of optimization tasks until all are completed:

[0044] Use an optimization solver to solve;

[0045] One set of data corresponds to one optimization result, that is, one training sample is constructed;

[0046] All the above samples are used as the training set of the basic oil type surrogate model;

[0047] (5) Train the basic oil type surrogate model; The training of the basic oil type surrogate model is completed.

[0048] Preferably, use the historical data of the latest several months to update the basic oil type surrogate model for the next planning optimization.

[0049] Preferably, the construction of the training set of the fluctuating oil type surrogate model includes the following steps:

[0050] (1) Data preparation: Process the current planning optimization data;

[0051] (2) Combine the historical data of refinery planning optimization and process the fluctuation amplitude data of the processing volume of the current planning optimization oil types;

[0052] (3) Use Latin hypercube sampling to construct multiple groups of optimization tasks for the procurement quantity range [lower j , upper j of each oil type in the current planning optimization;

[0053] (4) Perform the following calculations for each group of optimization tasks until all are completed:

[0054] Use an optimization solver to solve;

[0055] One set of data corresponds to one optimization result, that is, one training sample is constructed;

[0056] (5) All the above samples are used as the training set of the fluctuating oil type surrogate model.

[0057] Preferably, the training set of the fluctuating oil type surrogate model is performed in real time for each planning optimization.

[0058] Advantages of the present invention

[0059] (1) Utilize the stability characteristics of crude oil procurement in refinery plan optimization to pre-train the surrogate model for the stable part;

[0060] (2) The basic model is trained using rolling historical data to ensure the real-time performance of the model and more accurate calculation of shadow prices;

[0061] (3) The calculation time of shadow prices is significantly shortened, meeting the on-site usage requirements. Description of the drawings

[0062] Figure 1 It is the flow chart for solving the plan optimization problem in the background technology.

[0063] Figure 2 It is the flow chart for calculating shadow prices using an optimization solver in the background technology.

[0064] Figure 3 It is the flow chart for training a traditional surrogate model.

[0065] Figure 4 It is the flow chart for calculating shadow prices using a traditional surrogate model.

[0066] Figure 5 It is the flow chart for constructing the surrogate model of the base oil type of the present invention.

[0067] Figure 6 It is the flow chart for constructing the training set of the surrogate model for volatile oil types of the present invention.

[0068] Figure 7 It is the flow chart for training the surrogate model with pre-training of the present invention.

[0069] Figure 8 It is the flow chart for calculating shadow prices using the surrogate model with pre-training of the present invention. Detailed implementation manners

[0070] The present invention will be further described below in conjunction with embodiments, but the protection scope of the present invention is not limited thereto:

[0071] I. Surrogate model

[0072] A surrogate model is a simplified model that replaces high-complexity physical simulations or numerical calculations through mathematical approximation, and its core goal is to reduce computational costs and retain key input-output relationships.

[0073] Typical types of surrogate models include polynomial response surfaces, Gaussian process regression, neural networks, support vector regression, etc. Among them, neural networks can handle highly nonlinear and large-scale data and are very suitable for solving shadow prices of nonlinear programming problems.

[0074] The surrogate model requires time investment for training in the early stage. After the training is completed, only extremely short time (in milliseconds) is needed for a single calculation of the shadow price using the surrogate model. Thus, the calculation time of the shadow price in the planning optimization is significantly reduced.

[0075] 1) The training of the traditional surrogate model is as Figure 3 shown below:

[0076] (1) Data preparation: Process the historical data of the refinery planning optimization to facilitate subsequent calculations;

[0077] (2) Use Latin hypercube sampling to construct multiple groups of optimization tasks;

[0078] (3) Perform the following calculations for each group of optimization tasks until all are completed:

[0079] Use the optimization solver to solve;

[0080] One set of data corresponds to one optimization result, that is, one training sample is constructed;

[0081] (4) All the above samples are used as the training set of the traditional surrogate model;

[0082] (5) Train the traditional surrogate model;

[0083] The training of the traditional surrogate model is completed.

[0084] 2) Using the traditional surrogate model to calculate the shadow price is as Figure 4 shown below:

[0085] Calculate the shadow price of all constraints until all are completed:

[0086] For each constraint con i perturb the right-hand side by one unit (such as 1) to form a new model;

[0087] Use the solver to solve again and calculate the new optimal solution f(con i );

[0088] And calculate the difference between the optimal solutions, Δf i = f(con i ) - f ori ;

[0089] The shadow price of the constraint con i is Δf i .

[0090] II. Advantages and Disadvantages of the Surrogate Model

[0091] 1) The core advantages of the surrogate model

[0092] Extremely fast single - solution speed: In the prediction stage of the surrogate model (such as neural network), only simple mathematical operations (such as matrix multiplication or forward propagation of activation function) are required, which takes milliseconds;

[0093] Parallelization support: The surrogate model can process multiple input requests simultaneously;

[0094] Adapt to high - dimensional complex problems: Through dimensionality reduction techniques (such as principal component analysis) or deep neural networks, it can effectively handle high - dimensional input spaces and break through the dimensionality limitations of traditional optimization algorithms.

[0095] For example, for a non - linear programming problem with 2000 constraints, the time for the surrogate model to calculate the shadow price once is 10 milliseconds, and the time to calculate the shadow prices of all constraints is 2000 * 10 = 20000 milliseconds = 20 seconds.

[0096] 2) Core disadvantages of the surrogate model

[0097] High time cost in the early training stage:

[0098] It takes a long time in the data generation stage. A large number of samples need to be generated in advance through simulation or experiment, and each sample needs to be calculated by the solver.

[0099] For example, for a non - linear programming problem with 2000 constraints, a single solution takes 1 minute. And 20000 training samples are needed, and the training duration is 20000 * 1 = 20000 minutes = 333.3h.

[0100] (1) Characteristics of refinery planning optimization

[0101] Refinery planning optimization has significant characteristics of crude oil procurement stability. For example,

[0102] Long - term agreement lock - in: Refineries usually sign annual / cross - annual crude oil supply agreements with suppliers. For example, the proportion of Middle East crude oil is more than 60% and the monthly arrival volume fluctuation is less than ±5%.

[0103] Rigidity of process adaptation: Specific refinery units (such as heavy oil hydrocracking) have strict restrictions on technical indicators such as crude oil API degree and sulfur content. Equipment modification support is required for changes in procurement varieties.

[0104] Inertia of the supply chain: The crude oil shipping cycle is as long as 30 - 60 days, and procurement decisions need to be determined 2 - 3 months in advance, with limited adjustment space between months.

[0105] The current refinery planning optimization mode is that every time (such as monthly or ten - day) the plan is optimized, relevant mathematical models need to be reconstructed and all variables (such as crude oil procurement volume, blending ratio) need to be re - solved, and 80% of the parameters are the same as those in the historical period. This results in a large amount of calculation and too long shadow price calculation time.

[0106] (2) Base Oil Type Agent Model

[0107] Based on the stability characteristics of refinery plan optimization, a base oil type agent model can be generated according to the procurement stability data in the historical data of refinery plan optimization, as Figure 5 shown. The base oil type agent model can depict the stability of refinery plan optimization. Therefore, this model can be pre-trained and only needs to be fine-tuned on this basis each time the plan is optimized.

[0108] The steps for constructing the base oil type agent model are as follows:

[0109] (1) Data preparation: Process the historical data of refinery plan optimization for subsequent calculations;

[0110] (2) Construct the base crude oil types; for example, a certain refinery usually purchases M types of crude oil, and the historical procurement volume range of each type of crude oil oil j is [lower j , upper j , j = 1, 2,..., M.

[0111] (3) Use Latin Hypercube Sampling to construct multiple groups of optimization tasks for the procurement volume range [lower j , upper j of each oil type;

[0112] (4) Perform the following calculations for each group of optimization tasks until all are completed:

[0113] Use an optimization solver to solve;

[0114] One set of data corresponds to one optimization result, that is, one training sample is constructed;

[0115] (5) All the above samples are used as the training set of the base oil type agent model;

[0116] (6) Train the base oil type agent model; the training of the base oil type agent model is completed.

[0117] Among them, Latin Hypercube Sampling (LHS) is a sampling method widely used in Monte Carlo simulation, which can efficiently obtain representative sample points from a multi-dimensional parameter space. The following is an introduction from aspects such as basic principles, steps, advantages and disadvantages, and application fields:

[0118] The core idea of Latin hypercube sampling is to divide the value range of each input variable into several non - overlapping intervals with equal probabilities. Then, a value is randomly selected within each interval to obtain a sample point of the variable. In this way, it can be ensured that the sample points of each variable are uniformly distributed within its value range, and the sample points of different variables are independent of each other.

[0119] Suppose we want to sample n variables, where the value range of each variable is [a i ,b i , i = 1, 2,..., n, and the number of sampling points is m. The specific steps are as follows:

[0120] 1) Divide the intervals. Divide the value range [a i ,b i of each variable into m sub - intervals with equal probabilities, that is, the length of each sub - interval is Δ i =(b i - a i ) / m.

[0121] 2) Generate random numbers. For each variable, generate a uniformly distributed random number within each sub - interval.

[0122] 3) Combine the sample points. Combine the random numbers of each variable to form an n - dimensional sample point. Repeat this process m times to obtain m sample points.

[0123] (3) Training set of the surrogate model for fluctuating oil types

[0124] Each time the plan is optimized, the purchased oil types and their processing volumes will change compared with the historical data. For the changing oil types, a training set of the surrogate model for fluctuating oil types can be constructed. As Figure 6 shown, the steps are as follows:

[0125] (1) Data preparation. Process the current plan optimization data;

[0126] (2) Combine the historical data of refinery plan optimization and process the fluctuation amplitude data of the current plan optimization oil type processing volume;

[0127] (3) Use Latin hypercube sampling to construct multiple groups of optimization tasks for the purchase volume interval [lower j ,upper j of each oil type in the current plan optimization;

[0128] (4) Perform the following calculations for each group of optimization tasks until all are completed:

[0129] Use the optimization solver to solve;

[0130] A set of data corresponds to an optimization result, that is, a training sample is constructed;

[0131] (5) All the above samples are used as the training set of the proxy model for fluctuating oil types.

[0132] (4) Proxy model with pre-training

[0133] The training steps of the proxy model with pre-training are as Figure 7 shown, specifically including:

[0134] (1) Optimize the historical data according to the refinery plan to train the proxy model for basic oil types;

[0135] (2) Optimize according to the current refinery plan to construct the training set of the proxy model for fluctuating oil types;

[0136] (3) Use the above training set to fine-tune and train the basic proxy model;

[0137] (4) The training of the proxy model with pre-training is completed.

[0138] (5) Steps for calculating the shadow price of the proxy model with pre-training

[0139] The training of the basic proxy model takes a long time, but this model depicts the stability of refinery plan optimization. Therefore, the training of this model can be carried out in advance. To ensure the real-time performance of the basic proxy model, after each plan optimization ends, immediately use the historical data of the latest several months to update the basic proxy model for the next plan optimization. The training set of the proxy model for fluctuating oil types is carried out in real time for each plan optimization.

[0140] Using the proxy model with pre-training to calculate the shadow price is as Figure 8 shown:

[0141] Calculate the shadow price of all constraints until all are completed:

[0142] For each constraint con i perturb the right-hand side by one unit (such as 1) to form a new model

[0143] Use the solver to re-solve and calculate the new optimal solution f(con i )

[0144] And calculate the difference between the optimal solutions, Δf i = f(con i ) - f ori

[0145] The shadow price of the constraint con i is Δf i

[0146] Example:

[0147] Suppose a refinery conducts plan optimization once a month, usually at the end of each month for the next month. The historical data for each training is the plan optimization data for the past 12 months. For example, at the end of January 2025, the plan for February 2025 is optimized, and the historical data used is from January 2024 to December 2024; at the end of February 2025, the plan for March 2025 is optimized, and the historical data used is from February 2024 to January 2025, and so on. The real-time rolling of historical data can ensure the real-time nature of the basic agent model and can more accurately depict the stability characteristics of plan optimization.

[0148] However, the training time of the basic agent model is relatively long and it does not use the data of the current month. Therefore, the training of the basic agent model can be carried out at the beginning of each month. For example, in January 2025, the basic agent model is trained using the historical data from January 2024 to December 2024. As shown in Table 1, for the training of a non-linear model with 2000 constraints, 20000 samples are required, and the single-threaded calculation takes 333 hours, while the N-threaded calculation takes 333 / N hours.

[0149] In the last 1-2 days of each month, the plan for the next month starts to be optimized. For example, on January 30, 2025, the plan for February 2025 is optimized. First, the historical data consistent with the basic agent model (from January 2024 to December 2024) is used to construct a training set for the fluctuating oil type agent model, which requires 500 samples. Then, the basic oil type agent model is fine-tuned to complete the training of the agent model with pre-training. The single-threaded calculation takes 8.3 hours, and the N-threaded calculation takes 8.3 / N hours. Then, the shadow prices of 2000 constraints are calculated, and the single-threaded calculation takes 10 seconds. The plan optimization for the next month is completed.

[0150] At the beginning of the next month, production is carried out according to the plan optimization results. At the same time, the basic oil type agent model is re-trained for the plan optimization of the month after next.

[0151] Table 1 Example of plan optimization of the agent model with pre-training

[0152]

[0153] Therefore, during each plan optimization, the calculation time of the shadow price is reduced from 333.33 hours in the original plan to 8.3 hours, which is only 2.5% of the original plan duration.

[0154] The specific embodiments described in this article are only examples to illustrate the spirit of the present invention. Those skilled in the technical field to which the present invention belongs can make various modifications or supplements to the described specific embodiments or use similar methods for substitution, but will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.

Claims

1. A refinery plan optimization method containing a pre-trained proxy model, characterized in that It includes the following steps: S1. Obtain the original optimization result; S2. In all constraint conditions, change the numerical value of the right-hand side term to obtain a new mathematical model for refinery plan optimization; S3. Solve the new mathematical model using the pre-trained surrogate model to obtain the optimization result f(con i ) of each constraint con in the new mathematical model i ) in the new mathematical model; S4. Constraint con i Shadow price of = f(con i ) - f ori , where f ori represents the value of constraint cons1 in the original optimization result.

2. The method according to claim 1, wherein The pre-trained surrogate model is obtained through the following steps: S3-1. According to the historical data of refinery plan optimization, train the surrogate model for basic oil types; according to the current refinery plan optimization, construct a training set for the surrogate model of fluctuating oil types; S3-2. Use the training set of the surrogate model of fluctuating oil types to perform fine-tuning training on the basic surrogate model to obtain a pre-trained surrogate model.

3. The method according to claim 2, wherein The construction steps of the surrogate model for basic oil types are as follows: (1) Data preparation, process the historical data of refinery plan optimization for subsequent calculations; (2) Construct basic crude oil types; (3) Using Latin hypercube sampling, construct multiple groups of optimization tasks for the procurement quantity interval [lower j , upper j for each oil type; (4) Perform the following calculations for each group of optimization tasks until all are completed: Use an optimization solver for solution; One set of data corresponds to one optimization result, that is, one training sample is constructed; All the above samples are used as the training set for the surrogate model of basic oil types; (5) Train the surrogate model for basic oil types; the training of the surrogate model for basic oil types is completed.

4. The method according to claim 3, wherein Use the historical data of the latest several months to update the surrogate model for basic oil types for the next plan optimization.

5. The method according to claim 2, wherein The construction of the training set for the surrogate model of fluctuating oil types includes the following steps: (1) Data preparation, process the current plan optimization data; (2) Combine the historical data of refinery plan optimization and process the fluctuation amplitude data of the processing volume of the current plan optimization oil types; (3) Use Latin hypercube sampling to construct multiple groups of optimization tasks for the procurement quantity intervals [lower j , upper j of each oil type in the current plan; (4) Perform the following calculations for each group of optimization tasks until all are completed: Use an optimization solver for solution; One set of data corresponds to one optimization result, that is, one training sample is constructed; (5) All the above samples are used as the training set for the surrogate model of fluctuating oil types.

6. The method according to claim 5, wherein The training set for the surrogate model of fluctuating oil types is carried out in real time for each plan optimization.