Data processing method, device, storage medium and program product
By using the graph neural network model to process the graph data of the problem to be solved, the appropriate solver is automatically determined, which solves the problem that users find it difficult to choose the right solver, and improves the accuracy and efficiency of the solution.
Patent Information
- Application Number
- CN202210286725.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-03-22
AI Technical Summary
When using modeling language software, it is difficult for users to quickly understand the characteristics of optimization problems and the advantages of different solvers, which makes it difficult to choose the right solver.
By automatically determining the appropriate solver based on the graph data of the problem to be solved and the pre-constructed graph neural network model, the appropriate solver is automatically determined and the solution is performed based on the solver.
The accuracy of the selection solver is improved, the structure information and sub-graph information of the graph data are fully utilized, and the steps of users to manually select the solver are reduced, and the solution efficiency and accuracy are improved.
Smart Images

Figure CN114647981B_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, device, storage medium and program product. Background Art
[0002] An optimization problem refers to finding the maximum or minimum value of an objective function under certain constraints. Optimization problems exist in various fields such as production, economy, and transportation.
[0003] In modeling language software, users input the optimization model in the form of algebraic modeling language, introduce data, create the optimization model file, and then solve it by calling the optimization solver. Different optimization problems have different structures and properties, so different solvers need to be selected for optimization problems with different structures and properties. For users of modeling languages, it is often impossible to quickly understand the characteristics of each optimization problem and the advantages of different solvers, so it is impossible to choose a suitable solver for solving. Therefore, when users use modeling language software, how to improve the accuracy of solving problems becomes an urgent problem to be solved. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to provide a data processing method, device, storage medium and program product to improve the accuracy of solving the problem.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, including:
[0006] Determine a solver corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the pre-built graph neural network model;
[0007] The problem to be solved is solved based on the solver.
[0008] Optionally, determining a solver corresponding to the problem to be solved according to graph data corresponding to the problem to be solved and a pre-built graph neural network model includes:
[0009] Determine type information corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the graph neural network model; the type information is used to describe at least one of the following: linearity, concavity, and smoothness;
[0010] A solver corresponding to the problem to be solved is selected from at least one solver according to the type information.
[0011] Optionally, each solver solves the problem by using at least one algorithm; the method further comprises:
[0012] According to the type information corresponding to the problem to be solved, an algorithm for solving the problem to be solved is selected from at least one algorithm corresponding to the solver, so as to solve the problem to be solved based on the solver through the corresponding algorithm.
[0013] Optionally, the method further includes:
[0014] Receiving an optimization model file input by a user; the optimization model file is used to represent the objective function and constraint conditions of the problem to be solved;
[0015] Determine the directed acyclic graph corresponding to the optimization model file through semantic analysis;
[0016] Among them, the graph data corresponding to the problem to be solved is the directed acyclic graph.
[0017] Optionally, the method further includes:
[0018] Converting the optimization model file corresponding to the problem to be solved into a corresponding model instance;
[0019] Accordingly, solving the problem to be solved based on the solver includes:
[0020] The model instance is solved according to the solver.
[0021] Optionally, determining a solver corresponding to the problem to be solved according to graph data corresponding to the problem to be solved and a pre-built graph neural network model includes:
[0022] Obtaining requirement information set by a user for selecting a solver; the requirement information includes at least one of the following: accuracy requirement, efficiency requirement, precision requirement, and cost requirement;
[0023] According to the graph data corresponding to the problem to be solved, the pre-built graph neural network model and the requirement information, the solver corresponding to the problem to be solved is determined.
[0024] Optionally, the method further includes:
[0025] After solving the problem to be solved according to the solver, obtaining feedback information corresponding to the solution result;
[0026] If the feedback information and the type information corresponding to the problem to be solved meet the preset conditions, a corresponding training sample is generated according to the problem to be solved and added to the optimized sample set;
[0027] Among them, the optimized sample set is used to optimize the graph neural network model.
[0028] In a second aspect, the embodiment of the present application further provides a data processing method, including:
[0029] Determining a supply chain scheduling problem to be solved, wherein the supply chain scheduling problem is used to determine the quantities of raw materials to be purchased from multiple suppliers based on an objective function under constraints;
[0030] According to the graph data corresponding to the supply chain scheduling problem and the pre-built graph neural network model, the solver corresponding to the supply chain scheduling problem is determined, and the supply chain scheduling problem is solved based on the solver to obtain and output the quantities of raw materials purchased from multiple suppliers.
[0031] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0032] at least one processor; and
[0033] a memory communicatively coupled to the at least one processor;
[0034] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to execute the method described in any one of the above aspects.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any one of the above aspects is implemented.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in any of the above aspects when executed by a processor.
[0037] The data processing method, device, storage medium and program product provided in the present application can determine the solver corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the pre-built graph neural network model, solve the problem to be solved based on the solver, and process the graph data corresponding to the problem to be solved according to the graph neural network model, so as to automatically determine the selected solver without the need for the user to manually select the solver. Moreover, the solver determined by the above method is obtained after processing the graph data corresponding to the problem to be solved by the graph neural network, so that the structural information and sub-graph information in the graph data can be fully utilized, and the accuracy of determining the solver can be improved. There is no need to determine the type information of the problem to be solved according to different judgment rules multiple times, which can effectively improve the efficiency of determining the solver, thereby solving the optimization problem more efficiently and accurately, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0039] Figure 1 An application scenario diagram provided for an embodiment of the present application;
[0040] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of a directed acyclic graph provided in an embodiment of the present application;
[0042] Figure 4 A flowchart of a data processing method provided in an embodiment of the present application;
[0043] Figure 5 A user interaction schematic diagram provided for an embodiment of the present application;
[0044] Figure 6 A schematic diagram of updating a graph neural network model provided in an embodiment of the present application;
[0045] Figure 7 A flowchart of another data processing method provided in an embodiment of the present application;
[0046] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0047] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0048] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.
[0049] First, the terms involved in this application are explained:
[0050] Algebraic modeling language: Converts complex optimization models into abstract algebraic expressions, inputs them into script programs, and connects various optimization solvers.
[0051] Optimization solver: Professionally designed software for solving optimization problems, such as MindOpt, Gurobi, CPLEX, etc.
[0052] Graph Neural Networks (GNN): A deep learning method that can be applied to data with graph structure features.
[0053] The application scenarios and inventive concepts of this application are explained below.
[0054] In modeling language software, users can input a specific optimization model in the form of algebraic modeling language and call the solver to solve it. The advantage of general modeling language is that it can call many solvers, including general solvers (such as MindOpt, Gurobi, Knitro, etc.) and special solvers (such as OSQP, etc.), and each solver can achieve the best performance by setting the solution parameters. For example, for nonlinear optimization problems, the judgment of convexity and concavity can greatly affect the selection of solvers and solution parameters. However, for users who use modeling language software, they often cannot determine the type of optimization problem and do not understand the advantages of each solver, so they cannot choose the appropriate solver.
[0055] In some technologies, the type of optimization problem can be determined by heuristic methods. For example, when the expression is f(x,y)=(x+5) 2 +(y-8) 2 When judging the convexity of the optimization problem, the graph structure corresponding to the expression can be traversed. Whenever an expression is traversed, the type of expression is determined based on the convexity judgment rule, and the graph structure is traversed until the convexity of the expression is finally determined. Specifically, when traversing to x+5, it can be determined as a convex function according to the judgment rule. When continuing to traverse, (x+5) 2 When (x+5) is convex, we can determine whether it is a square function or a convex function according to the judgment rule. 2 is also a convex function; similarly, for (y-8) 2 The judgment process of the concavity and convexity of is the same, that is, it is also a convex function. Finally, according to the judgment rule that the sum of two convex functions is a convex function, it can be determined that the expression corresponding to the optimization problem is a convex function.
[0056] The above method needs to traverse the graph structure when determining the concavity of the optimization problem, which is a cumbersome process. In addition, it needs to be judged according to the judgment rule of concavity. When it is necessary to judge another characteristic of the optimization problem, such as smoothness, it is necessary to use the judgment rule of smoothness. Therefore, this method has the problems of cumbersome processing process and low efficiency.
[0057] In addition, if machine learning methods are used to perform feature engineering on the graph structure and the solver is determined based on the processed features, the extracted features lose some information of the graph structure, which will have a certain impact on the choice of the solver and cause the determined solver to be inaccurate.
[0058] In view of this, the present application provides a data processing method, which utilizes the characteristics of graph neural networks that can process graph data, determines the solver corresponding to the problem to be solved according to the graph data of the problem to be solved and a pre-built graph neural network model, and then solves the problem to be solved according to the solver. The solver can be directly determined, avoiding users from choosing inappropriate solvers due to unclear types of optimization problems and advantages of different solvers. At the same time, compared with heuristic methods and feature extraction methods, this method can better utilize the structured information and subgraph information of graph data, improve the accuracy of the determined solver, and there is no need to use different judgment rules multiple times to determine different types of optimization problems, thereby improving the efficiency of determining the solver.
[0059] The embodiments of the present application can be applied to any scenario where an optimization problem needs to be solved. For example, in scenarios such as supply chain scheduling, power grid scheduling, commodity flow distribution, advertising distribution, and asset scheduling, it is often necessary to solve the optimization problem and obtain a scheduling solution or an allocation solution. In the above scenarios, it can be implemented based on the corresponding supply chain scheduling software, power grid scheduling software, flow distribution software, advertising distribution software, and asset scheduling software. Among them, modeling language software can be embedded in the above software, and the modeling language software can establish an optimization model for the problem to be solved. The algorithm of the present application can automatically determine the solver suitable for the problem to be solved, and solve the problem to be solved by calling the solver to obtain a solution result, such as a scheduling solution or an allocation solution.
[0060] Optionally, the embodiments of the present application can be applied to the scenario of solving the optimization problem of supply chain scheduling. Exemplarily, in the scenario of supply chain scheduling, the user can input the objective function and constraints into the modeling language software through algebraic language. Exemplarily, the objective function can be the total cost determined according to the quantity and price of raw materials obtained from each supplier; the constraint can be: the sum of the quantity of raw materials obtained from each supplier is equal to the target quantity; the quantity of raw materials obtained from each supplier is the decision variable. After generating the problem to be solved for supply chain scheduling, the graph data corresponding to the problem to be solved can be determined, and a suitable solver can be determined based on the graph data and the pre-built graph neural network model, and the solution result is output according to the optimization goal of minimizing the total cost, that is, the quantity of raw materials obtained from each supplier, so as to facilitate the scheduling of raw materials according to the solution result.
[0061] In the field of power grid dispatching, users can input objective functions and constraints into the modeling language software. Since the opening of each generator set consumes energy and costs, and the generated electricity cannot be stored but can only be dispatched, for example, the objective function can be the sum of the power generation cost and the dispatching cost; the constraint condition can be that the power consumption is equal to the power generation; and the time when each generator set is turned on and off is the decision variable. After obtaining the problem to be solved for power grid dispatching, the solver suitable for processing the problem to be solved is determined by the solver determination method, and the solution result is determined according to the minimum cost as the optimization goal, that is, the time when each generator set is turned on and off, so that each generator set is controlled according to the solution result.
[0062] In the field of advertising allocation, if a business places advertisements on different platforms, the user inputs the objective constraint function and constraint conditions into the modeling language software. For example, the objective constraint function can be the total advertising cost determined based on the number of advertisements on each platform; the constraint condition can be that the number of advertisement views reaches the target number; and the number of advertisements placed on each platform is the decision variable. The solver suitable for solving the advertising allocation problem is determined by the solver determination method, and the solution result is determined according to the optimization goal of minimizing the total advertising cost, so that the advertisements are placed on different platforms according to the solution result.
[0063] It should be noted that in the same field, different users or different scenarios may have different problems to be solved. The above objective functions, constraints and decision variables are only examples. In practical applications, the problems to be solved can be set according to user needs. Therefore, the problems to be solved by different users in the same field may correspond to different solvers.
[0064] For example, in the scenario of supply chain scheduling, the objective function may include not only the total cost, but also indicators of multiple dimensions such as arrival time and raw material quality. When the objective function changes, it may cause changes in the concavity and linearity of the problem to be solved, which will ultimately affect the choice of solver.
[0065] Figure 1 An application scenario diagram provided for an embodiment of the present application, such as Figure 1 As shown, a modeling language software is provided in the terminal device or server, and the user can input the problem to be solved into the modeling language software according to a preset format. The terminal device or server can process the graph data corresponding to the problem to be solved based on a pre-built graph neural network model, wherein the graph data can be obtained based on the semantic analysis of the problem to be solved. The solver can be determined through the above processing procedure, and the problem to be solved can be processed according to the solver to obtain a solution result, and the solution result is fed back to the user.
[0066] By using a pre-built graph neural network model to process graph data, we can make full use of the structured information and subgraph information of the graph data, so that the data processed by the graph neural network model contains the original data of the problem to be solved. If feature extraction is not performed, there will be no feature loss, which improves the accuracy of the determined solver.
[0067] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0068] Figure 2 The flowchart of a data processing method provided in the embodiment of the present application is shown in FIG. The execution subject of the method in the present embodiment can be any device with data processing function, such as a server and a terminal device. Figure 2 As shown, the method may include:
[0069] Step 201: Determine a solver corresponding to the problem to be solved based on the graph data corresponding to the problem to be solved and a pre-built graph neural network model.
[0070] The problem to be solved may be any optimization problem. The problem to be solved may include an objective function and constraints. The objective function is the basis for comparing multiple design solutions available for selection, and the purpose of optimization is to make the objective function take an extreme value. Constraints refer to the limiting conditions that variables need to meet when making the objective function take an extreme value.
[0071] The problem to be solved can be solved by a solver, and in the modeling language software, multiple solvers can be called, such as MindOpt, Gurobi, CPLEX, etc. The embodiment of the present application can be used to determine a solver suitable for the problem to be solved from multiple solvers.
[0072] Optionally, graph data can be used to represent the problem to be solved. There is no restriction on the type of graph data, and the graph data can be a set consisting of multiple points and lines between these points. The modeling language software can determine the corresponding graph data according to the problem to be solved and store it in the memory.
[0073] Optionally, the graph neural network model includes but is not limited to a graph convolutional network and a graph attention network. Optionally, the pre-built graph neural network model refers to a graph neural network model obtained through pre-training.
[0074] Among them, the pre-built graph neural network model can exist in two forms. In one form, the input data is the graph data corresponding to the problem to be solved, and the output data is the solver corresponding to the problem to be solved. The solver can be output directly, which has the advantage of high efficiency. The other form has the input data as the graph data corresponding to the problem to be solved, and the output data is the type information of the problem to be solved. The corresponding solver is determined according to the type information, and the intermediate result of the type information of the problem to be solved can be obtained. This can enable users to verify the type information corresponding to the problem to be solved and reduce the probability that the output solver does not match the problem to be solved.
[0075] For the above two methods of training graph neural network models, the input data is the same, both of which are graph data corresponding to the optimization problem, and the output data is different. The output data corresponding to the first method of training the graph neural network model is the solver, and the output data corresponding to the second method of training the graph neural network model is type information. During the application process, the graph data corresponding to the problem to be solved stored in the memory can be input into the pre-built graph neural network model, and the corresponding solver or type information can be output.
[0076] Step 202: Solve the problem to be solved based on the solver.
[0077] After the solver is determined, the problem to be solved can be solved by calling the solver. The solver can be embedded in the modeling language software, or can be set on the hardware device to which the modeling language software belongs, so as to be called by the modeling language software.
[0078] After the solver solves the problem to be solved, it can output the solution result, and output the solution result so that the user can obtain the solution result.
[0079] Since graph data contains structured information and subgraph information, the solver can be effectively determined using this information. A subgraph refers to graph data in which all nodes and edges are included in the original graph. Structured information means that graph data can be decomposed into multiple interrelated components, and each component has a clear hierarchical structure, which is the structured information.
[0080] In summary, the data processing method provided in the embodiment of the present application can determine the solver corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the pre-built graph neural network model, and solve the problem to be solved based on the solver, so that the solver can be directly output in the modeling language software without the need for the user of the modeling language software to manually select the solver. Moreover, the solver determined by the above method is obtained after processing the graph data corresponding to the problem to be solved based on the graph neural network, and can make full use of the structural information and sub-graph information in the graph data, thereby improving the accuracy of determining the solver, and there is no need to determine the type information of the problem to be solved according to different judgment rules multiple times, which can effectively improve the efficiency of determining the solver, thereby solving the optimization problem more efficiently and accurately, and improving the user experience.
[0081] In one or more embodiments of the present application, optionally, determining a solver corresponding to the problem to be solved according to graph data corresponding to the problem to be solved and a pre-built graph neural network model includes:
[0082] According to the graph data corresponding to the problem to be solved and the graph neural network model, determine the type information corresponding to the problem to be solved; the type information is used to describe at least one of the following: linearity, concavity, and smoothness; according to the type information, select a solver corresponding to the problem to be solved from at least one solver.
[0083] Among them, when determining the solver based on graph data and a pre-built graph neural network model, if the solver is directly output, the user is uncertain whether the output solver is suitable for the current problem to be solved. Based on the above problem, the graph neural network can output the type information corresponding to the problem to be solved based on the graph data.
[0084] If the user can directly determine the type information of the optimization problem, the manually determined type information can be compared with the type information output by the graph neural network to determine whether the two are consistent. When it is determined that the type information output by the graph neural network model is wrong, the accuracy of the output result can be improved by updating the model; or, when it is determined that the manually determined type information is wrong, the accuracy of the user's subsequent judgment of the type information can be improved.
[0085] The type information may reflect the structure and properties of the problem to be solved. The type information may be at least one of linearity, concavity, smoothness, etc. For different types of problems to be solved, corresponding solvers may be determined.
[0086] Among them, the modeling language software can call multiple solvers, and the performance of the solvers is different when solving different types of optimization problems. For example, when a convex optimization solver solves an optimization problem with convex type information, it can exert its maximum performance and obtain a better solution result. However, when a convex optimization solver solves an optimization problem with concave type information, it cannot exert its maximum performance, and the solution obtained may not be the best result. Therefore, after determining the type information, a corresponding solver can be selected from at least one solver.
[0087] Specifically, after determining the type information corresponding to the problem to be solved, at least one solver that can solve the optimization problem of this type is determined, and then a solver is selected from the determined multiple solvers.
[0088] Furthermore, after determining the type information corresponding to the problem to be solved, auxiliary model transformation (reformulation) or postprocessing (postprocessing) and other processes can be performed according to the type information.
[0089] In summary, the graph neural network model is used to first determine the type information corresponding to the problem to be solved, and then the corresponding solver is determined based on the type information. The solver can be determined on the basis of the accuracy of the type information, which can improve the accuracy of the determined solver.
[0090] In one or more embodiments of the present application, optionally, each solver solves the problem by using at least one algorithm; the method further includes:
[0091] According to the type information corresponding to the problem to be solved, an algorithm for solving the problem to be solved is selected from at least one algorithm corresponding to the solver, so as to solve the problem to be solved based on the solver through the corresponding algorithm.
[0092] Each solver provides at least one algorithm for solving the optimization problem. For example, a linear solver provides multiple different algorithms, and the same solver has different effects on different algorithms. Therefore, before solving the problem to be solved, not only can a suitable solver be selected, but also the algorithm used by the solver can be determined.
[0093] Specifically, after determining the type information corresponding to the problem to be solved, the solver may be determined first, and then an algorithm for solving the problem to be solved may be determined from at least one algorithm corresponding to the solver.
[0094] Specifically, the algorithm for the problem to be solved can be determined by selecting parameters. For example, a solver includes two algorithms, namely the first algorithm and the second algorithm. When the value corresponding to the parameter is 0, it can indicate that the first algorithm is selected; when the value corresponding to the parameter is 1, it can indicate that the second algorithm is selected. The selection of parameters can be determined directly according to the type information corresponding to the problem to be solved.
[0095] In addition, before solving the problem to be solved, it can be determined whether to perform preprocessing operations, and it can also be determined whether to perform preprocessing according to the type information corresponding to the problem to be solved, and the value of the preprocessing parameter can be determined so that the solver can determine whether to perform preprocessing operations according to the value of the parameter. Among them, the specific operation of preprocessing can be designed according to actual needs, such as format conversion, etc.
[0096] The above method not only selects the solver, but also selects the algorithm used by the solver, so that the solver can perform optimally according to the selected algorithm, thereby further improving the accuracy of the solution.
[0097] In one or more embodiments of the present application, optionally, the method further includes: converting the optimization model file corresponding to the problem to be solved into a corresponding model instance;
[0098] Correspondingly, solving the problem to be solved based on the solver includes: solving the model instance according to the solver.
[0099] After the solver is determined, the solver needs to be called to solve the problem to be solved. Among them, the problem to be solved input by the user is in the form of an optimization model file, and the optimization model file may not be directly transmitted and read, so a model instance corresponding to the optimization model file can be generated. For example, for the objective function f(x)=ax+b expressed in algebraic language, it is an abstract model. If a model instance is to be generated, the user also needs to input a data file. The data file refers to the values of the parameters in the objective function, such as the value of a and the value of b. Among them, the user can input the data file while inputting the optimization model file, and can also send a prompt message to the user when generating a model instance, so that the user can input the data file according to the prompt message.
[0100] Specifically, when generating a model instance, the model instance can be generated according to the directed acyclic graph and the data file. There is no restriction on the format of the model instance, and it can be set according to the requirements, such as LP format, MPS format, and NL format. After the file of the model instance is generated, it can be output to the corresponding solver so that the solver can solve the model instance.
[0101] The above method generates a corresponding model instance according to the selected solver and outputs the model instance to the solver, thereby smoothly implementing the solver's solution processing of the problem to be solved and meeting the solution requirements of different problems.
[0102] In one or more embodiments of the present application, optionally, the method further includes:
[0103] Receive an optimization model file input by a user; the optimization model file is used to represent the objective function and constraints of the problem to be solved; determine the directed acyclic graph corresponding to the optimization model file through semantic analysis; wherein the graph data corresponding to the problem to be solved is the directed acyclic graph.
[0104] In order to determine the directed acyclic graph corresponding to the optimization model file, the user can first input the optimization model file into the modeling language software. The optimization model file is a file that describes the optimization problem in an algebraic language. For example, an objective function f(x)=ax+b can be described in an algebraic language, and the optimization model file can be obtained according to the user's input. The optimization model file can be used to represent the objective function and the constraints.
[0105] After receiving the optimization model file input by the user, the modeling language software can determine the directed acyclic graph corresponding to the optimization model file by semantic parsing. Specifically, semantic parsing includes lexical parsing and grammatical parsing. Lexical parsing is also called lexical analysis, which can convert a character sequence into a word sequence. The program or function that performs lexical parsing is called a lexical analyzer. Semantic parsing is also called semantic analysis, which can review the context-related properties of the structurally correct source program and perform type review, that is, review whether the source program has semantic errors.
[0106] Among them, semantic rules are defined in the modeling language software, and the user needs to input the optimization model file according to the semantic rules, so that the lexical analyzer in the modeling language software can perform lexical analysis according to the semantic rules. For example, there are basic elements such as param, set, var, minimize, subject to in the optimization model file. The lexical analyzer can determine the meaning of each of the above basic elements according to the semantic rules. For example, it can be determined that each of the above basic elements refers to parameters, sets, variables, objective functions and constraints, etc. In addition, for the objective function f(x)=ax+b of the algebraic language, assignment operators, numbers, addition operators, etc. can also be identified.
[0107] After the lexical analysis, the result of the lexical analysis can be semantically analyzed. After the semantic analysis, if it is determined that there is no semantic error, the optimized model expression can be output. After obtaining the optimized model expression, the corresponding directed acyclic graph can be further determined.
[0108] When determining a directed acyclic graph based on the optimization model expression, the following method can be used: determine all operands, such as decision variables and non-decision variables in the objective function, and determine them as leaf nodes; determine the effective order of each operator, and add operators between the operands in order and in a hierarchical manner, and determine each operator as an intermediate node; add directed edges between two adjacent layers of nodes, and finally determine whether operators in the same layer can be merged (when the operators are the same and the two variables or expressions corresponding to the operators are also the same, they can be merged). If they can be merged, the merged graph data is obtained. By merging operators, the repeated parts of the expression can be represented by a subgraph, so that the stored graph data has the advantage of occupying less space.
[0109] Figure 3 A schematic diagram of a directed acyclic graph provided in an embodiment of the present application. Figure 3 As shown, the expression corresponding to the directed acyclic graph is f(x,y)=(x+5) 2 +(y-8) 2 . Among them, x, y, 5, and 8 are all operands, and the operators include the subtraction operator, the first addition operator, the square operator, and the second addition operator. According to the order of effectiveness, they can be divided into three levels to obtain various intermediate nodes. Among them, there is no restriction on the form of the nodes. Circles can be used as nodes, or leaf nodes can be represented by circles and intermediate nodes can be represented by rectangular boxes.
[0110] The above method determines the directed acyclic graph corresponding to the optimization model file as graph data. The directed acyclic graph can remove the same part of the expression to achieve compressed storage, save space, and reduce the amount of processing of graph data by the graph neural network, thereby further improving processing efficiency.
[0111] Figure 4 A flowchart of a data processing method provided in an embodiment of the present application is shown in FIG. Figure 4As shown, the user can input the optimization model file and the data file into the modeling language software. The modeling language software is provided with a semantic parsing module, a model generation module and a structure recognition module. The solver, the algorithm and the model instance can be output through the modeling language software. Specifically, the semantic parsing module can parse the optimization model file to obtain the optimization model expression, and the model generation module can generate a directed acyclic graph according to the optimization model expression. After generating the directed acyclic graph, on the one hand, the model generation module can generate a model instance corresponding to the optimization model file according to the directed acyclic graph and the data file; on the other hand, the structure recognition module can input the directed acyclic graph into the graph neural network and output the judgment conclusion of the type information. After determining the judgment conclusion of the type information, the judgment conclusion can be input into the parameter selection module, and the parameter selection module can obtain the selection results of the solver and the algorithm, and finally obtain the solver, the algorithm and the model instance. Finally, the solver can be called according to the selection result by calling the solver module, and the model instance can be solved according to the algorithm to obtain the solution result and output.
[0112] It should be noted that the steps of generating a model instance corresponding to the optimized model file based on the directed acyclic graph and the steps of generating type information by the graph neural network based on the directed acyclic graph may not have a fixed order and may be executed simultaneously.
[0113] In one or more embodiments of the present application, optionally, determining a solver corresponding to the problem to be solved according to graph data corresponding to the problem to be solved and a pre-built graph neural network model includes:
[0114] Obtain the requirement information set by the user for selecting a solver; the requirement information includes at least one of the following: accuracy requirement, efficiency requirement, precision requirement, and cost requirement; determine the solver corresponding to the problem to be solved based on the graph data corresponding to the problem to be solved, the pre-built graph neural network model, and the requirement information.
[0115] Since different users have different requirements when selecting solvers, when the modeling language software directly outputs a determined solver, the output solver may not meet the user's requirements, resulting in a poor user experience. Based on this, the requirement information set by the user for selecting a solver can be obtained, where the requirement information can be at least one of accuracy requirements, efficiency requirements, precision requirements, and cost requirements. Figure 5 A user interaction diagram provided in an embodiment of the present application, such as Figure 5 As shown, in addition to inputting the problem to be solved to the terminal device or the server, the user can also input requirement information so that the terminal device and the server can determine the solver based on the requirement information.
[0116] The requirement information is used to determine the solver corresponding to the problem to be solved, and the above requirement information can also be regarded as a constraint condition for the solution. The requirement information can be input by the user when inputting the optimization model file into the modeling language software; or the requirement information can be input after the graph neural network model outputs the type information and before determining the solver. The user can input different requirement information for different optimization problems, or input the same requirement information for different optimization problems. When a user sets the same requirement information for different optimization problems, the user information can be bound to the requirement information, without the user having to input the same requirement information each time. When the modeling language software outputs the solver, the solver can be determined directly based on the bound requirement information.
[0117] When the user sets one item of requirement information, the solver with the highest matching degree with the requirement information can be directly output. For example, when the requirement information is an accuracy requirement, the solver with the highest accuracy can be directly output. When the user sets at least two items of requirement information, a solver can be determined by comprehensively selecting at least two items of requirement information, so that the determined solver can simultaneously meet at least two items of requirement information.
[0118] Among them, when determining the solver corresponding to the problem to be solved based on the graph data corresponding to the problem to be solved, the pre-built graph neural network model and the requirement information, if the graph neural network model outputs the solver, the above process is based on inputting the graph data and the requirement information into the graph neural network model, and the graph neural network model directly outputs the solver. If the graph neural network model outputs type information, the above process is based on inputting the graph data into the graph neural network model to obtain the type information, and then determining the solver based on the type information and the requirement information.
[0119] The above method can obtain a solver that meets the user's needs by setting the demand information and determining the solver according to the demand information, thereby improving the user's usage experience.
[0120] Optionally, when determining the solver, if the number of solvers output by the graph neural network model is at least two, the solver corresponding to the problem to be solved can also be determined in the order of the pre-set solver priorities. For example, a certain solver is selected preferentially. Alternatively, if the number of solvers output by the graph neural network model is at least two, the solver preference information input by the user can also be received, and the solver corresponding to the problem to be solved is determined based on the preference information. For example, if the user prefers to select the MindOpt solver, then when the MindOpt solver exists in the output solvers, the solver is determined as the solver corresponding to the problem to be solved.
[0121] In one or more embodiments of the present application, optionally, the method further includes:
[0122] After solving the problem to be solved according to the solver, feedback information corresponding to the solution result is obtained; if the feedback information and the type information corresponding to the problem to be solved meet the preset conditions, corresponding training samples are generated according to the problem to be solved and added to the optimized sample set; wherein the optimized sample set is used to optimize the graph neural network model.
[0123] Figure 6 A schematic diagram of updating a graph neural network model provided in an embodiment of the present application, such as Figure 6 As shown, after solving the problem to be solved according to the determined solver, feedback information corresponding to the solution result can also be determined. According to the feedback information, the samples in the optimized sample set can be changed, and the changed optimized sample set can be used to train the graph neural network model to improve the accuracy of the output solver of the graph neural network model.
[0124] The feedback information may be user feedback or market feedback. User feedback may be direct feedback from users based on the solution results, for example, whether the effect is good or bad. Market feedback may be the application of the solution results to actual scheduling scenarios or allocation scenarios to obtain revenue information, and feedback information may be determined based on the revenue information, and the feedback results are positively correlated with the revenue information.
[0125] After determining the feedback information, if the feedback information and the type information corresponding to the problem to be solved meet the preset conditions, the training sample corresponding to the problem to be solved can be added to the training sample set. The preset condition may be to optimize the types of the problems to be solved in the sample set to be as large as possible.
[0126] It should be noted that the preset conditions may change over time. For example, when there is a lack of type A problems to be solved in the optimization sample set within a period of time, then each time after determining the feedback information, if the feedback information is not good, it is determined whether the type information corresponding to the problem to be solved is type A. If so, a training sample corresponding to the problem to be solved is generated and added to the optimization sample set. As time goes by, the type of problem to be solved that is missing from the optimization sample set may be type B. At this time, even if the feedback information corresponding to the type A problem to be solved is not good, it will not be added to the optimization sample set. When the type of the problem to be solved is type B and the feedback information is not good, it will be added to the optimization sample set.
[0127] It should be noted that the collection and use of feedback information and problems to be solved can be carried out with the user's knowledge and consent.
[0128] The above method updates the optimized sample set according to feedback information, which enables the graph neural network to be dynamically updated to meet current usage needs and further improve the accuracy of the graph neural network model to determine the solver.
[0129] Figure 7 A flow chart of another data processing method provided in an embodiment of the present application. Figure 7 As shown, the method may include:
[0130] Step 701: determine a supply chain scheduling problem to be solved, wherein the supply chain scheduling problem is used to determine the quantities of raw materials to be purchased from multiple suppliers based on an objective function under constraints.
[0131] The supply chain scheduling problem can be an optimization problem for a supply chain scheduling scenario that includes any optimization objective. The user can input the supply chain scheduling problem to be solved into the supply chain scheduling platform through algebraic language, wherein the supply chain scheduling platform can be embedded with modeling language software. Among them, due to different objective functions, the types corresponding to different supply chain scheduling problems may also be different. For example, for a part of the supply chain scheduling problems with objective functions, the type information can be a convex function; for another part of the supply chain scheduling problems with objective functions, the type information may be a concave function. For different types of supply chain scheduling problems, different solvers can be called from the modeling language software.
[0132] The embodiments of the present application can realize determining a solver for a supply chain scheduling problem suitable for an input from multiple solvers.
[0133] Step 702: Determine a solver corresponding to the supply chain scheduling problem based on the graph data corresponding to the supply chain scheduling problem and a pre-built graph neural network model, and solve the supply chain scheduling problem based on the solver to obtain and output the quantities of raw materials purchased from multiple suppliers.
[0134] Optionally, graph data can be used to represent the supply chain scheduling problem. There is no restriction on the type of graph data. The graph data can be a set consisting of multiple points and the lines between these points. The modeling language software can determine the corresponding graph data according to the supply chain scheduling problem and store it in the memory.
[0135] Optionally, after determining the supply chain scheduling problem, the graph data corresponding to the supply chain scheduling problem can be determined, and the graph data can be input into a pre-constructed graph neural network model. The pre-constructed graph neural network model can be obtained by training based on the graph data corresponding to the solved supply chain scheduling problem and the corresponding type information. Alternatively, the pre-constructed graph neural network can also be obtained by training based on the graph data and solver corresponding to the solved supply chain scheduling problem. Accordingly, when determining the solver based on the graph data and the graph neural network model corresponding to the supply chain scheduling problem, the graph neural network model can directly output the solver, or it can first output the type information and then determine the solver based on the type information.
[0136] After the solver is determined, the solver can be directly called to solve the supply chain scheduling problem to output a solution result, wherein the solution result can be the quantity of raw materials purchased from each supplier.
[0137] In this embodiment, the specific implementation process and principle of each step can be found in the previous embodiment and will not be repeated here.
[0138] In summary, the data processing method provided in the embodiment of the present application can determine the supply chain scheduling problem to be solved, determine the solver corresponding to the supply chain scheduling problem according to the graph data corresponding to the supply chain scheduling problem and the pre-built graph neural network model, and solve the supply chain scheduling problem based on the solver to obtain and output the quantities of raw materials purchased from multiple suppliers, thereby directly outputting the solver on the supply chain scheduling platform without the need for users of the supply chain scheduling platform to manually select the solver. Moreover, the solver determined by the above method is obtained after processing the graph data corresponding to the supply chain scheduling problem based on the graph neural network, and can make full use of the structural information and sub-graph information in the graph data, thereby improving the accuracy of determining the solver, and there is no need to determine the type information of the problem to be solved according to different judgment rules multiple times, which can effectively improve the efficiency of determining the solver, thereby solving supply chain problems more efficiently and accurately, improving user experience, and meeting supply chain implementation needs.
[0139] In each embodiment of the present application, the execution subject of the method can be set according to actual needs. For example, it can be executed by a terminal device, or it can be executed by a server, or some steps are executed by the terminal device and some steps are executed by the server.
[0140] Corresponding to the above data processing method, an embodiment of the present application further provides a data processing device, which may include:
[0141] A determination module, used to determine a solver corresponding to the problem to be solved based on the graph data corresponding to the problem to be solved and a pre-built graph neural network model;
[0142] A solution module is used to solve the problem to be solved based on the solver.
[0143] In one or more embodiments of the present application, optionally, the determination module is specifically configured to:
[0144] Determine type information corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the graph neural network model; the type information is used to describe at least one of the following: linearity, concavity, and smoothness;
[0145] A solver corresponding to the problem to be solved is selected from at least one solver according to the type information.
[0146] In one or more embodiments of the present application, optionally, each solver solves the problem by using at least one algorithm; the device further includes: an algorithm determination module, specifically configured to:
[0147] According to the type information corresponding to the problem to be solved, an algorithm for solving the problem to be solved is selected from at least one algorithm corresponding to the solver, so as to solve the problem to be solved based on the solver through the corresponding algorithm.
[0148] In one or more embodiments of the present application, optionally, the device further includes a semantic parsing module, which is specifically configured to:
[0149] Receiving an optimization model file input by a user; the optimization model file is used to represent the objective function and constraint conditions of the problem to be solved;
[0150] Determine the directed acyclic graph corresponding to the optimization model file through semantic analysis;
[0151] Among them, the graph data corresponding to the problem to be solved is the directed acyclic graph.
[0152] In one or more embodiments of the present application, optionally, the device further includes: a conversion module, specifically configured to:
[0153] Converting the optimization model file corresponding to the problem to be solved into a corresponding model instance;
[0154] Accordingly, the solution module is specifically used for:
[0155] The model instance is solved according to the solver.
[0156] In one or more embodiments of the present application, optionally, the determining module is further configured to:
[0157] Obtaining requirement information set by a user for selecting a solver; the requirement information includes at least one of the following: accuracy requirement, efficiency requirement, precision requirement, and cost requirement;
[0158] According to the graph data corresponding to the problem to be solved, the pre-built graph neural network model and the requirement information, the solver corresponding to the problem to be solved is determined.
[0159] In one or more embodiments of the present application, optionally, the device further includes an adding module, specifically configured to:
[0160] After solving the problem to be solved according to the solver, obtaining feedback information corresponding to the solution result;
[0161] If the feedback information and the type information corresponding to the problem to be solved meet the preset conditions, a corresponding training sample is generated according to the problem to be solved and added to the optimized sample set;
[0162] Among them, the optimized sample set is used to optimize the graph neural network model.
[0163] The data processing device provided in the embodiment of the present application can be used to execute the above Figures 1 to 6 The technical solution of the illustrated embodiment has similar implementation principles and technical effects, and will not be described in detail in this embodiment.
[0164] The present application also provides another data processing device, which may include:
[0165] A supply chain scheduling problem determination module, used to determine a supply chain scheduling problem to be solved, wherein the supply chain scheduling problem is used to determine the quantity of raw materials purchased from multiple suppliers based on an objective function under constraints;
[0166] A solver determination module, used to determine the solver corresponding to the supply chain scheduling problem based on the graph data corresponding to the supply chain scheduling problem and a pre-built graph neural network model;
[0167] A solution module solves the supply chain scheduling problem based on the solver, obtains and outputs the quantities of raw materials purchased from multiple suppliers.
[0168] The data processing device provided in the embodiment of the present application can be used to execute the above Figure 7 The technical solution of the illustrated embodiment has similar implementation principles and technical effects, and will not be described in detail in this embodiment.
[0169] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device of this embodiment may include:
[0170] at least one processor 801; and
[0171] A memory 802 communicatively connected to the at least one processor;
[0172] The memory 802 stores instructions that can be executed by the at least one processor 801, and the instructions are executed by the at least one processor 801 to enable the electronic device to execute the method described in any of the above embodiments.
[0173] Optionally, the memory 802 may be independent or integrated with the processor 801 .
[0174] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the aforementioned embodiments and will not be described in detail here.
[0175] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any of the above embodiments is implemented.
[0176] An embodiment of the present application further provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.
[0177] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0178] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.
[0179] It should be understood that the above-mentioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0180] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0181] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0182] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0183] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0184] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0185] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user data and other information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0186] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data processing method, characterized in that: include: Determine a solver corresponding to the problem to be solved according to graph data corresponding to the problem to be solved and a pre-built graph neural network model; wherein the graph data includes structured information and subgraph information; Solving the problem to be solved based on the solver; Receive an optimization model file corresponding to the problem to be solved input by a user; the optimization model file is used to represent the objective function and constraint conditions of the problem to be solved; Determine a directed acyclic graph corresponding to the optimization model file through semantic analysis; wherein the directed acyclic graph is a directed expression of operands and operators of the objective function; Among them, the graph data corresponding to the problem to be solved is the directed acyclic graph.
2. The method according to claim 1, characterized in that According to the graph data corresponding to the problem to be solved and the pre-built graph neural network model, determining the solver corresponding to the problem to be solved includes: Determine type information corresponding to the problem to be solved according to the graph data corresponding to the problem to be solved and the graph neural network model; the type information is used to describe at least one of the following: linearity, concavity, and smoothness; A solver corresponding to the problem to be solved is selected from at least one solver according to the type information.
3. The method according to claim 2, characterized in that Each solver solves the problem by at least one algorithm; the method further comprises: According to the type information corresponding to the problem to be solved, an algorithm for solving the problem to be solved is selected from at least one algorithm corresponding to the solver, so as to solve the problem to be solved based on the solver through the corresponding algorithm.
4. The method according to claim 1, characterized in that: The method further comprises: Converting the optimization model file corresponding to the problem to be solved into a corresponding model instance; Accordingly, solving the problem to be solved based on the solver includes: The model instance is solved according to the solver.
5. The method according to any one of claims 1 to 4, characterized in that: According to the graph data corresponding to the problem to be solved and the pre-built graph neural network model, determining the solver corresponding to the problem to be solved includes: Obtaining requirement information set by a user for selecting a solver; the requirement information includes at least one of the following: accuracy requirement, efficiency requirement, precision requirement, and cost requirement; According to the graph data corresponding to the problem to be solved, the pre-built graph neural network model and the requirement information, the solver corresponding to the problem to be solved is determined.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: After solving the problem to be solved according to the solver, obtaining feedback information corresponding to the solution result; If the feedback information and the type information corresponding to the problem to be solved meet the preset conditions, a corresponding training sample is generated according to the problem to be solved and added to the optimized sample set; Among them, the optimized sample set is used to optimize the graph neural network model.
7. A data processing method, characterized in that: include: Determine a supply chain scheduling problem to be solved, wherein the supply chain scheduling problem is used to determine the quantity of raw materials purchased from multiple suppliers based on an objective function under constraints; According to the graph data corresponding to the supply chain scheduling problem and the pre-built graph neural network model, a solver corresponding to the supply chain scheduling problem is determined, and the supply chain scheduling problem is solved based on the solver to obtain and output the quantities of raw materials purchased from multiple suppliers respectively; wherein the graph data includes structured information and subgraph information; Receive an optimization model file corresponding to a supply chain scheduling problem to be solved input by a user; the optimization model file is used to represent the objective function and constraint conditions of the supply chain scheduling problem to be solved; Determine a directed acyclic graph corresponding to the optimization model file through semantic analysis; wherein the directed acyclic graph is a directed expression of operands and operators of the objective function; Among them, the graph data corresponding to the problem to be solved is the directed acyclic graph.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Automating solving NP problems in annealer systems
CN112116093A