Data processing method and device
By determining the initial state value of the linear programming problem in the supply chain scenario and using the diffusion model for denoising, the initial basis selection is optimized, and the different optimal solutions problems caused by unreasonable initial basis selection is solved, and the accuracy of linear planning is improved and efficiency.
Patent Information
- Application Number
- CN202411046487.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-19
AI Technical Summary
In the supply chain scenario, the unreasonable initial basis selection of the linear programming problem leads to different paths of the optimal solution, affecting the accuracy and efficiency of the optimal solution.
By determining the initial state value of the decision variable in a linear programming problem and using the diffusion model for iterative denoising, the state value of the decision variable is optimized to determine the optimal initial basis.
The accuracy and efficiency of the optimal solution determination process of linear programming problems are improved, and the reasonable choice of the optimal basis in the supply chain scenario is ensured.
Smart Images

Figure CN118982143A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] In supply chain scenarios, linear programming (LP) is often needed to determine the planning values of each planning object. For example, taking product supply as an example, it is necessary to determine the quantity of various products to be generated based on linear programming; in scenarios such as supply chain network deployment, the location or capacity of objects such as factories or warehouses to be deployed is required.
[0003] Solving linear programming problems is generally based on the selection of an initial basis, and the initial basis is continuously updated using methods such as the simplex method to obtain the optimal basis, thereby determining the optimal solution based on the optimal basis. Different initial bases may lead to different paths for searching for the optimal solution, which will naturally lead to different optimal solutions. It can be seen that the reasonable selection of the initial basis is a prerequisite for quickly and accurately determining the optimal solution of the linear programming problem in the supply chain scenario. However, at present, the initial basis is generally selected based on some rules and strategies summarized from experience, and the selected initial basis is often inappropriate. Summary of the invention
[0004] On the one hand, the present application provides a data processing method, comprising:
[0005] Determine a problem description feature of a linear programming problem between multiple planning objects in a target supply chain scenario, wherein the problem description feature is used to characterize the features of each decision variable in the linear programming problem and the constraint relationship between each decision variable;
[0006] Determine the initial state value of each decision variable, wherein the initial state value is used to indicate whether the decision variable is used as a basic variable;
[0007] Based on the problem description characteristics, the initial state values of the decision variables are iteratively denoised using a diffusion model to obtain the optimal state value of each decision variable;
[0008] Based on the optimal state value of each decision variable, an initial basis of the linear programming problem is determined, and the initial basis is a basis for solving the optimal solution of the linear programming problem.
[0009] In a possible implementation, determining the initial state value of each decision variable includes:
[0010] From the set multiple state values, the initial state value of each decision variable is randomly determined, and the initial state value belongs to the multiple state values. The multiple state values include a first state value used to characterize the decision variable as a basic variable, and at least one second state value used to characterize the decision variable as a non-basic variable.
[0011] In another possible implementation, the iterative denoising process of the initial state values of the decision variables using a diffusion model based on the problem description feature includes:
[0012] Taking the initial state value of each decision variable as the state value of each decision variable at the first time step, based on the problem description characteristics, using the diffusion model to iteratively predict the state value of each decision variable at each time step after the first time step;
[0013] The state value of each decision variable predicted by the diffusion model for the last time is determined as the optimal state value of each decision variable.
[0014] In another possible implementation, the iterative prediction of the state value of each decision variable at each time step after the first time step based on the problem description feature using a diffusion model includes:
[0015] According to the set multiple time steps, the current time step is determined in sequence, wherein the first time step is the first time step among the multiple time steps;
[0016] At each current time step, based on the time step feature of the current time step and the state value of each decision variable at the current time step, the feature of each decision variable in the problem description feature is updated using a diffusion model, and based on the updated problem description feature, the state value of each decision variable at the last time step is predicted;
[0017] If the next time step after the current time step is not the last time step, the state value of each decision variable in the next time step is determined based on the currently predicted state value of each decision variable in the last time step and the state value of each decision variable in the current time step.
[0018] In yet another possible implementation, the decision variables in the linear programming problem include at least one basic variable and at least one constraint variable;
[0019] The problem description features include: variable features of each basic variable, constraint features of each constraint variable, and constraint relationships between the basic variables and the constraint variables, wherein the basic variables are variables in the objective function of the linear programming problem, and the constraint variables are residual variables or slack variables corresponding to the linear programming problem;
[0020] The updating of the features of each decision variable in the problem description feature by using a diffusion model based on the time step features of the current time step and the state values of each decision variable at the current time step includes:
[0021] The state value of the decision variable at the current time step is used as a one-dimensional feature, and is added to the feature of the corresponding decision variable in the problem description feature to obtain the problem description feature after the feature is added;
[0022] Based on the time step characteristics of the current time step and the constraint relationship between the basic variables and the constraint variables, the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the problem description characteristics after the characteristics are added are updated.
[0023] In another possible implementation, the problem description features of determining a linear programming problem between multiple planning objects in a target supply chain scenario include:
[0024] Standardize the linear programming problem among multiple planning objects in the target supply chain scenario;
[0025] Determine the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the standardized linear programming problem;
[0026] A bipartite graph for representing the linear programming problem is constructed with the variable characteristics of the basic variable as the first node and the constraint characteristics of the constraint variable as the second node, wherein in the bipartite graph, if there is a constraint relationship between the basic variable corresponding to the first node and the constraint variable represented by the second node, an edge is constructed between the first node and the second node, and the weight of the edge is the weight of the basic variable in the constraint relationship.
[0027] In another possible implementation, the diffusion model is obtained by target training based on sample problem description features and optimal state groups corresponding to at least one linear programming problem sample, so as to identify the optimal state value group from the optimal state value group after forward noise addition;
[0028] The sample problem description feature of the linear programming problem sample is used to characterize the features of each decision variable sample in the linear programming problem sample and the constraint relationship between each decision variable sample;
[0029] The optimal state value group includes the actual optimal state value of each decision variable sample in the linear programming problem sample, and the actual optimal state value of the decision variable sample is used to characterize whether the decision variable sample is a basic variable.
[0030] In another possible implementation, the diffusion model is trained in the following manner:
[0031] Randomly determine the current iteration time step;
[0032] Based on the current iteration time step, forward noise is performed on the actual optimal state value of each decision variable sample in the linear programming problem sample to obtain the noisy state value of each decision variable sample in the linear programming problem sample;
[0033] Based on the sample problem description features of the linear programming problem samples, the noisy state values of the decision variable samples are denoised using the diffusion model to be trained to obtain the predicted optimal state values of the decision variable samples predicted by the diffusion model to be trained;
[0034] If it is determined based on the predicted optimal state value and the actual optimal state value of each decision variable sample in the linear programming problem sample that the training end condition is not met, the model parameters of the diffusion model to be trained are adjusted, and the current iteration time step is returned to be randomly determined until the training end condition is met.
[0035] In another possible implementation, based on the sample problem description feature of the linear programming problem sample, denoising the noisy state value of each decision variable sample by using the diffusion model to be trained includes:
[0036] Based on the time step characteristics of the current iteration time step and the noise state value of each decision variable sample, the characteristics of each decision variable sample in the sample problem description characteristics are updated by using the diffusion model to be trained;
[0037] Based on the sample problem description features after feature update, the predicted optimal state value of each decision variable sample is determined using the diffusion model to be trained.
[0038] In another aspect, the present application further provides a data processing device, comprising:
[0039] A feature determination unit, used to determine a problem description feature of a linear programming problem between multiple planning objects in a target supply chain scenario, wherein the problem description feature is used to characterize a feature of each decision variable in the linear programming problem and a constraint relationship between each decision variable;
[0040] An initial value determination unit, used to determine an initial state value of each decision variable, wherein the initial state value is used to indicate whether the decision variable is used as a basic variable;
[0041] An optimal value determination unit, configured to iteratively denoise the initial state values of the decision variables using a diffusion model based on the problem description feature to obtain the optimal state value of each decision variable;
[0042] The initial determination unit is used to determine the initial basis of the linear programming problem based on the optimal state value of each decision variable, and the initial basis is a basis for solving the optimal solution of the linear programming problem. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0044] Figure 1 A flow chart of a data processing method provided in this application;
[0045] Figure 2 A schematic diagram of another flow chart of the data processing method provided in this application;
[0046] Figure 3 A schematic diagram of an implementation flow for determining the problem description characteristics of a linear programming problem provided in this application;
[0047] Figure 4 A schematic diagram of another flow chart of the data processing method provided in this application;
[0048] Figure 5 A schematic diagram of an implementation principle framework of the data processing method provided in this application;
[0049] Figure 6 A schematic diagram of an implementation flow of the training diffusion model provided in this application;
[0050] Figure 7 A schematic diagram of an implementation principle framework of the training diffusion model provided in this application;
[0051] Figure 8 A schematic diagram of the structure of a data processing device provided by the present application;
[0052] Fig. 9 A schematic diagram of the composition architecture of an electronic device provided in this application. DETAILED DESCRIPTION
[0053] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0054] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0055] The embodiment of the present application provides a data processing method. The data processing method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0056] Reference Figure 1 , Figure 1 The present invention provides a flow chart of a data processing method according to an embodiment of the present invention. The data processing method is applied to an electronic device, which may be a laptop computer, a desktop computer, or a node device in a cloud platform, etc., without limitation. Figure 1 As shown, the data processing method may include steps S101 to S104, and these steps are described in detail below.
[0057] S101, determining the problem description characteristics of a linear programming problem between multiple planning objects in a target supply chain scenario.
[0058] The target supply chain scenario is a business scenario related to the supply chain and requiring planning information of the planning object to be determined.
[0059] For example, the target supply chain scenario can be a product supply scenario. In this case, the linear programming problem can be to determine the production quantity of different products under the premise of minimizing costs or maximizing profits. It can also involve determining the operating time of each production line, so the number of products and the operating time of the production line are both planning objects. For another example, the target supply chain scenario can be a supply chain network point-involved scenario. Then the linear programming problem can be to determine the location and capacity of factories, warehouses, distribution centers, and other outlets involved in the supply chain network when the product transportation cost between the factories, warehouses, distribution centers, and other outlets is minimized or meets specific conditions. At this time, the factories, warehouses, and other outlets are the location and capacity of the planning objects.
[0060] It is understandable that a linear programming problem (also referred to as linear programming) involves an objective function and constraints, which reflect the relationships or conditions that need to be satisfied between decision variables. In order to determine the initial basis of the linear programming problem with the help of a diffusion model, the characteristic relationship between the decision variables in the linear programming problem will be determined in this application. Based on this, it is necessary to first determine the problem description characteristics of the linear programming problem. The problem description characteristics are used to characterize the characteristics of each decision variable in the linear programming problem and the constraint relationship between each decision variable. Among them, the decision variables in the linear programming problem refer to the unknown quantities that need to be decided in the linear programming problem.
[0061] S102, determining the initial state value of each decision variable.
[0062] The initial state value of the decision variable is used to characterize whether the decision variable serves as a basic variable.
[0063] The initial state value of the decision variable has at least two different values. For example, if the initial state value of the decision variable is 1, it indicates that the decision variable will not be used as a base variable; if the initial state value of the decision variable is 0, the decision variable is used as a base variable.
[0064] In practical applications, the initial state value representing the decision variable as a base variable can be a unique specified value, such as the initial state value representing the decision variable as a base variable is 1. However, there can be multiple initial state values representing that the decision variable is not a base variable, and different meanings of the multiple initial state values can be set. For example, there can be two initial state values representing that the decision variable is not a base variable, namely 0 and 2, where 0 and 2 both represent that the decision variable is not a base variable, and 0 represents that the value of the decision variable is the lower bound of the decision variable, while 2 represents that the value of the decision variable is the upper bound of the decision variable.
[0065] It can be understood that for the M×N dimensional coefficient matrix A in the constraint equation system (the equation system composed of constraint conditions) of the linear programming problem, the rank of the coefficient matrix is M, and the M-order square matrix B composed of M linearly independent column vectors of the coefficient matrix A is called the basis. Among them, M≤N, M and N are natural numbers. The M components of the variables corresponding to the basis are basis variables. Among them, any column vector in the basis is a basis vector. Therefore, if a decision variable is a basis variable, then the coefficients corresponding to the decision variable in the coefficient matrix A can constitute a basis vector of the basis.
[0066] On this basis, determining the initial basis suitable for the linear programming problem is essentially to determine which decision variables are suitable as the basis variables corresponding to the initial basis when solving the linear programming problem.
[0067] In the present application, the initial state value of the decision variable can be randomly determined, and then the diffusion model is used to continuously update the initial state value of the decision to ultimately determine whether the decision variable serves as a base variable corresponding to the initial basis.
[0068] In a possible implementation, the possible state values of the decision variables can be pre-set in the present application, based on which the initial state value of each decision variable can be randomly determined from the set multiple state values. The initial state value of each decision variable belongs to the set multiple state values. The set multiple state values include a first state value for characterizing that the decision variable is a basic variable, and at least one second state value for characterizing that the decision variable is a non-basic variable.
[0069] For example, the multiple state values set include 0 and 1, wherein the first state value may be 1, and therefore the initial state value of the decision variable is 1, indicating that the decision variable is a base variable. The second state value may include 0, and if the initial state value of the decision variable is 0, it indicates that the decision variable is not a base variable.
[0070] For another example, the multiple state values set include: 0, 1 and 2. 1 is the first state value, representing that the decision variable is a base variable; 0 and 2 are the second state values, both representing that the decision variable is not a base variable. Further, the second state value 0 represents that the value of the decision variable is the lower bound of the decision variable, and the second state value 2 represents that the value of the decision variable is the upper bound of the decision variable.
[0071] S103, based on the problem description characteristics, the initial state value of each decision variable is iteratively denoised using a diffusion model to obtain the optimal state value of each decision variable.
[0072] In this application, the diffusion model is used to iteratively denoise the initial state value of each decision variable, and finally the state value of each decision variable after denoising can be obtained. The state value of each decision variable finally determined by the diffusion model is called the optimal state value of each decision variable.
[0073] It can be understood that the purpose of iteratively denoising the initial state values of decision variables through the diffusion model is to determine the most suitable state value of each decision variable. Therefore, the optimal state value of the decision variable obtained after iterative denoising also represents whether the decision variable is used as a basic variable. Correspondingly, if the optimal state value of the decision variable represents that the decision variable is a basic variable, it means that when solving the linear programming problem, the decision variable is suitable as a basic variable.
[0074] In the present application, the diffusion model is pre-trained and can optimize the initial state value of each decision variable based on the problem description characteristics of the linear programming problem to ultimately determine which decision variables in the linear programming problem are suitable as base variables.
[0075] For example, in one possible implementation, the diffusion model is trained based on the sample problem description features and optimal state groups corresponding to at least one linear programming problem sample, with the goal of identifying the optimal state value group from the optimal state value group that has been forward-noised.
[0076] The sample problem description features of the linear programming problem samples are used to characterize the features of each decision variable sample in the linear programming problem samples and the constraint relationship between each decision variable sample.
[0077] The optimal state value group includes the actual optimal state value of each decision variable sample in the linear programming problem sample, which is similar to the meaning of the optimal state value of the decision variable. The actual optimal state value of the decision variable sample is used to characterize whether the decision variable sample is a base variable.
[0078] In this application, for the sake of distinction, the linear programming problem used as a training sample to train the diffusion model is called a linear programming problem sample, the problem description features of the linear programming problem sample are called sample problem description features, and the decision variables in the linear programming problem are called decision variable samples.
[0079] Among them, for each linear programming problem sample, the optimal state value group after forward noise addition is obtained by adding noise to each decision variable sample in the optimal state value group. The specific noise addition method may not be restricted, but it is necessary to ensure that the optimal state value after noise addition corresponding to the decision variable sample can still represent whether the decision variable can be used as a base variable. For example, assuming that the state value of the decision variable sample ranges from 0, 1, and 2, the meanings of these values are the same as those introduced above. On this basis, after adding noise to the state value of each decision variable sample, the state value of some or all decision variable samples can be changed, but the state value corresponding to the decision variable sample after noise addition still belongs to one of 0, 1, and 2.
[0080] S104, determining an initial basis of the linear programming problem based on the optimal state value of each decision variable.
[0081] It can be understood that since the optimal state value of the decision variable can characterize whether the decision variable is a basic variable, and the coefficients of the basic variable can constitute a basis vector in a basis, after the basic variable is determined, a basis suitable for the linear programming problem can be obtained, that is, the initial basis in the linear programming problem. Correspondingly, the initial basis can also characterize the decision variables that belong to the basic variables in the linear programming problem.
[0082] Among them, the initial basis is the basis for solving the optimal solution of the linear programming problem. It can be understood that after determining the initial basis of the linear programming problem, the initial basis of the linear programming problem can be continuously optimized to finally obtain the most suitable basis for the linear programming problem, that is, the optimal basis; then, the optimal solution of the linear programming problem can be solved using the optimal basis.
[0083] For example, let's take the simplex method to solve a linear programming problem as an example:
[0084] Before using the simplex method to iteratively solve the linear programming problem, it is necessary to first determine the initial basis, and the solution of the present application determines the initial basis of the linear programming problem. On this basis, in each iteration of the simplex method, a variable that reduces the value of the objective function can be selected, and the basis corresponding to the variable can be deleted, and then a variable that increases the value of the objective function can be selected, and the variable can be used as the basis variable corresponding to the new basis, and the iteration is repeated continuously, and finally a solution that meets the optimal conditions is found, and the optimal solution is obtained.
[0085] Of course, the initial basis determined by the present application is also applicable to scenarios where other algorithms are used to solve linear programming problems, and there is no limitation on this.
[0086] It is understandable that when some algorithms solve the optimal solution of the linear programming problem, the values of non-basic variables may also be used. Based on this, in a possible implementation, the present application can also determine the target value of the non-basic variable based on the optimal state value of each decision variable, and the target value is the upper or lower bound of the non-basic variable. For example, in the previous example, the state value of the decision variable can be 0, 1, and 2. If the optimal state value of the decision variable is 0, it indicates that the decision variable is a non-basic variable, and its target value is the lower bound of the decision variable; if the optimal state value of the decision variable is 2, it indicates that the decision variable is a non-basic variable, and the value of the decision variable is the upper bound of the decision variable.
[0087] It can be understood that in the present application, discrete state values are used to indicate whether a decision variable can be used as a basis variable, and the diffusion model is used to denoise the initial state values of each decision variable, thereby converting the initial basis of the linear programming problem into a problem of optimizing discrete state values with the help of a diffusion model, and finally determining the most suitable state value for each decision variable, and then determining the initial basis that can be represented by the optimal state value of each decision variable.
[0088] From the above content, it can be seen that in this application, discrete state values are used to characterize whether each decision variable is a basic variable. On this basis, based on the problem description characteristics of the linear programming problem in the target supply chain scenario, the diffusion model is used to iteratively denoise the initial state value of each decision variable. By using the diffusion model to simulate the diffusion process of information in the network, the local and global information in the problem description characteristics of the linear programming problem can be effectively captured, and the local information and global information in the problem description characteristics of the linear programming problem can be combined to more accurately predict the optimal state value of each decision variable in the linear programming problem, improve the prediction performance, and then combine the optimal state value of each decision variable to more accurately and reasonably determine the initial basis suitable for the linear programming problem.
[0089] In the embodiment of the present application, the diffusion model may perform iterative denoising on the initial state value of the decision variable according to multiple time steps and the problem description characteristics, and use the diffusion model to perform iterative denoising on the decision variable one by one. For example, at each time step, the diffusion model may be used to perform denoising on the initial state value of each decision variable in combination with the time step characteristics of the time step and the problem description characteristics.
[0090] In a possible implementation, the present application may be: taking the initial state value of each decision variable as the state value of each decision variable at the first time step, based on the problem description characteristics, using the diffusion model to iteratively predict the state value of each decision variable at each time step after the first time step. Accordingly, the state value of each decision variable predicted by the diffusion model for the last time is determined as the optimal state value of each decision variable.
[0091] Among them, the state value of each decision variable predicted by the diffusion model for the last time is also the state value of each decision variable predicted by the diffusion model at the last time step, so that the state value of each decision variable finally determined by the diffusion model at the last time step can be determined as the optimal state value of each decision variable.
[0092] It can be understood that the diffusion model needs to be able to optimize the state value of each decision variable at multiple time steps. In each time step, the diffusion model will update the state value of each decision variable in combination with the problem description characteristics of the linear programming problem, and obtain the state value of each decision variable in the next time step, thereby continuously optimizing the state value of each decision variable, so that the final state value of each decision variable in the last time step can accurately reflect whether each decision variable is suitable as a base variable.
[0093] In combination with this possible implementation, a specific implementation is used as an example to illustrate. Figure 2 , shows another flow chart of a data processing method provided by an embodiment of the present application. The method of this embodiment may include:
[0094] S201, determining the problem description features of a linear programming problem between multiple planning objects in a target supply chain scenario.
[0095] The problem description feature is used to characterize the features of each decision variable in the linear programming problem and the constraint relationship between the decision variables.
[0096] S202, determining the initial state value of each decision variable.
[0097] The initial state value is used to characterize whether the decision variable is used as a basic variable.
[0098] For example, the initial state value of each decision variable can be randomly determined from multiple set state values.
[0099] The above two steps can be referred to the related introduction of the previous embodiment, which will not be repeated here.
[0100] S203, taking the initial state value of each decision variable as the state value of each decision variable in the first time step.
[0101] The first time step is the first time step among the set multiple time steps.
[0102] S204: determining the current time step in sequence according to the set multiple time steps.
[0103] For example, the multiple time steps set have a sequence, and the present application can determine each time step as the current time step in sequence according to the sequence of the multiple time steps. Each time a current time step is determined, step S205 needs to be executed to predict the state value of each decision object in each current time step, so step S204 needs to be repeatedly executed multiple times.
[0104] It can be understood that the denoising process of the diffusion model is carried out in the order of time steps from the back to the front. Therefore, the multiple time steps set in this application are arranged in the order of gradually decreasing time steps. Therefore, the first time step in the multiple time steps is the latest time step. For example, there are 1000 time steps, which are called t0, t1, t2 in the order of time until t 999 , then in the process of predicting the state value based on the diffusion model, the multiple time steps are set in the order from the back to the front, and the multiple time steps are taken as the current time step in sequence, that is, the multiple time steps are set as t 999 ,t 998 ,t 991 Until t0, so the first time step is t 999 , and the last time step is t0.
[0105] It is understandable that since the diffusion model gradually iterates and predicts the optimal state value of each decision variable at each time step, it essentially needs to predict the state value of each decision variable at the last time step through continuous iteration. Therefore, in this application, multiple set time steps can be determined as the current time step in sequence, until the next time step of the current time step is the last time step. Still using the example above with 1000 time steps, this application needs to sequentially determine t 999 ,t 998 ,t 991 Until t1 is determined as the current time step, t0 does not need to be determined as the current time step.
[0106] S205, at each current time step, based on the time step characteristics of the current time step and the state value of each decision variable at the current time step, the characteristics of each decision variable in the problem description characteristics are updated using the diffusion model, and based on the updated problem description characteristics, the state value of each decision variable at the last time step is predicted.
[0107] The time step feature of the current time step is also the feature encoding of the current time step, which can be obtained by performing feature encoding on the current time step, and there is no specific limitation. For example, the time step can be sinusoidal encoded to obtain the time step feature of the time step.
[0108] Among them, the last time step is the last time step among the set multiple time steps, that is, it is the last time step in the order of time steps from back to front. The state value of each decision variable at the last time step is actually the optimal state value of each decision variable expected to be predicted, but in this application, the state value of each decision variable at the last time step is predicted in advance at each time step to continuously optimize the state value of each decision variable at the last time step.
[0109] It can be understood that the problem description feature represents the characteristics of each decision variable in the linear programming problem and the constraint relationship between each decision variable, and in each current time step, the diffusion model is used to update the state value of each decision variable at the current time step and the time step characteristics of the current time to the problem description feature, so that the problem description feature can reflect the characteristics of each decision variable that are suitable as a base variable, so as to ultimately predict the state value of each decision variable at the last time step.
[0110] For example, in a possible implementation, in each current time step, in order to enable the updated problem description feature to more accurately characterize whether each decision variable is used as a base variable, in the present application, the diffusion model may include multiple convolution modules and a state transition module. Accordingly, the present application can use multiple convolution modules in the diffusion model to update the features of each decision variable in the problem description feature in turn based on the time step features of the current time step and the state values of each decision variable at the current time step, and obtain an updated problem description feature. On this basis, based on the features of each decision variable in the updated problem description feature, the state transition module in the diffusion model is used to determine the optimal state value of each decision variable.
[0111] Among them, the convolution module can be a convolution layer in a neural network model. In particular, considering that the problem description feature not only involves the features of the decision variables themselves, but also involves the relationship between the features of different decision variables, based on this, in order to better learn the constraint relationship between different decision variables in the problem description feature, in this application, the convolution module can be a graph convolutional layer (Graph Convolutional Layer, GCL) in a graph neural network (Graph Neural Network, GNN). At present, the convolution module can also have other possibilities, which are not limited.
[0112] Among them, the state conversion module can be used to convert the updated problem description features into the state values of each decision variable at the last time step. For example, the state conversion module can first determine the probability that each decision variable belongs to multiple set state values based on the updated problem description features, and then determine the state value of the decision variable at the last time step based on the probability that each decision variable belongs to multiple state values, for example, the state value with the largest corresponding probability value is determined as the state value of the decision variable at the last time step.
[0113] The state transition module may also have a variety of possible composition structures. For example, the state transition model may include a fully connected layer and a normalization (softmax) layer.
[0114] In the present application, the specific forms of the problem description features of the linear programming problem are different, and the specific implementation of each update of the problem description features in each time step will also be different.
[0115] The following is an explanation of a possible situation:
[0116] In one possible case, in the present application, the decision variables in the linear programming problem may include: at least one basic variable and at least one constraint variable. The basic variable is a variable in the objective function of the linear programming problem, and the constraint variable is a residual variable or a slack variable corresponding to the linear programming problem.
[0117] Among them, in linear programming problems, constraints are usually in the form of inequalities, for example, the constraints involve greater than or equal to, less than or equal to, etc. In order to convert these inequality constraints into equality constraints, slack variables and residual variables are introduced. Among them, if the constraints involve less than or equal to, in order to convert the constraints into equality form, it is necessary to add a non-negative variable, which is the slack variable. If the constraints involve greater than or equal to, in order to convert the constraints into equality form, it is necessary to subtract a non-negative variable, and the subtracted non-negative variable is the residual variable.
[0118] On this basis, in this application, the problem description features may include: variable features of each basic variable, constraint features of each constraint variable, and constraint relationships between basic variables and constraint variables. For ease of distinction, the features of constraint variables are referred to as constraint features.
[0119] Correspondingly, in each current time step, for each decision variable, the state value of the decision variable at the current time step is used as a one-dimensional feature and added to the feature of the decision variable in the problem description feature to obtain the problem description feature after the feature is added. Then, based on the time step feature of the current time step and the constraint relationship between the basic variable and the constraint variable, the variable features of each basic variable and the constraint features of each constraint variable in the problem description feature after the feature is added are updated.
[0120] Among them, for each decision variable, the present application adds the state value of the decision variable at the current time step as a one-dimensional feature of a dimension of the decision variable to the feature of the decision variable in the problem description feature, so that the feature dimension of the decision variable in the problem description feature increases by one dimension, and also enables the problem description feature to include a feature for reflecting whether the decision variable is a base variable. For example, assuming that each decision variable in the problem description feature corresponds to a feature of 6 dimensions before updating, when updating the problem description feature, the state value of the decision variable at the current time step will be added to the feature corresponding to the decision variable included in the problem description feature, so that the feature of the decision variable changes from 6 dimensions to 7 dimensions.
[0121] When updating the variable characteristics of the basic variables and the constraint characteristics of the constraint variables in the problem description characteristics, the variable characteristics of the basic variables may be updated first, and then the constraint characteristics of the constraint variables may be updated; or the constraint characteristics of the constraint variables may be updated first, and then the variable characteristics of the basic variables may be updated.
[0122] For example, when updating the variable characteristics of the basic variables in the problem description characteristics, each target constraint variable that has a constraint relationship with the basic variable can be determined, and based on the constraint relationship between each target constraint variable and the basic variable, the first feature weighted sum of each target constraint variable corresponding to the basic variable is calculated, and the first feature weighted sum is added to the time step feature of the current time step and the variable characteristic of the basic variable to obtain the updated variable characteristic of the basic variable.
[0123] Similarly, when updating the constraint characteristics of the constraint variables in the problem description characteristics, the target basic variables that have a constraint relationship with the constraint variable can be determined, and based on the constraint relationship between each target basic variable and the constraint variable, the second feature weighted sum of the variable characteristics of each target basic variable is determined, and the second weighted sum is added to the time step characteristics of the current time step and the constraint characteristics of the constraint variable to obtain the updated constraint characteristics of the constraint variable.
[0124] S206, if the next time step after the current time step is not the last time step, based on the currently predicted state values of each decision variable in the last time step and the state values of each decision variable in the current time step, determine the state value of each decision variable in the next time step, and return to step S205.
[0125] It is understandable that if the next time step after the current time step is the last time step, then since the last time step does not need to be used as the current time step to execute step S205, it is naturally not necessary to preliminarily predict the state value of each decision variable at the last time step. If the next time step after the current time step is not the last time step, then the next time step needs to be used as the next current time step to return to step S205, so it is necessary to first determine the state value of each decision variable at the next time step.
[0126] Among them, based on the currently predicted state values of each decision variable at the last time step and the state values of each decision variable at the current time step, the present application can combine the posterior probability to predict the state value of each decision variable at the next time step, and the specific implementation is not restricted.
[0127] For example, in a possible implementation, in the current time step, based on the currently predicted state values of each decision variable in the last time step and the state values of each decision variable in the current time step, the posterior probability that each decision variable belongs to the set multiple state values in the next time step after the current time step is determined. Correspondingly, for each decision variable, based on the posterior probability that the decision variable belongs to the set multiple state values in the next time step, the state value of the decision variable in the next time step is determined.
[0128] It is understandable that, since the next time step will also be taken as the new current time step, after determining the state value of each decision variable in the next time step, the next time step is taken as the current time step and step S205 is executed.
[0129] S207, if the next time step after the current time step is the last time step, the state value of each decision variable predicted at the current time step at the last time step is determined as the optimal state value of each decision variable.
[0130] As mentioned earlier, if the next time step is the last time step, it means that the diffusion model has iterated to the last time step. At this time, the state value of each decision variable predicted by the diffusion model at the last time step is the final predicted state value of each decision variable, that is, the optimal state value of each decision variable.
[0131] S208: Determine the initial basis of the linear programming problem based on the optimal state value of each decision variable.
[0132] The initial basis is a basis for finding the optimal solution to the linear programming problem.
[0133] For step S208, reference may be made to the related introduction of the previous embodiment, which will not be described again here.
[0134] It can be understood that in the present application, after the initial state value of each decision variable is determined as the state value of each decision variable in the first time step among the set multiple time steps, in each time step, the characteristics of each decision variable in the problem description feature are updated based on the time step characteristics of the current time step and the state value of each decision variable at the current time step through the diffusion model, and the state value of each decision variable at the last time step is predicted based on the updated problem description feature, so that the state value of each decision variable predicted at each time step is continuously transferred to the problem description feature by using the diffusion model, and the deficiency of the corresponding feature information of each decision variable in the problem description feature is continuously optimized and compensated, so that the characteristics in the problem description feature more comprehensively reflect whether each decision variable is suitable as a basis variable in solving the linear programming problem, thereby being able to further improve the prediction performance of the state value of the predicted decision variable, and then being able to more reasonably determine the initial basis of the linear programming problem.
[0135] It can be understood that in any of the above embodiments of the present application, there may be multiple possibilities for the problem description features of the linear programming problem. In order to more vividly and comprehensively describe the constraint relationship between the basic variables and the constraint variables in the linear programming problem, in a possible implementation, the problem description features in the present application may be in the form of a bipartite graph. Figure 3The specific implementation of the problem description features of linear programming problems using bipartite graphs is explained.
[0136] like Figure 3 , shows a schematic diagram of an implementation process of determining the problem description features of a linear programming problem in the data processing method provided in an embodiment of the present application. This process may include steps S301 to S303:
[0137] S301, standardize the linear programming problem between multiple planning objects in the target supply chain scenario.
[0138] The purpose of standardizing the linear programming problem is to convert the constraint conditions expressed by inequalities in the linear programming problem into equations. In the process of standardizing the linear programming problem, at least one of a slack variable and a residual variable is introduced into the standardized constraint equation obtained by converting the constraint conditions.
[0139] S302, determining the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the standardized linear programming problem.
[0140] The constraint variables may be slack variables or residual variables introduced into the standardized linear programming problem.
[0141] The variable characteristics of the basic variables can reflect the constraints of each basic variable in the standardized linear programming problem. The constraints of the basic variables can include the upper and lower bounds of the basic variables, whether the basic variables are integers or binary variables, etc. Accordingly, the encoding of the basic variables can be determined in combination with the constraints of the basic variables to obtain the variable characteristics of the basic variables.
[0142] The constraint characteristics of the constraint variable can be determined by combining the constraint equation in which the constraint variable is located, the constraint relationship between the constraint variable and the basic variable, and the variable characteristics of the basic variable.
[0143] For example, suppose the objective function in the linear programming problem is: maximizeZ = 3x1 + 2x2;
[0144] And the constraints include:
[0145] x1+x2≤4;
[0146] 2x1+x2≤5;
[0147] x1, x2 ≥ 0;
[0148] Then standardizing the linear programming problem means converting the constraint equations in the constraint conditions from inequality form to equality form. Then the constraint conditions of the standardized linear programming problem can include the following constraint equations:
[0149] x1+x2+s1=4;
[0150] 2x1+x2+s2=5;
[0151] x1, x2, s1, s2 ≥ 0;
[0152] Where Z is the target expected value in the objective function. For example, in the scenario of determining product supply, Z can be the total profit of the product. maximizeZ means that the objective function is the maximum value of Z. Where x1 and x2 are decision variables that already exist before the linear programming problem is standardized, that is, basic variables, and s1 and s2 are constraint variables introduced for standardizing the linear programming problem. In this example, these two constraint variables are slack variables.
[0153] On this basis, the variable characteristics of x1 and x2 can at least indicate that x1 and x2 are values greater than 0. And s1 = 4-x1-x2, therefore, based on the characteristics of x1 and x2, the characteristics of s1 can be determined, and the same is true for s2, which will not be repeated.
[0154] S303 , constructing a bipartite graph for representing the linear programming problem by taking the variable characteristics of the basic variables as the first node and the constraint characteristics of the constraint variables as the second node.
[0155] Among them, a bipartite graph is also called a bipartite graph, which means that the vertex set V can be divided into two non-intersecting subsets, and the two vertices attached to each edge in the graph belong to these two non-intersecting subsets, and the vertices in the two subsets are not adjacent.
[0156] In the present application, in the bipartite graph, if there is a constraint relationship between the basic variable corresponding to the first node and the constraint variable represented by the second node, an edge is constructed between the first node and the second node, and the weight of the edge is the weight of the basic variable in the constraint relationship.
[0157] The weight of the basic variable in the constraint relationship can be the coefficient of the basic variable in the constraint equation corresponding to the constraint relationship. For example, in the above linear programming problem, based on the constraint equations of s2, x1, and x2, there is an edge between the nodes corresponding to s2 and x1 in the bipartite graph, and the weight of the edge is 2; and there is also an edge between the nodes corresponding to s2 and x2, and the weight of the edge is 1.
[0158] In the present application, when a bipartite graph is used to represent the problem description characteristics of a linear programming problem, the process of determining the optimal state value of each decision variable using a diffusion model is similar to the previous one. For details, please refer to the previous related introduction.
[0159] For ease of understanding, the following is an example of an implementation. Figure 4, shows another flow chart of the data processing method provided by the embodiment of the present application. The method of this embodiment may include:
[0160] S401, standardize the linear programming problem between multiple planning objects in the target supply chain scenario.
[0161] S402, determining the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the standardized linear programming problem.
[0162] S403 , constructing a bipartite graph for representing the linear programming problem by taking the variable characteristics of the basic variables as the first node and the constraint characteristics of the constraint variables as the second node.
[0163] In the bipartite graph, if there is a constraint relationship between the basic variable corresponding to the first node and the constraint variable represented by the second node, an edge is constructed between the first node and the second node, and the weight of the edge is the weight of the basic variable in the constraint relationship.
[0164] S404, randomly determining the initial state value of each decision variable from the set multiple state values.
[0165] Among them, each decision variable includes each basic variable and each constraint variable.
[0166] The initial state value belongs to a plurality of set state values.
[0167] For example, the multiple state values include: 0, 1 and 2, wherein the state value 0 is used to characterize that the decision variable is not a basic variable, and the value of the decision variable is its lower bound; the state value 1 is used to characterize that the decision variable is a basic variable; the state value 2 is used to characterize that the decision variable is not a basic variable, and the value of the decision variable is its upper bound.
[0168] S405, taking the initial state value of each decision variable as the state value of each decision variable in the first time step, and determining the first time step as the current time step.
[0169] For example, the multiple time steps set can be multiple time steps arranged in a sorting order from back to front, and the first time step is the first time step in the multiple time steps set, that is, the time step at the end. Based on this, it is necessary to use the diffusion model to gradually predict the state value of each decision variable at the time step at the end, that is, the state value of each decision variable without noise (or after noise removal).
[0170] S406, for each decision variable, taking the state value of the decision variable at the current time step as a one-dimensional feature, and adding it to the node feature corresponding to the node representing the decision variable in the bipartite graph, to obtain a bipartite graph with added features.
[0171] For example, for a basic variable, the state value of the basic variable at the current time step is used as the one-dimensional feature of the first node corresponding to the basic variable, and is added to the node feature of the first node in the bipartite graph. The same is true for constraint variables, which will not be described in detail.
[0172] S407, inputting the time step features of the current time step and the bipartite graph after the features are added into multiple convolution modules of the diffusion model in sequence to obtain an updated bipartite graph.
[0173] In each convolution module, based on the time step features of the current time step and the weights of the edges between the first nodes and the second nodes in the bipartite graph after the features are added, the node features of the first nodes and the second nodes in the bipartite graph after the features are added are updated.
[0174] For example, taking the first node as an example, for each second node connected to the first node, the node feature of the second node is multiplied by the weight of the edge between the second node and the first node to obtain the weighted feature of the second node. Then, the weighted feature sum of the weighted features of the second nodes connected to the first node is calculated, and the weighted feature sum is added to the time step feature of the current time step and the node feature of the first node to obtain the updated node feature of the first node.
[0175] Similarly for the second node, the weighted feature sum of each first node can be calculated based on the node weight of each first node connected to the second node and the weight of the edge connecting each first node to the second node, and then the weighted feature sum is added to the time step feature of the current time step and the node feature of the second node to obtain the updated node feature of the second node.
[0176] In this embodiment, since the problem description feature is a bipartite graph, each convolution module can be a graph convolution layer to more effectively identify and update the node features of each node in the bipartite graph. Among them, through the iteration of multiple graph convolution layers, the node feature information in the bipartite graph can be gradually propagated, thereby obtaining richer features representing the linear programming problem.
[0177] S408, based on the updated bipartite graph, using the state transition module in the diffusion model to determine the state value of each decision variable at the last time step.
[0178] For example, the state transition module may include a fully connected layer and a normalization layer, wherein the probability value of each decision variable having multiple set state values can be determined through the fully connected layer, and then, based on the probability value of the decision variable at different state values, the normalization layer is used to determine the state value of each decision variable to obtain the state value of each decision variable at the last time step.
[0179] S409, determine whether the next time step after the current time step is the last time step, if not, execute step S410; if yes, execute step S412.
[0180] S410, based on the optimal state value of each decision variable and the state value at the current time step, determine the posterior probability that each decision variable belongs to a set plurality of state values at the next time step after the current time step.
[0181] For example, assuming that the current time step is denoted as t, the state value of each decision variable at the current time step is denoted as x t ; The state value of each decision variable predicted at the last time step t0 is represented as x0_pred, and the next time step of the current time step is represented as target_t. Then, it is necessary to calculate the posterior probability q(x) of each decision variable belonging to the set multiple state values at the next time step target_t. target_t |x t ,x0_pred).
[0182] S411, based on the posterior probability that each decision variable belongs to the set multiple state values at the next time step, determine the state value of each decision variable at the next time step, determine the next time step as the current time step, and return to step S406.
[0183] S412, determining the state value of each decision variable predicted at the current time step at the last time step as the optimal state value of each decision variable.
[0184] S413, determining an initial basis of the linear programming problem based on the optimal state value of each decision variable.
[0185] The initial basis is a basis for finding the optimal solution to the linear programming problem.
[0186] like Figure 5 As shown, it shows a simple schematic diagram of the principle of using a diffusion model in the present application to denoise the initial state values of each randomly determined decision variable.
[0187] Depend on Figure 5 It can be seen that after the initial state value of each decision variable in the linear programming problem is randomly determined based on multiple discrete state values, the initial state value of each decision variable is input into the diffusion model as the state value of each decision variable in the first time step, and the bipartite graph used to describe the decision variables in the linear programming problem and the constraint relationship between the decision variables is input into the diffusion model. The diffusion model will iteratively update the bipartite graph in multiple time steps and continuously iteratively infer the state value of each decision variable in the last time step, so as to obtain the optimal state value of each decision variable after denoising.
[0188] In the present application, there may be multiple possible implementations of training the diffusion model, and one possible implementation is described below as an example.
[0189] like Figure 6 , shows a schematic diagram of an implementation process of training a diffusion model in an embodiment of the present application. The training process of this embodiment may include:
[0190] S601, obtaining sample problem description features and optimal state groups corresponding to at least one linear programming problem sample.
[0191] The sample problem description features of the linear programming problem samples are used to characterize the features of each decision variable sample in the linear programming problem samples and the constraint relationship between each decision variable sample.
[0192] It can be understood that the linear programming problem sample is a linear programming problem used as a training sample, and the problem description features of the linear programming problem sample are called sample problem description features. Therefore, the specific form of the sample problem description features of the linear programming problem sample can be similar to the specific form adopted by the problem description features of the previous linear programming problem.
[0193] For example, the decision variable samples in the linear programming problem sample include at least one basic variable sample and at least one constraint variable sample. Correspondingly, the sample problem description features include: variable features of each basic variable sample, constraint features of each constraint variable sample, and constraint relationships between the basic variable samples and the constraint variable samples. Among them, the basic variable samples are variables in the objective function of the linear programming problem sample, and the constraint variable samples are residual variables or slack variables corresponding to the linear programming problem sample.
[0194] Furthermore, the sample problem description feature of the linear programming problem sample can also be a bipartite graph. For the sake of distinction, the bipartite graph used to describe the linear programming problem sample is called a bipartite graph sample. The bipartite graph sample includes at least one first node sample and at least one second node sample. The first node sample is used to characterize the variable characteristics of the basic variable sample in the linear programming problem sample, and the second node sample is used to characterize the variable characteristics of the constraint variable sample in the linear programming problem sample. In the bipartite graph sample, if there is a constraint relationship between the basic variable sample corresponding to the first node sample and the constraint variable sample represented by the second node sample, an edge is constructed between the first node sample and the second node sample, and the weight of the edge is the weight of the basic variable sample in the constraint relationship.
[0195] The specific implementation of constructing the bipartite graph sample of the linear programming problem sample is the same as the previous process of constructing the bipartite graph of the linear programming problem, which will not be repeated here.
[0196] The optimal state value group of the linear programming problem sample includes: the actual optimal state value of each decision variable sample in the linear programming problem sample, and the actual optimal state value of the decision variable sample is used to characterize whether the decision variable sample is used as a base variable.
[0197] For example, the optimal basis on which the optimal solution to the linear programming problem sample is based can be determined, and based on the optimal basis, it can be determined whether each decision variable sample of the linear programming problem sample is a basic variable, thereby obtaining whether each decision variable sample is a basic variable. If the decision variable sample is a basic variable, the actual optimal state value generated for the decision variable sample can characterize the decision variable sample as a basic variable; otherwise, the actual optimal state value generated for the decision variable sample is used to characterize the decision variable as a non-basic variable.
[0198] The actual optimal state value of the decision variable may also belong to the multiple state values set previously. For example, the actual optimal state value may be 0, 1 or 2, and the specific meaning is as described above and will not be repeated here.
[0199] S602, randomly determine the current iteration time step.
[0200] For example, a time step can be randomly selected from multiple set time steps as the current iteration time step. During the diffusion model training process, a time step is randomly selected each time to update the diffusion model, and there is no need to iterate at multiple time steps in sequence each time, so as to improve the training efficiency of the diffusion model.
[0201] S603, based on the current iteration time step, forward noise is performed on the actual optimal state value of each decision variable sample in the linear programming problem sample to obtain the noised state value of each decision variable sample in the linear programming problem sample.
[0202] The noise-added state value is used to characterize whether the decision variable sample is a basic variable of the linear programming problem sample.
[0203] For example, the transfer matrix Q corresponding to the time step t can be set in advance for different time steps t. t On this basis, the actual optimal state value of each decision variable sample can be forward-noised based on the transfer matrix corresponding to the current iteration time step.
[0204] In a possible implementation, forward denoising the actual optimal state value of the decision variable sample based on the transfer matrix can actually be based on the actual optimal state value of the decision variable, and the probability of the decision variable belonging to the set multiple state values is determined by using the transfer matrix. On this basis, after the actual optimal state value of each decision variable sample is converted based on the transfer matrix corresponding to the current iteration time step, after the state conversion feature of each decision variable sample is obtained, polynomial sampling can also be performed on the state conversion feature of each decision variable sample to obtain the noisy state value of each decision variable sample after denoising.
[0205] The state transition characteristics of the decision variable sample are used to characterize the probability that the decision variable sample belongs to different state values. Accordingly, through polynomial sampling, the state value with the maximum probability corresponding to the decision variable sample can be determined, and the state value is used as the noisy state value corresponding to the decision variable sample.
[0206] Furthermore, after determining the noisy state value of the decision variable sample based on the transfer matrix and polynomial sampling, the present application can also add a noise value that conforms to the Zhengtai distribution to the noisy state value of the decision variable sample to obtain the final noisy state value of the decision variable sample.
[0207] S604, based on the sample problem description features of the linear programming problem samples, the diffusion model to be trained is used to denoise the noisy state value of each decision variable sample to obtain the predicted optimal state value of each decision variable sample predicted by the diffusion model to be trained.
[0208] The process of denoising the noisy state value of each decision variable sample using the diffusion model to be trained is similar to the process of denoising the initial state value of the decision variable using the diffusion model. However, at each current iteration time step, the noisy state value of each decision variable is denoised using the diffusion model to be trained based only on the current iteration time step (without the need to perform cyclic iterative denoising at the current iteration time step and other multiple time steps) to predict the state value of each decision variable sample without noise (i.e., predict the optimal state value). The state value of each decision sample without noise can also be the state value of each decision variable at the last time step (the earliest time step).
[0209] In a possible implementation, based on the time step features of the current iteration time step and the noisy state value of each decision variable sample, the feature of each decision variable sample in the sample problem description feature is updated using the diffusion model to be trained. On this basis, the predicted optimal state value of each decision variable sample can be determined based on the sample problem description feature after the feature update using the diffusion model to be trained.
[0210] The process of updating the features of each decision variable sample in the sample problem description features by using the diffusion model to be trained may be similar to the process of updating the features of each decision variable in the sample problem description by using the diffusion model.
[0211] For example, taking the problem description feature sample including: variable features of each basic variable sample, constraint features of each constraint variable sample, and constraint relationship between basic variable sample and constraint variable sample as an example, the noised state value of the decision variable sample at the current iteration time step can be used as a one-dimensional feature, added to the feature of the corresponding decision variable sample in the problem description feature sample, and the problem description feature sample after feature addition is obtained. On this basis, based on the time step feature of the current iteration time step and the constraint relationship between the basic variable sample and the constraint variable sample, the variable features of each basic variable sample and the constraint features of each constraint variable sample in the problem description feature sample after feature addition are updated using the diffusion model to be trained.
[0212] For example, the time step features of the current iteration time step and the problem description feature samples after feature addition are sequentially input into multiple convolution modules of the diffusion model to be trained to obtain updated problem description feature samples. In each convolution module, based on the time step features of the current time step, the variable features of each basic variable sample in the problem description feature sample after feature addition, the constraint features of each constraint variable sample, and the constraint relationship between the basic variable sample and the constraint variable sample, the features of each basic variable and constraint variable in the bipartite graph after feature addition are updated.
[0213] The specific implementation of updating the variable characteristics of the basic variable samples and the constraint characteristics of the constraint variable samples is similar to the previous process of updating the variable characteristics of the basic variables and the constraint characteristics of the constraint variables, and will not be repeated here.
[0214] Furthermore, if the problem description feature sample is a bipartite graph sample, the present application can use the noised state value of the decision variable sample at the current iteration time step as a one-dimensional feature, and add it to the node feature of the node corresponding to the corresponding decision variable in the bipartite graph sample to obtain the bipartite graph sample after the feature is added. Then, the time step feature of the current time step and the bipartite graph sample after the feature is added are sequentially input into multiple convolution modules (such as the convolution layer in the figure) of the diffusion model to be trained to obtain the updated bipartite graph sample.
[0215] Among them, in each convolution module, based on the time step features of the current time step and the weights of the edges between the first node samples and the second node samples in the bipartite graph after the features are added, the node features of the first node samples and the second node samples in the bipartite graph samples after the features are added are updated. For details, please refer to the previous introduction to updating the bipartite graph, which will not be repeated here.
[0216] Among them, based on the updated sample problem description features, the state transition module in the diffusion model to be trained can be used to determine the predicted optimal state value of each decision variable sample, that is, the state transition module in the diffusion model to be trained is used to predict the state value of each decision variable sample in the last time step.
[0217] S605, based on the predicted optimal state value and the actual optimal state value of each decision variable sample in the linear programming problem sample, determine whether the training end condition is met. If yes, end the training and obtain the trained diffusion model; if not, adjust the model parameters of the diffusion model to be trained and return to execute S602.
[0218] The training end condition may be that the number of training iterations reaches a set number, or that the loss function value determined based on the predicted optimal state value and the actual optimal state value of each decision variable sample converges, and there is no restriction on this. The initial value of the number of training iterations is 0, and the number of training iterations is increased by one each time step S604 is executed or after it is determined that the training end condition is not met.
[0219] For easier understanding, see Figure 7 , Figure 7 A principle framework diagram of the training diffusion model in this application is shown.
[0220] Depend on Figure 7 It can be seen that after obtaining the linear programming problem sample, the present application can construct a bipartite graph sample of the linear programming problem sample ( Figure 7 The bipartite graph in the linear programming problem is used to determine the actual optimal state value corresponding to each decision variable in the linear programming problem sample. The actual optimal state value can belong to multiple set state values (such as 0, 1 and 2).
[0221] The actual optimal state value of each decision variable is input into the forward noisy module, and a time step is randomly selected from the set multiple time steps as the current iteration time step in the forward noisy model. Based on the ranking of the current iteration time step in the order of multiple time steps from early to late, the actual optimal state value of each decision variable is subjected to multiple noise addition and polynomial sampling using the conversion matrix corresponding to the current iteration time step, and then the noise conforming to the Zhengtai distribution is superimposed to obtain the noise state value corresponding to each decision variable after noise addition.
[0222] Secondly, the bipartite graph sample, the noisy state value of each decision variable and the current iteration time step are input into the diffusion model to be trained. At the current iteration time step, the diffusion model is trained based on the basic variable sample ( Figure 7 The node characteristics of the nodes corresponding to the basic variables in the constraint variable sample ( Figure 7The node features of the nodes corresponding to the constraint variables in the bipartite graph sample and the weights of the edges between the nodes representing the constraint variable samples and the nodes representing the basic variable samples are used to update the features of each node in the bipartite graph sample. At the same time, when updating the features of each node in the bipartite graph sample, the time step features of the randomly selected current iteration time can also be added to each node of the bipartite graph sample, and finally the updated bipartite graph sample is obtained. The specific implementation of updating the node features of each node in the bipartite graph sample can be introduced in the previous related introduction, which will not be repeated here. Then, based on the updated bipartite graph sample, the state transition module in the diffusion model is used to determine the predicted optimal state value corresponding to each decision variable sample.
[0223] Finally, for each linear programming problem sample, the loss function value is calculated by combining the actual optimal state value and the predicted optimal state value of each decision variable sample in the linear programming problem sample. Based on the loss function value, it is determined whether the training end condition is met. If the training condition has not been met, the model parameters of the diffusion model are adjusted to continuously optimize the diffusion model.
[0224] On the other hand, corresponding to a data processing method provided by the present application, the present application also provides a data processing device. Figure 8 , shows a schematic diagram of a composition structure of a data processing device provided in an embodiment of the present application, the device of this embodiment includes:
[0225] A feature determination unit 801 is used to determine a problem description feature of a linear programming problem between multiple planning objects in a target supply chain scenario, wherein the problem description feature is used to characterize the features of each decision variable in the linear programming problem and the constraint relationship between each decision variable;
[0226] An initial value determination unit 802 is used to determine an initial state value of each decision variable, wherein the initial state value is used to indicate whether the decision variable is used as a basic variable;
[0227] The optimal value determination unit 803 is used to iteratively denoise the initial state value of each decision variable using a diffusion model based on the problem description feature to obtain the optimal state value of each decision variable;
[0228] The initial determination unit 804 is used to determine the initial basis of the linear programming problem based on the optimal state value of each decision variable, and the initial basis is a basis for solving the optimal solution of the linear programming problem.
[0229] In one possible implementation, the initial value determination unit is specifically used to randomly determine the initial state value of each decision variable from a set plurality of state values, wherein the initial state value belongs to the plurality of state values, and the plurality of state values include a first state value for characterizing the decision variable as a basic variable, and at least one second state value for characterizing the decision variable as a non-basic variable.
[0230] In yet another possible implementation, the optimal value determining unit includes:
[0231] An iterative prediction subunit, used to use the initial state value of each decision variable as the state value of each decision variable at the first time step, and based on the problem description characteristics, use the diffusion model to iteratively predict the state value of each decision variable at each time step after the first time step;
[0232] The optimal value determination subunit is used to determine the state value of each decision variable predicted by the diffusion model for the last time as the optimal state value of each decision variable.
[0233] In yet another possible implementation, the iterative prediction subunit includes:
[0234] A time step determination subunit, used to determine the current time step in sequence according to a plurality of set time steps, wherein the first time step is the first time step among the plurality of time steps;
[0235] The iterative processing subunit is used to update the characteristics of each decision variable in the problem description characteristics at each current time step based on the time step characteristics of the current time step and the state value of each decision variable at the current time step by using a diffusion model, and predict the state value of each decision variable at the last time step based on the updated problem description characteristics;
[0236] The state determination subunit is used to determine the state value of each decision variable at the next time step if the next time step after the current time step is not the last time step, based on the currently predicted state value of each decision variable at the last time step and the state value of each decision variable at the current time step.
[0237] In another possible implementation, the decision variables in the linear programming problem determined by the feature determination unit include at least one basic variable and at least one constraint variable; the problem description feature includes: variable features of each basic variable, constraint features of each constraint variable, and constraint relationships between the basic variables and the constraint variables, wherein the basic variables are variables in the objective function of the linear programming problem, and the constraint variables are residual variables or slack variables corresponding to the linear programming problem;
[0238] The iterative processing subunit includes:
[0239] A feature adding subunit, used for adding the state value of the decision variable at the current time step as a one-dimensional feature to the feature of the corresponding decision variable in the problem description feature, so as to obtain the problem description feature after the feature is added;
[0240] The feature updating subunit is used to update the variable features of each basic variable and the constraint features of each constraint variable in the problem description feature after the feature is added based on the time step features of the current time step and the constraint relationship between the basic variables and the constraint variables.
[0241] In yet another possible implementation, the feature determination unit includes:
[0242] A standardization subunit is used to standardize the linear programming problem among multiple planning objects in the target supply chain scenario;
[0243] A feature determination subunit, used to determine the variable features of each basic variable and the constraint features of each constraint variable in the standardized linear programming problem;
[0244] A graph construction subunit is used to construct a bipartite graph for representing the linear programming problem with the variable characteristics of the basic variables as the first node and the constraint characteristics of the constraint variables as the second node, wherein in the bipartite graph, if there is a constraint relationship between the basic variable corresponding to the first node and the constraint variable represented by the second node, an edge is constructed between the first node and the second node, and the weight of the edge is the weight of the basic variable in the constraint relationship.
[0245] In another possible implementation, the diffusion model adopted by the optimal value determination unit is based on the sample problem description features and the optimal state group corresponding to each of at least one linear programming problem sample, so as to identify the optimal state value group from the optimal state value group after forward noise addition as the target training;
[0246] The sample problem description feature of the linear programming problem sample is used to characterize the features of each decision variable sample in the linear programming problem sample and the constraint relationship between each decision variable sample;
[0247] The optimal state value group includes the actual optimal state value of each decision variable sample in the linear programming problem sample, and the actual optimal state value of the decision variable sample is used to characterize whether the decision variable sample is a basic variable.
[0248] In another possible implementation, the diffusion model used by the optimal value determination unit is trained in the following manner:
[0249] Randomly determine the current iteration time step;
[0250] Based on the current iteration time step, forward noise is performed on the actual optimal state value of each decision variable sample in the linear programming problem sample to obtain the noisy state value of each decision variable sample in the linear programming problem sample;
[0251] Based on the sample problem description features of the linear programming problem samples, the noisy state values of the decision variable samples are denoised using the diffusion model to be trained to obtain the predicted optimal state values of the decision variable samples predicted by the diffusion model to be trained;
[0252] If it is determined based on the predicted optimal state value and the actual optimal state value of each decision variable sample in the linear programming problem sample that the training end condition is not met, the model parameters of the diffusion model to be trained are adjusted, and the current iteration time step is returned to be randomly determined until the training end condition is met.
[0253] The present application also provides an electronic device. Fig. 9 , which shows a schematic diagram of a composition structure of the electronic device, and the electronic device at least includes a processor 901 and a memory 902;
[0254] The processor 901 is used to execute the data processing method described in any one of the above embodiments;
[0255] The memory 902 is used to store the program required by the processor to perform operations
[0256] It can be understood that the electronic device may further include a display unit 903 and an input unit 904 .
[0257] Of course, the electronic device may also have Fig. 9 There may be more or fewer components, without limitation.
[0258] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any data processing method provided in the embodiment of the present application.
[0259] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any data processing method provided in the embodiment of the present application.
[0260] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0261] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0262] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0263] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A data processing method, comprising: Determine a problem description feature of a linear programming problem between multiple planning objects in a target supply chain scenario, wherein the problem description feature is used to characterize the features of each decision variable in the linear programming problem and the constraint relationship between each decision variable; Determine the initial state value of each decision variable, wherein the initial state value is used to indicate whether the decision variable is used as a basic variable; Based on the problem description characteristics, the initial state values of the decision variables are iteratively denoised using a diffusion model to obtain the optimal state value of each decision variable; Based on the optimal state value of each decision variable, an initial basis of the linear programming problem is determined, and the initial basis is a basis for solving the optimal solution of the linear programming problem.
2. The data processing method according to claim 1, wherein determining the initial state value of each decision variable comprises: From the set multiple state values, the initial state value of each decision variable is randomly determined, and the initial state value belongs to the multiple state values. The multiple state values include a first state value used to characterize the decision variable as a basic variable, and at least one second state value used to characterize the decision variable as a non-basic variable.
3. The data processing method according to claim 1, wherein the iterative denoising process of the initial state values of each decision variable using a diffusion model based on the problem description feature comprises: Taking the initial state value of each decision variable as the state value of each decision variable at the first time step, based on the problem description characteristics, using the diffusion model to iteratively predict the state value of each decision variable at each time step after the first time step; The state value of each decision variable predicted by the diffusion model for the last time is determined as the optimal state value of each decision variable.
4. The data processing method according to claim 3, wherein based on the problem description feature, the state value of each decision variable at each time step after the first time step is iteratively predicted using a diffusion model, comprising: According to the set multiple time steps, the current time step is determined in sequence, wherein the first time step is the first time step among the multiple time steps; At each current time step, based on the time step feature of the current time step and the state value of each decision variable at the current time step, the feature of each decision variable in the problem description feature is updated using a diffusion model, and based on the updated problem description feature, the state value of each decision variable at the last time step is predicted; If the next time step after the current time step is not the last time step, the state value of each decision variable in the next time step is determined based on the currently predicted state value of each decision variable in the last time step and the state value of each decision variable in the current time step.
5. The data processing method according to claim 4, wherein the decision variables in the linear programming problem include at least one basic variable and at least one constraint variable; The problem description features include: The variable characteristics of each basic variable, the constraint characteristics of each constraint variable, and the constraint relationship between the basic variables and the constraint variables, wherein the basic variables are the variables in the objective function of the linear programming problem, and the constraint variables are the remaining variables or slack variables corresponding to the linear programming problem; The updating of the features of each decision variable in the problem description feature by using a diffusion model based on the time step features of the current time step and the state values of each decision variable at the current time step includes: The state value of the decision variable at the current time step is used as a one-dimensional feature, and is added to the feature of the corresponding decision variable in the problem description feature to obtain the problem description feature after the feature is added; Based on the time step characteristics of the current time step and the constraint relationship between the basic variables and the constraint variables, the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the problem description characteristics after the characteristics are added are updated.
6. The data processing method according to claim 5, wherein the problem description features of determining the linear programming problem between multiple planning objects in the target supply chain scenario include: Standardize the linear programming problem among multiple planning objects in the target supply chain scenario; Determine the variable characteristics of each basic variable and the constraint characteristics of each constraint variable in the standardized linear programming problem; A bipartite graph for representing the linear programming problem is constructed with the variable characteristics of the basic variable as the first node and the constraint characteristics of the constraint variable as the second node, wherein in the bipartite graph, if there is a constraint relationship between the basic variable corresponding to the first node and the constraint variable represented by the second node, an edge is constructed between the first node and the second node, and the weight of the edge is the weight of the basic variable in the constraint relationship.
7. The data processing method according to claim 1, wherein the diffusion model is obtained by target training based on the sample problem description features and the optimal state group corresponding to each of at least one linear programming problem sample, so as to identify the optimal state value group from the optimal state value group after forward noise addition; in, The sample problem description feature of the linear programming problem sample is used to characterize the features of each decision variable sample in the linear programming problem sample and the constraint relationship between each decision variable sample; The optimal state value group includes the actual optimal state value of each decision variable sample in the linear programming problem sample, and the actual optimal state value of the decision variable sample is used to characterize whether the decision variable sample is a basic variable.
8. The data processing method according to claim 7, wherein the diffusion model is trained in the following manner: Randomly determine the current iteration time step; Based on the current iteration time step, forward noise is performed on the actual optimal state value of each decision variable sample in the linear programming problem sample to obtain the noisy state value of each decision variable sample in the linear programming problem sample; Based on the sample problem description features of the linear programming problem samples, the noisy state values of the decision variable samples are denoised using the diffusion model to be trained to obtain the predicted optimal state values of the decision variable samples predicted by the diffusion model to be trained; If it is determined based on the predicted optimal state value and the actual optimal state value of each decision variable sample in the linear programming problem sample that the training end condition is not met, the model parameters of the diffusion model to be trained are adjusted, and the current iteration time step is returned to be randomly determined until the training end condition is met.
9. The data processing method according to claim 8, wherein the step of denoising the noisy state value of each decision variable sample using the diffusion model to be trained based on the sample problem description feature of the linear programming problem sample comprises: Based on the time step characteristics of the current iteration time step and the noise state value of each decision variable sample, the characteristics of each decision variable sample in the sample problem description characteristics are updated by using the diffusion model to be trained; Based on the sample problem description features after feature update, the predicted optimal state value of each decision variable sample is determined using the diffusion model to be trained.
10. A data processing device, comprising: A feature determination unit, used to determine a problem description feature of a linear programming problem between multiple planning objects in a target supply chain scenario, wherein the problem description feature is used to characterize a feature of each decision variable in the linear programming problem and a constraint relationship between each decision variable; An initial value determination unit, used to determine an initial state value of each decision variable, wherein the initial state value is used to indicate whether the decision variable is used as a basic variable; An optimal value determination unit, configured to iteratively denoise the initial state values of the decision variables using a diffusion model based on the problem description feature to obtain the optimal state value of each decision variable; The initial determination unit is used to determine the initial basis of the linear programming problem based on the optimal state value of each decision variable, and the initial basis is a basis for solving the optimal solution of the linear programming problem.
Citation Information
Cited By
Global data sensing method, device and equipment based on diffusion model
CN119988801A
