Model training method, cargo stacking optimization method, device and electronic equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2022-05-27
- Publication Date
- 2026-08-07
AI Technical Summary
[0028]本公开实施例中,通过训练得到I个目标神经网络模型,这样,在将货物堆放至货仓之前,可以以堆放的货物最多为优化目标,构建函数信息。然后,可以先基于目标神经网络模型选择与函数信息对应的决策变量,并基于所选择的决策变量利用混合整数规划求解器对函数信息进行求解,从而可以优化货物堆放的流程。此外,通过训练得到I个目标神经网络模型,如此,可以提高模型训练的效果。
Smart Images

Figure CN114819857B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and more particularly to the field of deep learning technology. Specifically, it relates to a model training method, an optimization method for cargo stacking, an apparatus, and electronic equipment. Background Technology
[0002] Currently, cargo transportation often involves the issue of cargo stacking. To improve space utilization, the stacking process usually needs to be designed based on human experience before stacking to ensure that as much cargo as possible can be stacked without changing the stacking space. Summary of the Invention
[0003] This disclosure provides a model training method, a method for optimizing cargo stacking, an apparatus, and an electronic device.
[0004] According to a first aspect of this disclosure, a model training method is provided for applying to a cargo stacking optimization problem, the method comprising:
[0005] I neural network models are pre-constructed, where I is an integer greater than 1;
[0006] Using a mixed-integer programming solver, the I neural network models are iteratively trained with the first training data to obtain I target neural network models.
[0007] The initialization parameters of the j-th neural network model are associated with the target parameters obtained from training the (j-1)-th neural network model, where j is an integer greater than 1 and less than or equal to 1.
[0008] The neural network model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process of the received function information; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree.
[0009] According to a second aspect of this disclosure, an optimized method for cargo stacking is provided, comprising:
[0010] Obtain third function information and a third set of decision variables. The third function information includes: function information determined with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third set of decision variables includes: variables in the third function information.
[0011] The third function information and the third decision variable set are input into I target neural network models for solving, and I output results are obtained. The solving includes I solution stages, and one solution stage corresponds to one target neural network model.
[0012] Based on the I output results, the solution result of the third function information is determined.
[0013] According to a third aspect of this disclosure, a model training apparatus is provided, comprising:
[0014] A building module is used to pre-build I neural network models, where I is an integer greater than 1;
[0015] The first training module is used to iteratively train the I neural network models using the first training data based on a mixed integer programming solver to obtain I target neural network models.
[0016] The initialization parameters of the j-th neural network model are associated with the target parameters obtained from training the (j-1)-th neural network model, where j is an integer greater than 1 and less than or equal to 1.
[0017] The neural network model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process of the received function information; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree.
[0018] According to a fourth aspect of this disclosure, an optimized cargo stacking apparatus is provided, comprising:
[0019] The acquisition module is used to acquire third function information and a third decision variable set. The third function information includes: function information determined with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third decision variable set includes: variables in the third function information.
[0020] The solution module is used to input the third function information and the third decision variable set into I target neural network models for solution and obtain I output results. The solution includes I solution stages, and one solution stage corresponds to one target neural network model.
[0021] The output module is used to determine the solution result of the third function information based on the I output results.
[0022] According to a fifth aspect of this disclosure, an electronic device is provided, comprising:
[0023] At least one processor; and
[0024] A memory communicatively connected to the at least one processor; wherein,
[0025] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first or second aspect above.
[0026] According to a sixth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first or second aspect above.
[0027] According to a seventh aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first or second aspect.
[0028] In this embodiment, I target neural network models are trained to obtain the desired information. Before stacking goods into the warehouse, the optimization objective is to maximize the amount of goods stacked, thus constructing function information. Then, decision variables corresponding to the function information are selected based on the target neural network models, and a mixed-integer programming solver is used to solve the function information based on the selected decision variables, thereby optimizing the goods stacking process. Furthermore, training I target neural network models improves the effectiveness of model training. Attached Figure Description
[0029] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0030] Figure 1 This is one of the flowcharts of a model training method provided in this embodiment of the disclosure;
[0031] Figure 2 This is a schematic diagram of containers stacked in the ship's hold according to an embodiment of this disclosure;
[0032] Figure 3 This is the second flowchart of a model training method provided in this embodiment of the disclosure;
[0033] Figure 4 This is a schematic diagram of the structure of the neural network model in an embodiment of this disclosure;
[0034] Figure 5 This is a flowchart of an optimized method for stacking goods provided in an embodiment of this disclosure;
[0035] Figure 6 This is one of the structural schematic diagrams of a model training device provided in this disclosure embodiment;
[0036] Figure 7 This is a schematic diagram of the structure of the first training module in an embodiment of this disclosure;
[0037] Figure 8 This is a schematic diagram of the structure of the first training submodule in an embodiment of this disclosure;
[0038] Figure 9This is a schematic diagram of the structure of the updating unit in an embodiment of this disclosure;
[0039] Figure 10 This is a second schematic diagram of the structure of a model training device provided in this embodiment of the present disclosure;
[0040] Figure 11 This is a schematic diagram of the structure of the second training module in an embodiment of this disclosure;
[0041] Figure 12 This is a schematic diagram of the structure of the selection submodule in an embodiment of this disclosure;
[0042] Figure 13 This is a schematic diagram of the structure of an optimized cargo stacking device provided in an embodiment of this disclosure;
[0043] Figure 14 This disclosure provides a block diagram of an electronic device for implementing a model training method or a cargo stacking optimization method. Detailed Implementation
[0044] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0045] Please see Figure 1 This disclosure provides a model training method, which includes the following steps:
[0046] Step S101: Pre-construct I neural network models, where I is an integer greater than 1;
[0047] Step S102: Using the first training data, the I neural network models are iteratively trained based on the mixed integer programming solver to obtain I target neural network models;
[0048] The neural network model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process of the received function information; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree.
[0049] The aforementioned mixed-integer programming solver can be an open-source solver, such as the SCIP solver. The SCIP solver primarily uses the branch-and-bound method to solve mixed-integer optimization problems. First, the SCIP solver builds a solution tree. Then, starting from the root node, it calculates at each node which decision variable should be used for branching. This process of branching and solving for fixed variables leads to the optimal solution. The branch-and-bound method is one of the most commonly used algorithms for solving integer programming problems. This method can solve not only pure integer programming problems but also mixed-integer programming problems. The branch-and-bound method is a search and iterative approach that selects different branch variables and subproblems for branching.
[0050] In related technologies, when solving mixed integer programming problems using the SCIP solver, a decision variable needs to be selected for branching at each step of the solution. However, using SCIP requires calculating the strong branch score for each variable and selecting the variable based on this score, which is a very time-consuming process. Therefore, in this embodiment, a target neural network model is trained and used to replace the decision variable selection process of the SCIP solver, thus improving the solution speed.
[0051] Mixed-integer programming problems typically involve a large number of variables to be solved, often thousands or even tens of thousands, and each solution to a single variable requires an update to the model. Therefore, if only a single model is used for training, the model would need to be updated tens of thousands of times for each training sample. This would lead to difficulties in model learning and convergence.
[0052] Based on this, in this embodiment of the disclosure, the training process for each sample is divided into I stages, and different models are trained for different stages to obtain I target neural network models. For example, in one embodiment of this disclosure, the entire training process can be divided into I stages with a step size of 1000. That is, steps 1-1000 are trained on the first neural network model. After training is completed, the second neural network model is initialized based on the model parameters of the first target neural network model. Then, steps 1001-2000 are trained on the initialized second neural network model. In this way, since each neural network model is further trained based on the knowledge learned by the previous target neural network model, it can be ensured that the model has a good learning effect on the samples. At the same time, since each neural network model only needs to be updated 1000 times per training, the training process of the model can be simplified, ensuring that the model can converge.
[0053] The specific process of using the first training data to train the neural network model based on the mixed integer programming solver can be as follows: the first training data is input into the neural network model, the neural network model selects decision variables from the first decision variable set based on the first function information, and inputs the selected decision variables into the SCIP solver for solving, the SCIP solver generates a reward value based on the solution result, and then returns the reward to the neural network model so that the neural network model can optimize its parameters based on the reward.
[0054] It is understandable that there can be multiple sets of the first training data, and different sets of the first training data correspond to different first function information. By inputting a large amount of the first training data into I neural network models for training, the I target neural network models trained in this way can learn how to select the optimal decision variables in solving mixed integer programming problems using the branch and bound method.
[0055] It is understandable that, in the process of solving the mixed integer programming problem based on the I target neural network models, the first target neural network model can select the first 1-1000 decision variables, the second target neural network model can select the 1001-2000 decision variables, and so on, until all decision variables are selected.
[0056] In this implementation, I target neural network models are trained to obtain the desired information. Before stacking goods into the warehouse, the optimization objective is to maximize the amount of goods stacked, thus constructing function information. Then, decision variables corresponding to the function information are selected based on the target neural network models, and a mixed-integer programming solver is used to solve the function information based on the selected decision variables, thereby optimizing the goods stacking process. Furthermore, training I target neural network models improves the effectiveness of model training.
[0057] Optionally, the first training data further includes first function information and a first set of decision variables, wherein the first function information includes: function information determined with the optimization objective of maximizing the quantity of the first goods stacked in the first warehouse.
[0058] The aforementioned first function information can be viewed as a mixed-integer programming problem to be solved. This first function information can be constructed based on a specific scenario and is intended for a specific problem. For example, in a container stacking scenario at a port, the function information can be constructed based on the type and size of the containers, as well as the dimensions of the warehouse. Please refer to [link to relevant documentation]. Figure 2In one embodiment of this disclosure, it is assumed that two different types of containers need to be stacked in the ship's hold, and the height of the containers matches that of the hold. Therefore, the height effect does not need to be considered during the stacking process, which means the stacking problem can be transformed into a two-dimensional container packing problem. Please refer to [link to relevant documentation]. Figure 2 Assuming the ship's hold has dimensions W*H, the first type of container has dimensions hi*wi, and the second type of container has dimensions hj*wj, then the first set of decision variables can include at least one of the following decision variables: decision variable Pi indicates whether the i-th container should be placed inside; decision variable Lij indicates whether container i is to the left of container j; and Bij indicates whether container i is below container j. Here, (xi, xi) represents the x and y coordinates of the lower left corner of the i-th container if it should be placed inside.
[0059] The first objective function can be:
[0060] The first constraint mentioned above may include:
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067] Thus, the information for the first function mentioned above can be obtained.
[0068] In this embodiment, by including first function information and a first set of decision variables in the first training data, during the training of the neural network model, the neural network model can select corresponding decision variables from the first set of decision variables based on the first function information. Then, it can compare the selected decision variables with the target decision variables and optimize the model parameters based on the comparison results to realize the initial neural network model training process.
[0069] Optionally, the iterative training of the I neural network models to obtain I target neural network models includes:
[0070] Using the j-th training data, the j-th neural network model is iteratively trained based on the mixed integer programming solver to obtain the j-th target neural network model;
[0071] Wherein, when j equals 1, the j-th training data is the first training data;
[0072] When j is not equal to 1, the j-th training data is the training data obtained after updating the first training data based on the decision variables output by the (j-1)-th target neural network model;
[0073] The j is an integer greater than or equal to 1, and the j is less than or equal to the I.
[0074] Specifically, during training, after each selection of a decision variable, the neural network model passes the selected decision variable to the SCJP solver. The SCJP solver fixes the received decision variable's value and branches based on that variable. After branching, the decision variable's value becomes a fixed value. For example, after the (j-1)th target neural network model selects the (j-1)th decision variable, it needs to update the (j-1)th function information and the (j-1)th decision variable set based on the selected (j-1)th decision variable. Specifically, the (j-1)th decision variable in the (j-1)th function information can be updated from a variable to a fixed value to obtain the j-th function information. Simultaneously, the (j-1)th decision variable is removed from the (j-1)th decision variable set to obtain the j-th decision variable set.
[0075] In this implementation, after each selection of decision variables by the neural network model, the function information and the set of decision variables are updated based on the selected decision variables, and the next iteration of training is completed based on the updated function information and the set of decision variables. In this way, the problem of branching based on repeated decision variables during training can be avoided, which is conducive to improving the model training effect.
[0076] Optionally, the mixed-integer programming solver uses the j-th training data to iteratively train the j-th neural network model to obtain the j-th target neural network model, including:
[0077] The model parameters of the j-th neural network model are initialized using the target parameters;
[0078] Using the j-th training data, the j-th neural network model is trained k times using a mixed integer programming solver to obtain the j-th target neural network model.
[0079] Wherein, when j equals 1, the target parameter is the model parameter of the preset model;
[0080] When j is not equal to 1, the target parameter is the model parameter of the (j-1)th target neural network model, and k is an integer greater than or equal to 1.
[0081] The preset model can be a pre-trained model, and the preset model has a certain ability to select decision variables, which can improve the initialization effect of the first neural network model.
[0082] Please see Figure 3 In one embodiment of this disclosure, the entire training process can be divided into I stages with a step size of k. Specifically, steps 1 to k are used to train the first neural network model. After training, the second neural network model is initialized based on the model parameters of the first target neural network model. Then, steps (k+1 to 2k) are trained on the initialized second neural network model. Since each neural network model is trained based on the knowledge learned by the previous target neural network model, it ensures that the model has a good learning effect on the samples. Furthermore, since each neural network model only needs to be updated k times per training iteration, the training process is simplified, ensuring model convergence.
[0083] In this implementation, since each neural network model is trained based on the knowledge learned by the previous target neural network model, it can be ensured that the model has a good learning effect on the samples.
[0084] Optionally, the s-th training iteration in the k-th iteration training includes:
[0085] Input the target training data into the j-th neural network model to obtain the s-th decision variable output by the j-th neural network model. The s-th decision variable is the decision variable corresponding to the [(j-1)*k+s]-th node in the solution tree.
[0086] The target training data and the s-th decision variable are input into the mixed integer programming solver for solving to obtain the prediction result;
[0087] The s-th return value is generated based on the predicted and theoretical results;
[0088] The j-th neural network model is updated based on the s-th reward value;
[0089] When s equals 1, the target training data is the j-th training data;
[0090] When s is not equal to 1, the target training data is: the training data obtained by updating the j-th training data based on the decision variables of the j-th neural network model's (s-1)-th output.
[0091] It is understandable that, when j is not equal to 1, since the training of the j-th neural network model has been completed after the training of the j-1 neural network models before the j-th neural network model, and each neural network model corresponds to k nodes in the solution tree, the s-th decision variable output by the j-th neural network model is: the decision variable corresponding to the [(j-1)*k+s]-th node in the solution tree.
[0092] The theoretical results mentioned above can be obtained by solving the problem without considering that the decision variables are integers. For example,
[0093] When the objective function is: Max: z = p1 + p2
[0094] The constraints of the mixed integer programming problem are:
[0095] 2p³ + 4p⁴ <= 11;
[0096] 3p³ + 5p⁴ <= 15;
[0097] p1>=0 and is an integer;
[0098] p2>=0 and is an integer;
[0099] The theoretical results obtained from the solution are p3 = 2.5 and p4 = 1.5. The theoretical results for the second function information can be calculated by other programs and then passed to the mixed-integer programming solver. Furthermore, the theoretical results for the first function information can also be calculated during the solution process of the neural network model; there are no restrictions on this.
[0100] In one embodiment of this disclosure, the reciprocal of the difference between the predicted result and the theoretical result of the first function information can be used as the s-th reward value. Thus, the closer the predicted result is to the theoretical result, the larger the reward value; conversely, the larger the difference between the predicted result and the theoretical result, the smaller the reward value. For example, if we disregard the integer constraints of p1 and p2, the optimal value of z might be 20. However, in the current case, we need to consider the integer constraints. After selecting the p1 branch, the calculated value of z is 10, so the reward is 1 / (20-10) = 0.1.
[0101] In this model, the j-th neural network can select a decision variable `action` from the `action_set`, and then transmit the selected decision variable to the SCIP solver. The SCIP solver determines the merits of the selected action and generates a corresponding reward value. Simultaneously, the SCIP solver can also determine whether further training is needed. The SCIP solver can output data in the following format: (observe, action_set, action, reward, is_done).
[0102] Here, `observe` is the feature matrix of the mixed-integer programming problem being solved, which can represent a mixed-integer optimization problem without loss; `action_set` represents the set of candidate decision variables under the current `observe`. Since the branch-and-bound method requires selecting a decision variable for branching when solving mixed-integer optimization problems, and the j-th neural network model also outputs a decision variable, the output decision variable is selected in `action_set`; `action` is the decision variable output by the j-th neural network model, `reward` is the reward value of the decision variable selected by the j-th neural network model; `is_done` indicates whether the problem has ended.
[0103] In this implementation, a reward value is generated based on the prediction results and theoretical results. This facilitates the optimization of the model parameters of the neural network model based on the reward value, thereby further improving the effect of the optimized target neural network model on the selection of decision variables.
[0104] Optionally, updating the j-th neural network model based on the s-th reward value includes:
[0105] Based on the difference between the s-th return value and the historical average return value, the s-th return value is standardized to obtain the s-th target return value, wherein the historical average return value is the average of the historical return values output by the mixed integer programming solver;
[0106] The j-th neural network model is updated based on the s-th target reward value.
[0107] Specifically, the return value can be standardized based on the following formula:
[0108]
[0109] Wherein, R is the target return value, r is the return value, mear(r) is the historical average return value, and std(r) is the standard deviation of the historical return value.
[0110] Since existing mixed-integer programming solvers all output positive reward values—that is, regardless of the quality of the decision variables selected by the neural network model—the difference lies in the magnitude of the reward value. For example, the better the decision variables selected by the neural network model, the larger the output reward value.
[0111] In this implementation, the reward value is standardized, so that the standardized target reward value can be either positive or negative. That is, the reward value output by the mixed-integer programming solver can be either positive or negative. This achieves both rewards and penalties during model training, which is beneficial for further improving the model's training effect.
[0112] Optionally, before initializing the model parameters of the j-th neural network model using the target parameters, the method further includes:
[0113] The pre-constructed initial neural network model is iteratively trained based on the second training data to obtain the preset model. The preset model is used to determine the decision variables of each node in the solution tree during mixed-integer programming of the received function information. The second training data includes second function information, a second set of decision variables, and label data. The second function information includes a second objective function and a second constraint condition, with the optimization objective being to maximize the quantity of second goods stacked in the second warehouse. The second set of decision variables includes variables in the second objective function. The label data indicates the target decision variables corresponding to each node in the solution tree during mixed-integer programming of the second function information; the target decision variables are variables in the second set of decision variables.
[0114] The second training data can be training data obtained by solving a mixed-integer programming problem and using the solution results as labels for the mixed-integer programming problem. The mixed-integer programming problem can be obtained from an open-source dataset. It is understood that since solving a mixed-integer programming problem typically involves multiple branches, the label data includes the label data for each branch node in the programming solution.
[0115] In this embodiment, a preset model is obtained by pre-training based on labeled second training data. Then, the model parameters of the preset model are used to initialize the first neural network model. In this way, the problem of cold start in the training process of the first neural network model can be avoided.
[0116] Optionally, the m-th training iteration of the pre-constructed initial neural network model based on the second training data includes:
[0117] The m-th neural network model is trained based on the m-th function information and the m-th decision variable set to obtain the (m+1)-th neural network model;
[0118] Wherein, when m equals 1, the m-th function information is the second function information, the m-th decision variable set is the second decision variable set, and the m-th neural network model is the initial neural network model;
[0119] When m is not equal to 1, the m-th function information is the function information after updating the m-1-th function information based on the m-1-th decision variable, and the m-th decision variable set is the decision variable set after updating the m-1-th decision variable set based on the m-1-th decision variable.
[0120] In this implementation, after each selection of decision variables by the neural network model, the function information and the set of decision variables are updated based on the selected decision variables, and the next iteration of training is completed based on the updated function information and the set of decision variables. In this way, the problem of branching based on repeated decision variables during training can be avoided, which is conducive to improving the model training effect.
[0121] Optionally, the step of training the m-th neural network model based on the m-th function information and the m-th decision variable set to obtain the (m+1)-th neural network model includes:
[0122] The m-th function information and the m-th decision variable set are input into the m-th neural network model to obtain the m-th decision variable output by the m-th neural network model. The m-th decision variable is the decision variable corresponding to the m-th node in the solution tree.
[0123] The m-th loss value is calculated based on the m-th decision variable and the m-th target decision variable, wherein the m-th target decision variable is the target decision variable in the label data corresponding to the m-th node;
[0124] The m-th neural network model is updated based on the m-th loss value to obtain the (m+1)-th neural network model.
[0125] The above calculation of the m-th loss value based on the m-th decision variable and the m-th target decision variable can be achieved using conventional loss value calculation methods. For example, the difference between the m-th decision variable and the m-th target decision variable can be taken, and then the difference can be mapped to a value between 0 and 1, with the mapping result used as the m-th loss value.
[0126] In this implementation, the m-th loss value is calculated based on the m-th decision variable selected by the m-th neural network model and the m-th target decision variable, and the m-th neural network model is updated based on the m-th loss value. This helps to optimize the model parameters of the initial neural network model and improve the selection effect of the optimized network model on the decision variable.
[0127] Optionally, after updating the m-th neural network model based on the m-th loss value to obtain the (m+1)-th neural network model, the method further includes:
[0128] If the (m+1)th neural network model satisfies the first preset convergence condition, the (m+1)th neural network model is determined as the preset model;
[0129] If the (m+1)th neural network model does not meet the first preset convergence condition, the (m+1)th neural network model is iteratively trained based on the (m+1)th function information, the (m+1)th decision variable set, and the label data to obtain the preset model.
[0130] The first preset convergence condition can be that the loss value obtained from a number of consecutive calculations does not fluctuate by more than a preset value. For example, it can be that the loss value obtained from 20 consecutive calculations does not fluctuate by more than 100. That is, when the loss value obtained from 20 consecutive calculations does not fluctuate by more than 100, the (m+1)th neural network model is determined to satisfy the first preset convergence condition. Otherwise, the (m+1)th neural network model is determined not to satisfy the first preset convergence condition.
[0131] In another embodiment of this disclosure, the first preset condition may also be that the number of training sessions exceeds a preset number.
[0132] In this implementation, by pre-setting the convergence conditions of the model and determining whether the trained model meets the convergence conditions after each training session, the problem of overtraining the model can be avoided.
[0133] Optionally, the m-th function information includes the objective function and constraints, and the step of inputting the m-th function information and the m-th decision variable set into the m-th neural network model to obtain the m-th decision variable output by the m-th neural network model includes:
[0134] The m-th function information is converted into a first matrix A, a second matrix B, a third matrix, and a fourth matrix. Different rows in the first matrix are used to represent different variables in the objective function, different rows in the second matrix are used to represent different constraints in the objective function, the third matrix is used to represent the relationship between the variables and the constraints, and the fourth matrix is used to represent the coefficients of the variables in the constraints.
[0135] The first matrix, the second matrix, the third matrix, the fourth matrix, and the m-th decision variable set are input into the m-th neural network model to obtain the score value of each decision variable in the m-th decision variable set output by the m-th neural network model; wherein, the score value can be a probability value;
[0136] Output the m-th decision variable, which is the decision variable with the highest score in the set of m-th decision variables.
[0137] In one embodiment of this disclosure, the process of acquiring the second training data includes:
[0138] First, obtain a mixed-integer programming problem from an open-source dataset, assuming the objective function of the mixed-integer programming problem is: Max: z = p1 + p2
[0139] The constraints of the mixed integer programming problem are:
[0140] 9p1 + 7p2 <= 56;
[0141] 7p1 + 20p2 <= 70;
[0142] p1>=0 and is an integer;
[0143] p2>=0 and is an integer;
[0144] Based on this, the set of decision variables corresponding to the mixed integer programming problem can be determined as (p1, p2), where p1 and p2 are different decision variables.
[0145] Then, the objective function and constraints can be input into Ecole's SCIP. In the first step of SCIP's branch and bound method to solve this problem, a strong branch algorithm is used to select a variable, such as p1, for branching. Simultaneously, the Ecole package outputs four matrices A, B, C, and D based on the current solution state. In matrix A, each row represents a variable pi, and each column represents the features of that variable. In matrix B, each row represents a constraint Sub, and each column represents the features of that constraint. In matrix C, the relationship between variable pi and constraint Sub is represented. In matrix D, the coefficients of variable pi in constraint Sub are represented. These four matrices completely express the specific formula above. In this step, we can collect a sample: [A,B,C,D,(p1,p2),p1]. That is, the four matrices A,B,C,D,(p1,p2) obtained in this step represent the set of decision variables, and p1 represents the variable we selected in this step; p1 is the label of this sample.
[0146] After selecting p1, p1 is returned to SCIP. SCIP will fix the value of p1 and continue solving the subproblem. Solving the subproblem leads to the second step. First, the value of p1 is updated to the A, B, C, and D matrices, resulting in four updated matrices A_1, B_1, C_1, and D_1. Since p1 has been selected, the decision variable set is updated to (p2). Then, a strong branch is used to select a variable from the updated decision variable set (p2). If p2 is selected, we can obtain the sample [A_1, B_1, C_1, D_1, (p2), p2], where the label of this sample is p2. The obtained sample can be used as the second training data.
[0147] Specifically, the neural network model can employ a Graph Convolutional Neural Network (GCNN). During training, the information of the m-th function can be converted into four matrices A, B, C, and D. These four matrices are then input into the input layer of the GCNN. After passing through the GCNN layer, the selection probability of each decision variable in the decision variable set (p1, p2) is obtained. The decision variable with the highest probability is selected as the model's output. Then, the selected decision variable and the target decision variable corresponding to that node are compared to calculate the loss value. Based on the m-th loss value, the m-th neural network model is updated to obtain the (m+1)-th neural network model.
[0148] As discussed above, after each decision variable is selected by the GCNN layer, it is passed to the SCIP solver. The SCIP solver fixes the received decision variable values, solves the problem, and updates the matrices A, B, C, D, and the decision variable set based on the fixed values of the decision variables. Therefore, when m is not equal to 1, the m-th function information is the function information obtained after updating the m-1-th function information based on the (m-1)-th decision variable, and the m-th decision variable set is the decision variable set after updating the (m-1)-th decision variable set based on the (m-1)-th decision variable.
[0149] In this embodiment, the m-th function information is converted into a first matrix A, a second matrix B, a third matrix C, and a fourth matrix D, so that the neural network model can reconstruct the objective function and constraints in the m-th function information based on the matrices, and then learn the relationship between the matrices and decision variables to complete the model training process.
[0150] Please see Figure 4 In one embodiment of this disclosure, the neural network model includes, in sequence, an input layer, a graph convolutional layer, a first fully connected layer, a first ReLU activation layer, a second fully connected layer, a second ReLU activation layer, and a third fully connected layer. The first fully connected layer can be used to transform dimensions, the second fully connected layer can be used to extract deeper features, and the third fully connected layer can be connected to a softmax layer to form an output layer, used to output the probability of each decision variable, thereby selecting the decision variable with the highest probability for output. The first and second ReLU activation layers provide the network with some non-linear features, enabling the model to fit these features and thus extract deeper levels of knowledge.
[0151] Please see Figure 5 The flowchart below illustrates an optimized method for cargo stacking according to an embodiment of this disclosure. The method includes the following steps:
[0152] Step S501: Obtain the third function information and the third decision variable set. The third function information includes: the determined third objective function and third constraints with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third decision variable set includes: the variables in the third objective function.
[0153] Step S502: Input the third function information and the third decision variable set into I target neural network models for solving, and obtain I output results. The solving includes I solution stages, and one solution stage corresponds to one target neural network model.
[0154] Step S503: Based on the I output results, determine the solution result of the third function information.
[0155] The third cargo can be the same as the first cargo, or it can be other cargo besides the first cargo. Furthermore, the third cargo can include cargo of various sizes and specifications. Correspondingly, the third warehouse can be the same as the first warehouse, or it can be other warehouses besides the first warehouse. The aforementioned third function information can be function information determined based on the size information of the cargo and the size information of the warehouse in a specific cargo stacking scenario.
[0156] It is understood that the aforementioned I target neural network models are I models trained based on the aforementioned model training method. That is, the I target neural network models are: I models obtained by iteratively training the I neural network models using a mixed-integer programming solver with the first training data. The initialization parameters of the j-th neural network model are associated with the target parameters obtained from training the (j-1)-th neural network model, where j is an integer greater than 1 and less than or equal to 1; the first training data includes first function information and a first set of decision variables. The first function information includes a first objective function and first constraints determined with the optimization objective of maximizing the quantity of the first goods stacked in the first warehouse; the first set of decision variables includes variables in the first objective function. The neural network model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process based on the received function information, and the decision variables are the decision variables in the first set of decision variables.
[0157] In one embodiment of this disclosure, since the third set of decision variables may include multiple decision variables, the optimization method for cargo stacking may include the following process:
[0158] Input the p-th function information and the p-th decision variable set into the target model to obtain the p-th decision variable output by the target model. The p-th decision variable is the decision variable corresponding to the p-th node in the solution tree.
[0159] The p-th function information, the p-th decision variable set, and the p-th decision variable are input into the mixed integer programming solver for branching. At the same time, the p-th function information and the p-th decision variable set are updated based on the p-th decision variable to obtain the p+1-th function information and the p+1-th decision variable set.
[0160] Then, the p+1th function information and the p+1th decision variable set are input into the target model to obtain the p+1th decision variable output by the target model;
[0161] The (p+1)th function information, the (p+1)th set of decision variables, and the (p+1)th decision variable are input into the mixed integer programming solver for branching, until all decision variables in the set of decision variables are selected.
[0162] When p equals 1, the p-th function information is the third function information, and the p-th decision variable set is the third decision variable set;
[0163] When p is not equal to 1, the p-th function information is the function information obtained after updating the p-1 function information based on the p-1 decision variable, and the p-th decision variable set is the decision variable set obtained after updating the p-1 decision variable set based on the p-1 decision variable;
[0164] When p is located in the set [1, k], the target model is the first target neural network model. When p is located in the set (i*k, (i+1)*k], the target model is the (i+1)th target neural network model, where i is an integer greater than or equal to 1 and less than 1.
[0165] Furthermore, the cargo stacking optimization method provided in this embodiment is: based on the target neural network model trained by the above model training method, a cargo stacking optimization method is further provided. Therefore, the cargo stacking optimization method can realize each process in the above model training method and has the same beneficial effect. To avoid repetition, it will not be described again here.
[0166] It is understood that even if the number of variables in the third decision variable set is less than k*I, the corresponding decision variables can still be selected from the third decision variable set according to the above steps. The output of the target neural network model that does not participate in the selection of decision variables can be 0. For example, when the third decision variable set includes k*(I-1) decision variables, the first I-1 target neural network models will select the decision variables, and the output of the I-th target neural network model will be 0.
[0167] Please see Figure 3 In one embodiment of this disclosure, the total prediction result can be the sum of the prediction results of I target neural network models.
[0168] In this implementation, I target neural network models are trained to obtain the desired information. Before stacking goods into the warehouse, the optimization objective is to maximize the amount of goods stacked, thus constructing function information. Then, decision variables corresponding to the function information are selected based on the I target neural network models. Finally, a mixed-integer programming solver is used to solve the function information based on the selected decision variables, thereby optimizing the goods stacking process.
[0169] Please see Figure 6 This is a schematic diagram of the structure of a model training device 600 provided in an embodiment of this disclosure. The model training device 600 includes:
[0170] Construction module 601 is used to pre-construct I neural network models, where I is an integer greater than 1;
[0171] The first training module 602 is used to iteratively train the I neural network models using the first training data based on a mixed integer programming solver to obtain I target neural network models.
[0172] The neural network model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process of the received function information; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree.
[0173] Optionally, the first training data further includes first function information and a first set of decision variables, wherein the first function information includes: function information determined with the optimization objective of maximizing the quantity of the first goods stacked in the first warehouse.
[0174] Optionally, the first training module 602 is specifically used to iteratively train the j-th neural network model using the j-th training data based on the mixed integer programming solver to obtain the j-th target neural network model;
[0175] Wherein, when j equals 1, the j-th training data is the first training data;
[0176] When j is not equal to 1, the j-th training data is the training data obtained after updating the first training data based on the decision variables output by the (j-1)-th target neural network model;
[0177] The j is an integer greater than or equal to 1, and the j is less than or equal to the I.
[0178] Optionally, the first training module 602 includes:
[0179] The initialization submodule 6021 is used to initialize the model parameters of the j-th neural network model using the target parameters;
[0180] The first training submodule 6022 is used to perform k iterations of training on the j-th neural network model using the j-th training data based on a mixed integer programming solver, so as to obtain the j-th target neural network model.
[0181] Wherein, when j equals 1, the target parameter is the model parameter of the preset model;
[0182] When j is not equal to 1, the target parameter is the model parameter of the (j-1)th target neural network model, and k is an integer greater than or equal to 1.
[0183] Optionally, the first training submodule 6022 includes:
[0184] Unit 60221 is selected to input the target training data into the j-th neural network model to obtain the s-th decision variable output by the j-th neural network model. The s-th decision variable is the decision variable corresponding to the [(j-1)*k+s]-th node in the solution tree.
[0185] Prediction unit 60222 is used to input the target training data and the s-th decision variable into the mixed integer programming solver to solve for the prediction result;
[0186] The generation unit 60223 is used to generate the s-th reward value based on the prediction result and the theoretical result;
[0187] Update unit 60224 is used to update the j-th neural network model based on the s-th reward value;
[0188] When s equals 1, the target training data is the j-th training data;
[0189] When s is not equal to 1, the target training data is: the training data obtained by updating the j-th training data based on the decision variables of the j-th neural network model's (s-1)-th output.
[0190] Optionally, the update unit 60224 includes:
[0191] The standardization subunit 602241 is used to standardize the s-th return value based on the difference between the s-th return value and the historical average return value to obtain the s-th target return value, wherein the historical average return value is the average value of the historical return values output by the mixed integer programming solver.
[0192] Update subunit 602242 is used to update the j-th neural network model based on the s-th target reward value.
[0193] Optionally, the device further includes:
[0194] The second training module 603 is used to iteratively train a pre-constructed initial neural network model based on the second training data to obtain the preset model. The preset model is used to determine the decision variables of each node in the solution tree during the mixed-integer programming process of the received function information. The second training data includes second function information, a second set of decision variables, and label data. The second function information includes a second objective function and a second constraint condition, with the optimization objective being to maximize the quantity of second goods stacked in the second warehouse. The second set of decision variables includes variables in the second objective function. The label data indicates the target decision variables corresponding to each node in the solution tree during the mixed-integer programming process of the second function information; the target decision variables are variables in the second set of decision variables.
[0195] Optionally, the second training module 603 is specifically used to train the m-th neural network model based on the m-th function information and the m-th decision variable set to obtain the (m+1)-th neural network model;
[0196] Wherein, when m equals 1, the m-th function information is the second function information, the m-th decision variable set is the second decision variable set, and the m-th neural network model is the initial neural network model;
[0197] When m is not equal to 1, the m-th function information is the function information after updating the m-1-th function information based on the m-1-th decision variable, and the m-th decision variable set is the decision variable set after updating the m-1-th decision variable set based on the m-1-th decision variable.
[0198] Optionally, the second training module 603 includes:
[0199] Submodule 6041 is selected to input the m-th function information and the m-th decision variable set into the m-th neural network model to obtain the m-th decision variable output by the m-th neural network model. The m-th decision variable is the decision variable corresponding to the m-th node in the solution tree.
[0200] The calculation submodule 6042 is used to calculate the m-th loss value based on the m-th decision variable and the m-th target decision variable, wherein the m-th target decision variable is the target decision variable in the label data corresponding to the m-th node;
[0201] The update submodule 6043 is used to update the m-th neural network model based on the m-th loss value to obtain the (m+1)-th neural network model.
[0202] Optionally, the device further includes:
[0203] The determining module 604 is used to determine the (m+1)th neural network model as the preset model when the (m+1)th neural network model satisfies the first preset convergence condition;
[0204] The second training module 603 is further configured to perform iterative training on the (m+1)th neural network model based on the (m+1)th function information, the (m+1)th decision variable set, and the label data when the (m+1)th neural network model does not meet the first preset convergence condition, so as to obtain the preset model.
[0205] Optionally, the m-th function information includes the objective function and constraints, and the selection submodule 6041 includes:
[0206] The conversion unit 60411 is used to convert the m-th function information into a first matrix, a second matrix, a third matrix, and a fourth matrix. Different rows in the first matrix are used to represent different variables in the objective function, different rows in the second matrix are used to represent different constraints in the objective function, the third matrix is used to represent the relationship between the variables and the constraints, and the fourth matrix is used to represent the coefficients of the variables in the constraints.
[0207] The operation unit 60412 is used to input the first matrix, the second matrix, the third matrix, the fourth matrix and the m-th decision variable set into the m-th neural network model to obtain the score value of each decision variable in the m-th decision variable set output by the m-th neural network model;
[0208] Selection unit 60413 is used to output the m-th decision variable, which is the decision variable with the highest score in the set of m-th decision variables.
[0209] It should be noted that the model training device 600 provided in this embodiment can realize all the technical solutions of the above-described model training method embodiments, and therefore can at least achieve all the above-described technical effects, which will not be repeated here.
[0210] Please see Figure 13 This disclosure provides an optimized cargo stacking device 1300, comprising:
[0211] The acquisition module 1301 is used to acquire third function information and a third decision variable set. The third function information includes: function information determined with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third decision variable set includes: variables in the third function information.
[0212] The solution module 1302 is used to input the third function information and the third decision variable set into I target neural network models for solution and obtain I output results. The solution includes I solution stages, and one solution stage corresponds to one target neural network model.
[0213] The output module 1303 is used to determine the solution result of the third function information based on the I output results.
[0214] It should be noted that the cargo stacking optimization device 1300 provided in this embodiment can realize all the technical solutions of the above-described cargo stacking optimization method embodiment, and therefore can at least achieve all the above-described technical effects, which will not be repeated here.
[0215] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0216] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0217] Figure 14 A schematic block diagram of an example electronic device 1400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0218] like Figure 14As shown, the electronic device 1400 includes a computing unit 1401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1402 or a computer program loaded from a storage unit 1408 into a random access memory (RAM) 1403. The RAM 1403 may also store various programs and data required for the operation of the device 1400. The computing unit 1401, ROM 1402, and RAM 1403 are interconnected via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0219] Multiple components in electronic device 1400 are connected to I / O interface 1405, including: input unit 1406, such as keyboard, mouse, etc.; output unit 1407, such as various types of displays, speakers, etc.; storage unit 1408, such as disk, optical disk, etc.; and communication unit 1409, such as network card, modem, wireless transceiver, etc. Communication unit 1409 allows device 1400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0220] The computing unit 1401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1401 performs the various methods and processes described above, such as model training methods or, cargo stacking optimization methods. For example, in some embodiments, the model training method, or the cargo stacking optimization method, may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1400 via ROM 1402 and / or communication unit 1409. When the computer program is loaded into RAM 1403 and executed by the computing unit 1401, one or more steps of the model training method, or the cargo stacking optimization method described above are performed. Alternatively, in other embodiments, the computing unit 1401 may be configured in any other suitable manner (e.g., by means of firmware) to perform a model training method or a cargo stacking optimization method.
[0221] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0222] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0223] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0224] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0225] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0226] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0227] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0228] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An optimization method for cargo stacking, comprising: Obtain third function information and a third set of decision variables. The third function information includes: function information determined with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third set of decision variables includes: variables in the third function information. The third function information and the third decision variable set are input into I target neural network models for solving, and I output results are obtained. The solving includes I solution stages, one solution stage corresponds to one target neural network model, and the I target neural network models are models trained based on model training methods. Based on the I output results, the solution result of the third function information is determined, wherein, in the process of solving the mixed integer programming problem based on the I target neural network models, different target neural network models are used to select decision variables corresponding to different nodes in the solution tree; The model training method is applied to the cargo stacking optimization problem, and the model training method includes: I neural network models are pre-constructed, where I is an integer greater than 1; Using a mixed-integer programming solver, the I neural network models are iteratively trained with the first training data to obtain I target neural network models. The initialization parameters of the j-th neural network model are associated with the target parameters obtained from training the (j-1)-th neural network model, where j is an integer greater than 1 and less than or equal to 1. The neural network model is used to determine the decision variables of each node in the solution tree during the mixed integer programming process of the received function information, and different neural network models in the I neural network models are used to determine the decision variables corresponding to different nodes in the solution tree; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree; In the process of solving the mixed integer programming problem based on the I target neural network models, different target neural network models are used to select decision variables corresponding to different nodes in the solution tree; The first training data also includes first function information and a first set of decision variables. The iterative training of the I neural network models to obtain I target neural network models includes: Using the j-th training data, the j-th neural network model is iteratively trained based on the mixed integer programming solver to obtain the j-th target neural network model; Wherein, when j equals 1, the j-th training data is the first training data; When j is not equal to 1, the j-th training data is the training data obtained after updating the first training data based on the decision variables output by the (j-1)-th target neural network model; wherein, after the (j-1)-th target neural network model selects the (j-1)-th decision variable, the (j-1)-th decision variable in the (j-1)-th function information is updated from a variable to a fixed value to obtain the j-th function information; and the (j-1)-th decision variable is removed from the (j-1)-th decision variable set to obtain the j-th decision variable set; The j is an integer greater than or equal to 1, and the j is less than or equal to the I.
2. The method according to claim 1, wherein, The first function information includes: function information determined with the optimization objective of maximizing the quantity of the first goods stacked in the first warehouse.
3. The method according to claim 1, wherein, The mixed-integer programming solver uses the j-th training data to iteratively train the j-th neural network model to obtain the j-th target neural network model, including: The model parameters of the j-th neural network model are initialized using the target parameters; Using the j-th training data, the j-th neural network model is trained k times using a mixed integer programming solver to obtain the j-th target neural network model. Wherein, when j equals 1, the target parameter is the model parameter of the preset model; When j is not equal to 1, the target parameter is the model parameter of the (j-1)th target neural network model, and k is an integer greater than or equal to 1.
4. The method according to claim 3, wherein, The s-th training iteration in the k-th iteration training includes: Input the target training data into the j-th neural network model to obtain the s-th decision variable output by the j-th neural network model. The s-th decision variable is the decision variable corresponding to the [(j-1)*k+s]-th node in the solution tree. The target training data and the s-th decision variable are input into the mixed integer programming solver for solving to obtain the prediction result; The s-th return value is generated based on the predicted and theoretical results; The j-th neural network model is updated based on the s-th reward value; When s equals 1, the target training data is the j-th training data; When s is not equal to 1, the target training data is: the training data obtained by updating the j-th training data based on the decision variables of the j-th neural network model's (s-1)-th output.
5. The method according to claim 4, wherein, The step of updating the j-th neural network model based on the s-th reward value includes: Based on the difference between the s-th return value and the historical average return value, the s-th return value is standardized to obtain the s-th target return value, wherein the historical average return value is the average of the historical return values output by the mixed integer programming solver; The j-th neural network model is updated based on the s-th target reward value.
6. The method according to claim 3, wherein, Before initializing the model parameters of the j-th neural network model using the target parameters, the method further includes: The pre-constructed initial neural network model is iteratively trained based on the second training data to obtain the preset model. The preset model is used to determine the decision variables of each node in the solution tree during mixed-integer programming of the received function information. The second training data includes second function information, a second set of decision variables, and label data. The second function information includes a second objective function and a second constraint condition, with the optimization objective being to maximize the quantity of second goods stacked in the second warehouse. The second set of decision variables includes variables in the second objective function. The label data indicates the target decision variables corresponding to each node in the solution tree during mixed-integer programming of the second function information; the target decision variables are variables in the second set of decision variables.
7. The method according to claim 6, wherein, The m-th training iteration of the pre-constructed initial neural network model based on the second training data includes: The m-th neural network model is trained based on the m-th function information and the m-th decision variable set to obtain the (m+1)-th neural network model; Wherein, when m equals 1, the m-th function information is the second function information, the m-th decision variable set is the second decision variable set, and the m-th neural network model is the initial neural network model; When m is not equal to 1, the m-th function information is the function information after updating the m-1-th function information based on the m-1-th decision variable, and the m-th decision variable set is the decision variable set after updating the m-1-th decision variable set based on the m-1-th decision variable.
8. The method according to claim 7, wherein, The process of training the m-th neural network model based on the m-th function information and the m-th decision variable set to obtain the (m+1)-th neural network model includes: The m-th function information and the m-th decision variable set are input into the m-th neural network model to obtain the m-th decision variable output by the m-th neural network model. The m-th decision variable is the decision variable corresponding to the m-th node in the solution tree. The m-th loss value is calculated based on the m-th decision variable and the m-th target decision variable, wherein the m-th target decision variable is the target decision variable in the label data corresponding to the m-th node; The m-th neural network model is updated based on the m-th loss value to obtain the (m+1)-th neural network model.
9. The method according to claim 8, wherein, After updating the m-th neural network model based on the m-th loss value to obtain the (m+1)-th neural network model, the method further includes: If the (m+1)th neural network model satisfies the first preset convergence condition, the (m+1)th neural network model is determined as the preset model; If the (m+1)th neural network model does not meet the first preset convergence condition, the (m+1)th neural network model is iteratively trained based on the (m+1)th function information, the (m+1)th decision variable set, and the label data to obtain the preset model.
10. The method according to claim 8, wherein, The m-th function information includes the objective function and constraints. The step of inputting the m-th function information and the m-th decision variable set into the m-th neural network model to obtain the m-th decision variable output by the m-th neural network model includes: The m-th function information is converted into a first matrix, a second matrix, a third matrix, and a fourth matrix. Different rows in the first matrix are used to represent different variables in the objective function, different rows in the second matrix are used to represent different constraints in the objective function, the third matrix is used to represent the relationship between the variables and the constraints, and the fourth matrix is used to represent the coefficients of the variables in the constraints. Input the first matrix, the second matrix, the third matrix, the fourth matrix and the m-th decision variable set into the m-th neural network model to obtain the score value of each decision variable in the m-th decision variable set output by the m-th neural network model; Output the m-th decision variable, which is the decision variable with the highest score in the set of m-th decision variables.
11. An optimization device for cargo stacking, comprising: The acquisition module is used to acquire third function information and a third decision variable set. The third function information includes: function information determined with the optimization objective of maximizing the quantity of third goods stacked in the third warehouse; the third decision variable set includes: variables in the third function information. The solution module is used to input the third function information and the third decision variable set into I target neural network models for solution and obtain I output results. The solution includes I solution stages, one solution stage corresponds to one target neural network model, and the I target neural network models are models trained based on model training methods. The output module is used to determine the solution result of the third function information based on the I output results, wherein, in the process of solving the mixed integer programming problem based on the I target neural network models, different target neural network models are used to select decision variables corresponding to different nodes in the solution tree; The model training method is applied to the cargo stacking optimization problem, and the model training method includes: I neural network models are pre-constructed, where I is an integer greater than 1; Using a mixed-integer programming solver, the I neural network models are iteratively trained with the first training data to obtain I target neural network models. The initialization parameters of the j-th neural network model are associated with the target parameters obtained from training the (j-1)-th neural network model, where j is an integer greater than 1 and less than or equal to 1. The neural network model is used to determine the decision variables of each node in the solution tree during the mixed integer programming process of the received function information, and different neural network models in the I neural network models are used to determine the decision variables corresponding to different nodes in the solution tree; the first training data includes the label data of the target decision variables corresponding to each branch node in the solution tree; In the process of solving the mixed integer programming problem based on the I target neural network models, different target neural network models are used to select decision variables corresponding to different nodes in the solution tree; The first training data also includes first function information and a first set of decision variables. The iterative training of the I neural network models to obtain I target neural network models includes: Using the j-th training data, the j-th neural network model is iteratively trained based on the mixed integer programming solver to obtain the j-th target neural network model; Wherein, when j equals 1, the j-th training data is the first training data; When j is not equal to 1, the j-th training data is the training data obtained after updating the first training data based on the decision variables output by the (j-1)-th target neural network model; wherein, after the (j-1)-th target neural network model selects the (j-1)-th decision variable, the (j-1)-th decision variable in the (j-1)-th function information is updated from a variable to a fixed value to obtain the j-th function information; and the (j-1)-th decision variable is removed from the (j-1)-th decision variable set to obtain the j-th decision variable set; The j is an integer greater than or equal to 1, and the j is less than or equal to the I.
12. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the optimized method for stacking goods according to any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the optimized method for cargo stacking as described in any one of claims 1-10.
14. A computer program product comprising a computer program that, when executed by a processor, implements the optimized method for cargo stacking as described in any one of claims 1-10.
Citation Information
Patent Citations
Model training method, device, equipment and system and storage medium
CN110766090A
Combined optimization task processing method and device
CN111915060A