Model generation method and related system
The natural language model is generated by the natural language model, and the problems of inefficient mathematical modeling and poor generalization in the existing technology are solved, and efficient and accurate mathematical modeling and solution process are realized.
Patent Information
- Application Number
- CN202410404429.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-09-28
- Filing Date
- 2024-04-03
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art relies heavily on users' experience in the mathematical modeling process, resulting in inefficient modeling and poor generalization, making it difficult to construct mathematical models suitable for calculation by non-expert users.
Through the natural language model to deal with the natural language description of optimization problems, a mathematical model expressed by domain-specific language (DSL) is generated, including decision variables, constraints and objective functions, and then a solution file is obtained to solve optimization problems.
It lowers the threshold and cost of mathematical modeling, improves modeling efficiency and accuracy, and enables non-expert users to generate reliable mathematical models and solutions.
Smart Images

Figure CN119721232A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on September 28, 2023, with application number 202311278766.1 and invention name “A decision-making optimization method, device and system”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the field of artificial intelligence (AI) technology, and in particular to a model generation method, system, computing device cluster, computer-readable storage medium, and computer program product. Background Art
[0003] Operations research mainly uses mathematical methods to study the optimization paths and solutions of various systems, and provides decision makers with a basis for scientific decision-making. Mathematical programming is an important branch of operations research. Its main research goal is to find the optimal solution that can minimize or maximize a function in a given area. The application of mathematical programming is extremely common. According to the nature of the problem and the difference in the treatment method, mathematical programming can be divided into many different branches, such as linear programming, integer programming, nonlinear programming, combinatorial optimization, multi-objective programming, stochastic programming, dynamic programming, parameter programming and other problems. Different mathematical programming methods can be applied to different scenarios. For example, linear programming can be applied to network flow optimization problems, and mixed integer programming can be applied to production scheduling, supply chain, production scheduling, factory site selection and other problems.
[0004] There are two key steps in using operations research tools to solve practical application problems, namely mathematical modeling and problem solving. Mathematical modeling refers to abstracting the decision-making optimization problem in production and life into a mathematical programming problem. Mathematical programming problems generally consist of three parts: decision variables, constraints, and objective functions. Among them, decision variables represent the actual content that needs to be decided, such as the quantity of a certain commodity produced, the manpower invested, etc.; constraints represent the resource constraints faced when making decisions, such as limited raw materials, funds, etc.; and the objective function is an evaluation indicator of decision quality, such as profit maximization, cost minimization, etc. Problem solving refers to choosing a specific solution to solve the mathematical programming problem and obtaining the optimal solution or feasible solution to the problem, that is, the value of the decision variable that meets all constraints.
[0005] However, mathematical modeling currently relies heavily on the user's experience. For example, experts in the industry and experts in operations research are often required to build a mathematical model suitable for calculation, which greatly reduces the efficiency of mathematical modeling. In addition, the generalization of mathematical modeling is poor (that is, only specific experts can perform mathematical modeling). Therefore, how to improve the efficiency of mathematical modeling is a technical problem that needs to be solved urgently. Summary of the invention
[0006] The present application provides a model generation method. The present application also provides a problem solving system, a computing device cluster, a computer readable storage medium, and a computer program product corresponding to the above method.
[0007] In the first aspect, the present application provides a model generation method. The method can be executed by a model generation system. The model generation system is used to model the optimization problem and obtain a modeling result. The model generation system can be a software system, which can be deployed in a computing device cluster, for example, in a cloud computing cluster provided by a cloud service provider, or in an edge computing cluster. The computing device cluster executes the program code of the software system to execute the model output method of the present application. The software system can also be integrated into software with an optimization problem solving function (or a model generation function), for example, it can be in the form of functional modules such as plug-ins in the software. Alternatively, the software system can also be independent of the software with the optimization problem solving function (or the model generation function), and the software system calls the software with the optimization problem solving function (or the model generation function) to implement the optimization problem solving function. The software system can be deployed on a computing device, for example, it is deployed on a terminal device such as a desktop, a laptop, a tablet computer, a smart phone (also referred to as a terminal). The computing device executes the program code of the software system to execute the problem solving method of the present application. In some possible implementations, the model generation system may also be a hardware system, such as a computing device cluster with an optimization problem solving function (or a model generation function). When the hardware system is running, the model generation method of the present application is executed.
[0008] Specifically, the model generation method includes: obtaining a natural language description of the optimization problem, the natural language description of the optimization problem is used to describe the problem of adjusting the value of the decision object under given decision conditions so that the optimization target reaches the expected value; processing the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, the mathematical model is expressed through a domain-specific language, and the mathematical model includes the decision variables, the constraints and the objective function of the optimization problem, wherein the decision object is a natural language description of the decision variables, the decision conditions are a natural language description of the constraints, and the optimization target is a natural language description of the objective function; according to the mathematical model, a solution file is obtained, and the solution file is used to solve the optimization problem through a solver.
[0009] The solution file may be a file that can be directly understood by a subsequent solver, for example, it may be described in a language such as MPS.
[0010] A parsing tool capable of parsing DSL can be used to convert the mathematical model described by DSL into a solution file (for example, a file described by MPS). Exemplarily, the interpretation engine of an existing modeling tool (capable of parsing DSL) can be used to directly convert DSL into a standard model file MPS that can be understood by the solver. Optionally, the mathematical model described by DSL can also be converted into a solution file through a machine learning model, for example, it can be implemented through a language model. During training, the machine learning model is equipped with the ability to parse DSL through the construction of training samples and the model update process.
[0011] In the present application, when modeling an optimization problem, a model (mathematical model) of the optimization problem is constructed through a natural language description of the optimization problem. The mathematical model is expressed through a domain-specific language DSL. The advantages of DSL are: DSL description information is similar to a high-level language, the modeling threshold is low, and the annotation cost of training samples is low. Therefore, a highly accurate conversion model (for example, a language model) for constructing a DSL model based on the natural language description of the optimization problem can be trained at a low cost. Moreover, since the DSL model is easier for users to understand, users can modify the DSL model during the reasoning process to obtain a more accurate DSL model that better meets their own requirements. Therefore, the reliability and accuracy of the model generation results can be guaranteed while greatly reducing labor costs and user requirements.
[0012] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and input mathematical model modification information when the mathematical model needs to be modified, and the mathematical model modification information can be a modification of the mathematical model. Specifically, the mathematical model modification information input by the user can be obtained, and the model modification information indicates the modification of the mathematical model; according to the model modification information, at least one of the decision variables, constraints and objective functions of the mathematical model is modified to obtain the modified mathematical model; according to the modified mathematical model, a modified solution file is obtained.
[0013] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and when it is necessary to modify the mathematical model by modifying the description of the optimization problem itself, the user can enter natural language modification information, which can be a modification of the natural language description of the optimization problem. Specifically, the natural language modification information entered by the user can be obtained, and the natural language modification information indicates the modification of the natural language description of the optimization problem; according to the natural language modification information, the text content of the natural language description of the optimization problem is modified to obtain a modified natural language description of the optimization problem; according to the modified natural language description of the optimization problem, a modified solution file is obtained again.
[0014] Through the above methods, users can evaluate whether the generated DSL model meets business requirements. If the DSL model does not meet business requirements, users can input modification information into the optimization problem solving system, eliminating the tedious process of manual modification and programming and improving operational efficiency; the system can respond in real time and generate new optimization results. This enables users to make real-time decisions in different scenarios and quickly adapt to changing needs and conditions.
[0015] In a possible implementation, the method further includes: solving the optimization problem according to the solution file to obtain a solution result of the optimization problem. Since the DSL model is easier for users to understand, during the reasoning process, users can modify the DSL model to obtain a more accurate DSL model that better meets their own requirements, thereby greatly reducing labor costs and user requirements while ensuring the reliability and accuracy of the solution result of the optimization problem.
[0016] In a possible implementation, the method further includes:
[0017] A model processing platform is provided, which provides at least one of a problem input column, a model processing column and a result output column, wherein the problem input column is used to display the natural language description of the optimization problem input by the user, the model processing column is used to display the mathematical model, the model processing column is also used to allow the user to input the natural language modification information, and the result output column is used to display the solution result of the optimization problem.
[0018] For example, in terms of the displayed position relationship, the question input column can be located above the model processing column, and the model processing column can be located above the result output column (the reason is that the information in the question input column is the information initially input by the user, and the information output by the model processing column and the modification information received are after the information input in the question input column, so displaying the question input column above the model processing column will be more in line with the user's usage habits), or, the question input column and the model processing column can be set adjacent to each other, and the result output column can be independently set in another area (for example, below or to the right) and far away from the model processing column (the reason is that the question input column and the model processing column focus more on the input of information, and the result output column focuses more on the output of information, and displaying the two at a position far away from each other is more in line with the user's usage habits). This application does not limit the display position relationship between different columns.
[0019] In a possible implementation, the decision object in the problem input column and the decision variable in the model processing column are displayed using characters in the same format, or the decision condition in the problem input column and the constraint condition in the model processing column are displayed using characters in the same format, or the optimization goal in the problem input column and the objective function in the model processing column are displayed using characters in the same format.
[0020] For example, the same format may include but is not limited to: using characters of the same color, characters of the same size, characters of the same font, or the same special effects (such as using the same color highlight) to display, etc., and the embodiments of the present application are not limited thereto.
[0021] In a possible implementation, the method further includes: after obtaining the solution result of the optimization problem corresponding to the mathematical model according to the mathematical model, the method further includes: receiving modification information, obtaining a second model of the optimization problem according to the modification information, the modification information indicating the modification of the natural language description of the optimization problem or the modified mathematical model, the second model being expressed in a domain-specific language DSL; and obtaining the solution result of the optimization problem corresponding to the second model according to the second model. After obtaining the solution result, the user can readjust the natural language model or the DSL model based on the solution result.
[0022] In a possible implementation, the natural language description of the optimization problem includes: requirements for the solution result or solution process of the optimization problem, the requirements include: at least one of the requirements for solution speed, solution accuracy, and whether it is necessary to quickly provide a feasible solution, and the mathematical model meets the requirements. When the requirements for the solution result or solution process of the optimization problem are different, the generated DSL model is also different. Therefore, "requirements for the solution result or solution process of the optimization problem" can be added to the natural language description of the optimization problem, so that the generated DSL meets the requirements indicated in the natural language description. When the DSL model is generated through the language model, "requirements for the solution result or solution process of the optimization problem" can be included in the prompt, so as to guide the language model to generate a DSL model that meets the requirements.
[0023] For example, the DSL model can be modeled in many different ways. The DSL model also includes many types of models. For example, taking the traveling salesman problem (TSP) as an example, there are two modeling methods: DFJ and MTZ. If the optimal solution needs to be found, DFJ is faster, but MTZ can quickly give a feasible solution.
[0024] In a possible implementation, before obtaining, based on the mathematical model, a solution result of the optimization problem corresponding to the mathematical model, the method further includes: receiving a solution request for the optimization problem corresponding to the mathematical model.
[0025] In a possible implementation, obtaining the mathematical model of the optimization problem according to the natural language description includes: obtaining the mathematical model of the optimization problem according to a prompt constructed based on the natural language description; the prompt is used to input into a language model, and the prompt indicates to convert the natural language description into a model expressed by a domain-specific language DSL.
[0026] It should be understood that the mathematical model in the present application is different from the language model. The mathematical model is a modeling result for the optimization problem, while the language model is a machine learning model with learnable parameters.
[0027] In a possible implementation, when training a language model, a training sample including a prompt and a corresponding DSL model (the model serves as a label) may be constructed, wherein the prompt may instruct the language model to generate a DSL model based on an optimization problem described in natural language.
[0028] The obtaining of the mathematical model of the optimization problem according to the natural language description comprises: obtaining the mathematical model of the optimization problem through a language model according to the natural language description; or sending the natural language description to a cloud side device and receiving the mathematical model of the optimization problem sent by the cloud side device.
[0029] In a possible implementation, the method further includes: obtaining a third model of the optimization problem according to the mathematical model, wherein the third model is described by a standard model file. When solving the optimization problem, a solution to the optimization problem corresponding to the mathematical model can be obtained by a solver according to the third model of the optimization problem.
[0030] Among them, the standard model file can be described in a language that is lower than DSL and can be understood by the solver, for example, it can be an MPS, NP or LP file. Among them, the MPS file is a file format ending with the suffix .mps. It is a standard format for expressing linear and integer programming problems. Many optimization solvers now support this format.
[0031] Afterwards, the DSL can be converted into a standard model file that can be understood by the solver (for example, by the interpretation engine of the modeling tool), thereby ensuring the reliability and accuracy of the solution results while greatly reducing labor costs and user requirements.
[0032] In a possible implementation, the solution result is expressed through a natural language description of the business domain where the optimization problem resides.
[0033] In one possible implementation, the solution results may be analyzed and interpreted, and the analysis results may be converted into natural language descriptions in a business context. For example, the variables in the solution results may be described in natural language. The above steps may be performed by a language model. In this way, the readability of the solution results may be improved.
[0034] In a second aspect, the present application provides a model generation device, which is applied to a computing device or a computing device cluster, and the device includes:
[0035] An interactive module, used to obtain a natural language description of an optimization problem, wherein the natural language description of the optimization problem is used to describe the problem of adjusting the value of a decision object under given decision conditions so that the optimization target reaches an expected value;
[0036] A conversion module is used to process the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, wherein the mathematical model is expressed through a domain-specific language, and the mathematical model includes the decision variables, the constraints and the objective function of the optimization problem, wherein the decision object is the natural language description of the decision variables, the decision conditions are the natural language description of the constraints, and the optimization target is the natural language description of the objective function; according to the mathematical model, a solution file is obtained, and the solution file is used to solve the optimization problem through a solver.
[0037] In a possible implementation, the device further includes:
[0038] A solution module is used to solve the optimization problem according to the solution file to obtain a solution result of the optimization problem.
[0039] In a possible implementation, the interaction module is further used to:
[0040] Acquire natural language modification information input by a user, wherein the natural language modification information indicates modification of the natural language description of the optimization problem;
[0041] The conversion module is also used to: modify the text content of the natural language description of the optimization problem according to the natural language modification information to obtain a modified natural language description of the optimization problem; and re-obtain a modified solution file according to the modified natural language description of the optimization problem.
[0042] In a possible implementation, the interaction module is further used to:
[0043] Acquiring mathematical model modification information input by a user, wherein the model modification information indicates modification of the mathematical model;
[0044] The conversion module is further used to: modify at least one of the decision variables, constraint conditions and objective function of the mathematical model according to the model modification information to obtain the modified mathematical model;
[0045] A modified solution file is obtained according to the modified mathematical model.
[0046] In a possible implementation, the interaction module is further used to:
[0047] A model processing platform is provided, which provides at least one of a problem input column, a model processing column and a result output column, wherein the problem input column is used to display the natural language description of the optimization problem input by the user, the model processing column is used to display the mathematical model, the model processing column is also used to allow the user to input the natural language modification information, and the result output column is used to display the solution result of the optimization problem.
[0048] In a possible implementation, the decision object in the problem input column and the decision variable in the model processing column are displayed using characters in the same format, or the decision condition in the problem input column and the constraint condition in the model processing column are displayed using characters in the same format, or the optimization goal in the problem input column and the objective function in the model processing column are displayed using characters in the same format.
[0049] In a possible implementation, the conversion module is specifically used to:
[0050] A prompt Prompt for the optimization problem is constructed based on the natural language description of the optimization problem, wherein the prompt indicates that the natural language description is converted into a model expressed in a domain-specific language DSL; the Prompt is used to guide the natural language model to generate an output corresponding to the Prompt; and the Prompt is input into the natural language model to obtain a mathematical model of the optimization problem.
[0051] In a third aspect, the present application provides a computing device cluster. The computing device cluster includes at least one computing device, and the at least one computing device includes at least one processor and at least one memory. The at least one processor and the at least one memory communicate with each other. The at least one processor is used to execute instructions stored in the at least one memory, so that the computing device or the computing device cluster executes the method described in the first aspect or any implementation of the first aspect.
[0052] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, wherein the instructions instruct a computing device or a computing device cluster to execute the problem-solving method described in the first aspect or any one of the implementations of the first aspect.
[0053] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computing device or a computing device cluster, enables the computing device or the computing device cluster to execute the problem-solving method described in the first aspect or any one of the implementations of the first aspect.
[0054] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.
[0056] Figure 1 A schematic diagram of an application architecture provided for an embodiment of the present application;
[0057] Figure 2 and Figure 3 A schematic diagram of a model training architecture provided in an embodiment of the present application;
[0058] Figure 4 and Figure 5 A schematic diagram of an application architecture provided for an embodiment of the present application;
[0059] Figure 6 A schematic diagram of a model generation method provided in an embodiment of the present application;
[0060] 7A to 7E A schematic diagram of a page provided for an embodiment of the present application;
[0061] Figures 8 to 10 A schematic diagram of an application architecture of a model generation method provided in an embodiment of the present application;
[0062] Figures 11 to 14 A schematic diagram of a model generation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0064] In the embodiments of the present application, "corresponding (corresponding, relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0065] The business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0066] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0067] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0068] First, some technical terms involved in the embodiments of the present application are introduced.
[0069] 1. Operations research and optimization: Operations research mainly studies the use and planning of various resources by humans, in order to maximize the benefits of limited resources and achieve the overall optimal goal under certain constraints. In the embodiments of the present application, operations research and optimization problems can be referred to as optimization problems.
[0070] 2. Mathematical programming: Mathematical programming is a branch of mathematics that focuses on finding the optimal solution that can minimize or maximize a function in a given area. Mathematical programming can be divided into many different branches, such as linear programming, integer programming, nonlinear programming, combinatorial optimization, multi-objective programming, stochastic programming, dynamic programming, parametric programming, and other problems.
[0071] 3. Mathematical programming solver: A software system that solves established linear, integer, mixed integer and various nonlinear programming models.
[0072] 4. Mathematical modeling: The process of expressing decision optimization problems as mathematical programming models, including problem abstraction, identification of decision variables and constraints, expression using mathematical models, and generation of mathematical models.
[0073] 5. Modeling tools: software systems that assist in the construction of mathematical programming models and generate standardized mathematical programming model files. They usually also have the ability to call mathematical programming solvers to obtain solution results.
[0074] 6. Domain Specific Language (DSL): A programming language specifically designed to solve problems in a specific domain. Compared with general programming languages (such as Java, Python, etc.), DSL focuses more on the needs and semantics of a specific domain and provides a higher level of abstraction and expression capabilities. DSL can be divided into two forms: internal DSL and external DSL. Internal DSL is a domain-specific syntax and library embedded in a general programming language, which uses the syntax and tools of the general programming language to implement domain-specific functions. External DSL is a domain-specific language independent of the general programming language, with its own syntax and interpreter / compiler.
[0075] 7. Large language model (LLM): A large language model is a language model with a huge scale built based on deep learning technology. It learns the laws and probability distribution of language by training a large amount of text data, such as articles, books, news on the Internet, etc. The large language model can understand and generate natural language and has certain semantic understanding and language generation capabilities.
[0076] In the prior art, in the process of mathematical modeling and problem solving for optimization problems, when a production system needs to be optimized, experts in the industry (such as transportation, energy, industrial manufacturing, etc.) and experts in operations research can work together to understand and abstract the optimization problem, and build a corresponding mathematical optimization model. Then, the mathematical optimization model and the production data in the production system can be processed through modeling tools (mathematical programming modeling tools) to obtain an example of a mathematical optimization problem. Then, operations research experts can manually formulate a solution. Finally, the example of the mathematical optimization problem can be solved through the solution to obtain the required decision. It can be seen that the participation of industry experts and operations research experts is required in both the mathematical modeling link and the problem solving link.
[0077] Among them, for the mathematical modeling link, on the one hand, the modeler needs to be familiar with the business background and understand the meaning and requirements of each decision factor; on the other hand, the modeler must have considerable mathematical optimization skills and be able to convert the variables and constraints of different types of decisions into corresponding mathematical relationships to form a complete mathematical planning problem. In addition, there are also advantages and disadvantages in mathematical optimization models. "Good" models are easier to solve or less likely to cause numerical precision problems, while "bad" models are just the opposite. There are usually multiple equivalent modeling methods for the same problem, and modelers need long-term academic training to master the skills of building a "good" model.
[0078] In actual production, complex multi-stage decision-making optimization problems are often encountered in the problem-solving phase. A single standardized solver cannot meet the solution requirements. Users are required to develop customized algorithms and integrate and arrange them with existing solution tools to form a complete solution. Formulating a solution requires a deep understanding of the nature of the problem itself, as well as mastering the design and use skills of various solvers and solution algorithms. Therefore, it generally requires senior operations research experts to complete it.
[0079] It can be seen that both the mathematical modeling and problem solving stages are highly dependent on the user's experience.
[0080] In addition, during the solution process, the optimization problem to be solved can be solved through modeling tools. The user can check the mathematical model obtained by modeling to confirm whether it needs to be modified. However, on the one hand, the mathematical model obtained by existing modeling tools is described by a standard model file (MPS), but the code in the MPS needs to be described accurately, so the training samples of the modeling tool itself need to be sufficient, which is difficult to meet in practice (the reason is that the standard labor cost is too high). On the other hand, the MPS file is difficult for users to understand, and requires a high level of ability from the user himself, which requires a high labor cost.
[0081] In view of this, the present application provides a model generation method. The method can be executed by a model generation system. The model generation system is used to model the optimization problem and obtain a modeling result. The model generation system can be a software system, which can be deployed in a computing device cluster, for example, in a cloud computing cluster provided by a cloud service provider, or in an edge computing cluster. The computing device cluster executes the program code of the software system to execute the model output method of the present application. The software system can also be integrated into software with an optimization problem solving function (or a model generation function), for example, it can be in the form of functional modules such as plug-ins in the software. Alternatively, the software system can also be independent of the software with an optimization problem solving function (or a model generation function), and the software system calls the software with an optimization problem solving function (or a model generation function) to implement the optimization problem solving function. The software system can be deployed on a computing device, for example, it is deployed on a terminal device such as a desktop, a laptop, a tablet computer, a smart phone (also referred to as a terminal). The computing device executes the program code of the software system to execute the problem solving method of the present application. In some possible implementations, the model generation system may also be a hardware system, such as a computing device cluster with an optimization problem solving function (or a model generation function). When the hardware system is running, the model generation method of the present application is executed.
[0082] In order to make the technical solution of the present application clearer and easier to understand, the system architecture of the present application is introduced below with reference to the accompanying drawings.
[0083] In an embodiment of the present application, in one possible implementation method, an AI basic development platform is deployed on a cloud management platform (also referred to as a cloud platform), and tenants can train the above-mentioned models on the AI basic development platform.
[0084] Among them, the above-mentioned AI model can be a language model in the embodiment of the present application. The language model can be used to obtain a DSL model of the optimization problem based on the natural language description of the input optimization problem. The tenant can train to obtain a language model that meets the requirements.
[0085] It should be understood that the AI basic development platform is a platform-as-a-service (PaaS) cloud service in the cloud management platform. It is a software platform that assists tenants (also known as users, AI developers, etc.) in building, training, and deploying AI models and developing and deploying AI applications based on the large amount of basic resources and software capabilities owned by public cloud service providers. Figure 1As shown in the figure, the interaction between tenants and the AI basic development platform mainly includes: tenants log in to the cloud platform through the client web page, select and purchase the cloud services of the AI basic development platform in the cloud platform, and after the purchase, tenants can carry out full-process AI development based on the functions provided by the AI basic development platform. When tenants develop and train their own AI models on the AI basic development platform, they are based on the basic resources in the data center of the cloud service provider (mainly computing resources, such as central processing unit (CPU), graphics processing unit (GPU), embedded neural network processor (neural-network process units, NPU), etc.). Therefore, when tenants purchase and use the AI basic development platform, they mainly pay for the resources used.
[0086] For the sake of ease of description, the following takes the training process of the feature extraction model on the AI basic development platform as an example to illustrate the process of model training on the AI basic development platform.
[0087] As an example, when training a feature extraction model on an AI basic development platform, in order to improve the training efficiency of the feature extraction model, a distributed parallel training method can be used. There are two types of distributed parallel training of models, one is called data parallelism and the other is called model parallelism.
[0088] For example, Figure 2 As shown, data parallelism specifically refers to deploying the same feature extraction model to be trained on multiple nodes (for example: nodes 1, 2, 3, ..., N), and dividing the data set used for training into multiple data subsets and distributing them to each node. Each node independently uses the data in its corresponding data subset to train the feature extraction model in the node. In each training iteration, the gradient value calculated by each node can be synchronized to other nodes, so that each node can obtain the gradient mean of an iteration process. The gradient mean is the average value of the gradient of each node in the same iteration process. Each node can update the parameters of its own feature extraction model according to the gradient mean. This is equivalent to training the feature extraction model by aggregating the mini-batch data on many nodes to form a large batch data, so that the convergence speed of the feature extraction model will be faster, improving the efficiency of model training. Among them, each node can be a GPU, a virtual machine instance, or a container instance.
[0089] For example, Figure 3As shown, model parallelism (also called network parallelism) specifically refers to splitting a feature extraction model to obtain multiple sub-model parts, and different sub-model parts are deployed on different nodes. During training, the sub-model parts on different nodes calculate the same data in a data set according to the structural order of the model. In an iteration process, the gradient value can be obtained after the calculation of the sub-model parts on different nodes, and the parameters of each sub-model part can be updated by forward propagation or back propagation according to the gradient value. After multiple iterations, when the training requirements are met, the sub-model parts on each node are reorganized according to the structure of the feature extraction model, and a trained feature extraction model can be obtained. When the feature extraction model is large in scale, by splitting the feature extraction model for training, the training of the feature extraction model can be combined with the computing power of multiple nodes. Optionally, if the trained feature extraction model can also be distributedly deployed according to the split structure, when the feature extraction model is used for reasoning, distributed reasoning is performed.
[0090] The AI basic development platform can also deploy the trained model (for example, language model) on nodes in the cloud environment or nodes in the edge environment. The nodes in the cloud environment can be virtual machine instances, container instances, physical servers, etc., and the nodes in the edge environment can be various edge devices. Figure 4 As shown in the figure, when the scale of the model is large, the model can be distributed and deployed on multiple nodes based on the idea of model parallelism. In another example, the model can also be deployed independently on multiple nodes to support a large number of online service visits. In another example, the AI basic development platform can also deploy AI applications to edge devices registered with the cloud platform according to the application requirements of the AI model.
[0091] The deployed AI model can become an AI application or a part of an AI application. Figure 5 As shown in the figure, tenants can access AI applications online through web pages or through client apps. When AI applications are used, they can be called online to call AI models deployed in edge environments or cloud environments to provide responses. Therefore, AI models developed and trained through the AI basic development platform can realize the reasoning of online request data and return the reasoning results.
[0092] Among them, the above-mentioned AI application can have the function of solving the optimization problem to be solved and obtaining the solution result.
[0093] In order to achieve the above functions, in addition to the trained language model, you can also deploy (online or locally) a converter and a solver. The converter can convert the DSL model obtained by the AI model into MPS, and the solver can solve the MPS to obtain the solution result.
[0094] When the AI model provides online reasoning services, the AI basic development platform can continuously collect input and output data of the reasoning process, use the input and output data of the reasoning stage to continue to enrich the training data set, and continue to optimize the training AI model based on the data of the reasoning stage and the corresponding manually confirmed results.
[0095] It should be understood that in other cases, the AI model developed and trained by the aforementioned AI basic development platform may not be deployed online, but the tenant can download the trained AI model to the local computer and freely deploy it locally. For example, the tenant can choose to save the trained AI model to OBS, and then download the AI model from OBS to the local computer.
[0096] The problem-solving system in the embodiment of the present application may have the function of solving the optimization problem to be solved and obtaining a solution result.
[0097] In some examples, the above optimization problem solving system can be deployed entirely in the cloud (cloud environment), or entirely on the edge (edge environment), or on the terminal. In other examples, the optimization problem solving system can also be deployed in different environments, for example, it can be deployed in the cloud and the edge in an edge-cloud collaborative manner.
[0098] The optimization problem solving system can be subdivided into conversion modules, language processing modules, conversion modules, solving modules, etc. according to different functions. It should be understood that the embodiment of the present application can refer to the language model module, conversion module, and solving module as processing modules, which can be split into more or merged into fewer modules in actual applications. The deployment of the optimization problem solving system may involve hardware devices in the cloud and hardware devices at the edge. The hardware devices in the cloud usually have rich computing power and huge storage capacity, such as servers and databases, and the hardware devices at the edge have certain reasoning capabilities and storage capabilities, such as industrial computers and artificial intelligence edge computing devices. In some possible implementations, the deployment of the optimization problem solving system also involves terminals, which may include mobile phones, self-driving cars, industrial quality inspection systems and other IoT devices.
[0099] The conversion module can obtain the natural language description of the optimization problem input by the user. For example, the conversion module can be deployed on the end side, and the end side can provide an interactive interface. The interactive interface can be a graphical user interface (GUI). The user can input the natural language description of the optimization problem through the GUI. For example, the conversion module can be deployed on the cloud side or the edge side, and the conversion module can obtain the natural language description of the optimization problem transmitted by the end side device.
[0100] In addition, the conversion module may also be based on the user's modification information on the subsequently obtained model (eg, DSL model) or the solution result.
[0101] The language model module can generate a DSL model according to the natural language description of the optimization problem by calling the language model. For example, the language model module can be deployed on the cloud side or the edge side. The language model module can generate a DSL model according to the natural language description of the optimization problem by calling the language model.
[0102] It should be understood that the DSL model can be presented on the client side so that the user can view and modify it.
[0103] In addition, the language model module can also obtain a modified DSL model by calling the language model based on the user's modification information.
[0104] The conversion module can convert the DSL model obtained by the language model module into MPS. For example, the conversion module can be deployed on the cloud side or the edge side. The conversion module can convert the DSL model obtained by the language model module into MPS through the interpretation engine of the modeling tool.
[0105] The solution module can generate a solution result according to the MPS obtained by the conversion module by calling the solver. For example, the solution module can be deployed on the cloud side or the edge side, and the solution module can generate a solution result according to the MPS obtained by the conversion module by calling the solver.
[0106] It should be understood that the solution results can be presented on the terminal side so that the user can view and modify them.
[0107] based on Figure 1 and Figure 5 The model generation system shown, the present application provides a model generation method, and the problem solving method of the present application is introduced below.
[0108] See also Figure 6 The flowchart of the problem-solving method shown in FIG. 1 can be executed by a model generation system. The method includes:
[0109] 601. Obtain a natural language description of an optimization problem, where the natural language description of the optimization problem is used to describe the problem of adjusting the value of a decision object so that an optimization target reaches an expected value under given decision conditions.
[0110] In a possible implementation, a natural language description of the optimization problem input by the user may be obtained.
[0111] For example, a user may input a natural language description of an optimization problem on a terminal device, and then an interactive module of the terminal device may obtain the natural language description of the optimization problem input by the user.
[0112] Among them, the natural language description of the optimization problem can be a description of the optimization problem itself. The natural language description is expressed through descriptions related to actual business scenarios. For example, the optimization problem can include variables (that is, decision objects), objective functions (that is, making the optimization target reach the expected value) and constraints (that is, decision conditions), wherein the decision objects, decision conditions and optimization targets are all described in natural language rather than mathematical formulas. The decision object is a parameter or variable that can be adjusted or controlled in the optimization problem. The decision condition is a restriction on the value of the decision object, which usually describes the limiting conditions of the optimization problem, such as the restriction of production resources, etc. The optimization target is the optimization target of the optimization problem that the user as a decision maker wants to pursue. The natural language description of the optimization problem is used to describe the problem of adjusting the value of the decision object to make the optimization target reach the expected value under given decision conditions. Among them, the expected value can be a global extreme value, such as a global maximum value or a global minimum value, or a local extreme value, such as a local maximum value or a local minimum value. Preferably, the expected value defines key indicators such as cost, benefit, efficiency, etc., and is used to find the production plan with the lowest cost. In the optimization process, the process of approaching the optimal solution by continuously adjusting the variables is the continuous improvement of the expected value. In some embodiments provided in this application, the optimization problem may involve fields such as industrial production scheduling, logistics distribution, and resource scheduling.
[0113] Exemplarily, the natural language description of the optimization problem can be: "A restaurant is adding two new dishes to the menu, chicken and beef. The production cost of each chicken dish is $5, and the production cost of each beef dish is $8. The restaurant has budgeted $300 for these ingredients. The selling price of chicken is $12 and the selling price of beef is $18. In addition, each chicken dish requires 2 units of preparation time, and each beef dish requires 3 units of preparation time. The restaurant has 35 units of preparation time. How many chicken and beef dishes should the restaurant prepare to maximize profits? Build this model."
[0114] In this example, the decision objects are the amount of chicken and beef to be prepared, the decision conditions are that the total cost of beef and chicken should be within the budget, the total preparation time of beef and chicken should be within the overall preparation time, and the optimization goal is to maximize profit, which is the sum of the profits of all dishes, and the profit is the selling price of the dish minus the cost of the dish. The above content about decision objects, decision conditions and optimization goals is included in the semantics of the natural language description input by the user.
[0115] In addition, in order to obtain a model of the optimization problem that better meets the user's requirements, the natural language description of the optimization problem may include, in addition to the description of the optimization problem itself, requirements for the solution result or solution process of the optimization problem. For example, the requirements include at least one of the requirements for solution speed, solution accuracy, and whether it is necessary to quickly provide a feasible solution.
[0116] In addition to directly inputting the natural language description of the optimization problem in the problem input column 701, the client side can also pre-provide description templates of optimization problems in multiple fields, and the user can directly modify the template adaptively. Figure 7B , Figure 7B This is a schematic diagram of a page related to solving an optimization problem. The user can select a related optimization problem template in the problem template 702.
[0117] 602. Process the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, wherein the mathematical model is expressed in a domain-specific language, and the mathematical model includes the decision variables, the constraints and the objective function of the optimization problem, wherein the decision object is a natural language description of the decision variables, the decision conditions are a natural language description of the constraints, and the optimization target is a natural language description of the objective function. In this field, decision variables are usually represented by symbols (such as x, y, z), and constraints can be equations or inequalities, such as Ax≤b, where A is a coefficient matrix, x is a decision variable vector, b is a constant vector, and the objective function is usually represented by the symbol f(x), where x is a decision variable vector.
[0118] For example, Figure 7C As shown, in the above step 601, the optimization problem of preparing dishes in a restaurant can be transformed into:
[0119] objective
[0120] max 7x+10y
[0121] st
[0122] 5x+8y<=300
[0123] 2x+3y<=35
[0124] x,y>=0
[0125] x,y∈R
[0126] Among them, the decision variables are x and y, the constraints are 5x+8y<=300, 2x+3y<=35, x,y>=0, x,y∈R, and the objective function is max 7x+10y. The decision object is the natural language description of the decision variable, the decision condition is the natural language description of the constraint, and the optimization goal is the natural language description of the objective function. That is, x and y refer to the decision objects of the number of chicken and beef prepared by the restaurant respectively, 5x+8y<=300, 2x+3y<=35, x,y>=0, x,y∈R is used to refer to the decision conditions that the total cost of beef and chicken should be limited to the budget range, and the total preparation time of beef and chicken should be limited to the total preparation time, and max 7x+10y is used to refer to the optimization goal of maximizing profits.
[0127] In the present application, when modeling an optimization problem, a model (mathematical model) of the optimization problem is constructed through a natural language description of the optimization problem. The mathematical model is expressed through a domain-specific language DSL. The advantages of DSL are: DSL description information is similar to a high-level language, the modeling threshold is low, and the annotation cost of training samples is low. Therefore, a highly accurate conversion model (for example, a language model) for constructing a DSL model based on the natural language description of the optimization problem can be trained at a low cost. Moreover, since the DSL model is easier for users to understand, users can modify the DSL model during the reasoning process to obtain a more accurate DSL model that better meets their own requirements. Therefore, the reliability and accuracy of the model generation results can be guaranteed while greatly reducing labor costs and user requirements.
[0128] In the embodiment of the present application, the natural language description of the optimization problem is used to describe the problem of adjusting the value of the decision object to make the optimization target reach the expected value under given decision conditions, and the optimization problem described by the DSL language (that is, the mathematical model in the embodiment of the present application) may include the decision object (that is, the variable) and may not include the definition of the variable ( Figure 7C ), and can also include variable definitions ( Fig.7D ).
[0129] In a possible implementation, a mathematical model of the optimization problem can be obtained according to the natural language description through a machine learning model (for example, a language model, more specifically, a large language model LLM), and the mathematical model is expressed in a domain-specific language DSL.
[0130] In a possible implementation, a prompt can be constructed based on a natural language description and used as the input of a language model. The language model can be trained to have the ability to obtain a DSL model based on a natural language model of an optimization problem. In other words, the language model can be a language model for a vertical field. Furthermore, the language model can output a mathematical model of the optimization problem (expressed through a DSL), and the mathematical model can be a domain-specific mathematical optimization model (NLP2DSL).
[0131] The process of constructing the prompt may be completed on the client side, or the client side may send the natural language description to the cloud side and the construction may be completed by the cloud side device.
[0132] In the embodiment of the present application, the user uses natural language to describe the optimization problem, and the language model completes the construction of the mathematical model. The DSL model is modeled by the language model, which can reduce the modeling experience requirements for the modeler of mathematical optimization problems, so that users who do not have relevant knowledge backgrounds in mathematical optimization can complete mathematical optimization modeling. The obtained DSL model is similar to a high-level language, with a low modeling threshold and low annotation cost for training samples. Therefore, a highly accurate conversion model (for example, a language model) for building a DSL model based on the natural language description of the optimization problem can be trained at a low cost, and because the DSL model is easier for users to understand.
[0133] In a possible implementation, the cloud-side device can obtain the mathematical model of the optimization problem through the language model according to the natural language description, and the cloud-side device can send the mathematical model of the optimization problem to the terminal-side device. Then, the terminal device can present the mathematical model.
[0134] In a possible implementation, first modification information may also be obtained, and a modified mathematical model may be obtained based on the first modification information, wherein the first modification information indicates a natural language description of the optimization problem or a modification of the mathematical model.
[0135] 603. Obtain a solution file according to the mathematical model, wherein the solution file is used to solve the optimization problem through a solver;
[0136] The solution file may be a file that can be directly understood by a subsequent solver, for example, it may be described in a language such as MPS.
[0137] A parsing tool capable of parsing DSL can be used to convert the mathematical model described by DSL into a solution file (for example, a file described by MPS). Exemplarily, the interpretation engine of an existing modeling tool (capable of parsing DSL) can be used to directly convert DSL into a standard model file MPS that can be understood by the solver. Optionally, the mathematical model described by DSL can also be converted into a solution file through a machine learning model, for example, it can be implemented through a language model. During training, the machine learning model is equipped with the ability to parse DSL through the construction of training samples and the model update process.
[0138] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and input mathematical model modification information when the mathematical model needs to be modified, and the mathematical model modification information can be a modification of the mathematical model. Specifically, the mathematical model modification information input by the user can be obtained, and the model modification information indicates the modification of the mathematical model; according to the model modification information, at least one of the decision variables, constraints and objective functions of the mathematical model is modified to obtain the modified mathematical model; according to the modified mathematical model, a modified solution file is obtained.
[0139] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and when it is necessary to modify the mathematical model by modifying the description of the optimization problem itself, the user can enter natural language modification information, which can be a modification of the natural language description of the optimization problem. Specifically, the natural language modification information entered by the user can be obtained, and the natural language modification information indicates the modification of the natural language description of the optimization problem; according to the natural language modification information, the text content of the natural language description of the optimization problem is modified to obtain a modified natural language description of the optimization problem; according to the modified natural language description of the optimization problem, a modified solution file is obtained again.
[0140] Through the above methods, users can evaluate whether the generated DSL model meets business requirements. If the DSL model does not meet business requirements, users can input modification information into the optimization problem solving system, eliminating the tedious process of manual modification and programming and improving operational efficiency; the system can respond in real time and generate new optimization results. This enables users to make real-time decisions in different scenarios and quickly adapt to changing needs and conditions.
[0141] In a possible implementation, the method further includes:
[0142] A model processing platform is provided, which provides at least one of a problem input column, a model processing column and a result output column, wherein the problem input column is used to display the natural language description of the optimization problem input by the user, the model processing column is used to display the mathematical model, the model processing column is also used to allow the user to input the natural language modification information, and the result output column is used to display the solution result of the optimization problem.
[0143] For example, in terms of the displayed position relationship, the question input column can be located above the model processing column, and the model processing column can be located above the result output column (the reason is that the information in the question input column is the information initially input by the user, and the information output by the model processing column and the modification information received are after the information input in the question input column, so displaying the question input column above the model processing column will be more in line with the user's usage habits), or, the question input column and the model processing column can be set adjacent to each other, and the result output column can be independently set in another area (for example, below or to the right) and far away from the model processing column (the reason is that the question input column and the model processing column focus more on the input of information, and the result output column focuses more on the output of information, and displaying the two at a position far away from each other is more in line with the user's usage habits). This application does not limit the display position relationship between different columns.
[0144] In a possible implementation, the user can enter a natural language description of the optimization problem on the optimization problem solving related page, referring to Fig. 7A , Fig. 7A This is a schematic diagram of a page related to solving an optimization problem. A user can input a natural language description of the optimization problem in the problem input column 701 .
[0145] In one possible implementation, the mathematical model can be presented on a page, for example, with reference to Figure 7C , Figure 7C A schematic diagram of a page related to solving an optimization problem, wherein the model processing column 704 is a presentation area of a mathematical model. Fig.7D , Fig.7D A schematic diagram of a page related to solving an optimization problem, wherein the mathematical model can also be described as a description of a business scenario adapted to the optimization problem. For example, the variables therein can be represented by natural language descriptions to further improve the readability of the model. Specifically, the description is:
[0146] variable:
[0147] x: continuous variable for the number of chicken dishes
[0148] y: continuous variable for the number of beef dishes
[0149] Objective Function
[0150] Maximize Profit:
[0151] max7x+10y
[0152] constraint
[0153] Budget Constraint:
[0154] 5x+8y<=300
[0155] Time constraints:
[0156] 2x+3y<=35
[0157] Non-negativity constraints:
[0158] x,y>=0
[0159] Therefore, in Figure 7C Based on the DSL description of the mathematical model of the optimization problem, it is indicated that x represents the number of chicken dishes, and optionally, the type is a continuous variable; the three types of constraints are indicated, namely, budget constraint, time constraint, and non-negative constraint. In this way, the readability of the model can be further improved.
[0160] In a possible implementation, the decision object in the problem input column and the decision variable in the model processing column are displayed using characters in the same format, or the decision condition in the problem input column and the constraint condition in the model processing column are displayed using characters in the same format, or the optimization goal in the problem input column and the objective function in the model processing column are displayed using characters in the same format.
[0161] For example, the same format may include but is not limited to: using characters of the same color, characters of the same size, characters of the same font, or the same special effects (such as using the same color highlight) to display, etc., and the embodiments of the present application are not limited thereto.
[0162] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and input mathematical model modification information when the mathematical model needs to be modified, and the mathematical model modification information can be a modification of the mathematical model. Specifically, the mathematical model modification information input by the user can be obtained, and the model modification information indicates the modification of the mathematical model; according to the model modification information, at least one of the decision variables, constraints and objective functions of the mathematical model is modified to obtain the modified mathematical model; according to the modified mathematical model, a modified solution file is obtained.
[0163] In a possible implementation, after presenting the mathematical model, the user can evaluate whether the mathematical model meets the business requirements, and when it is necessary to modify the mathematical model by modifying the description of the optimization problem itself, the user can enter natural language modification information, which can be a modification of the natural language description of the optimization problem. Specifically, the natural language modification information entered by the user can be obtained, and the natural language modification information indicates the modification of the natural language description of the optimization problem; according to the natural language modification information, the text content of the natural language description of the optimization problem is modified to obtain a modified natural language description of the optimization problem; according to the modified natural language description of the optimization problem, a modified solution file is obtained again.
[0164] Through the above methods, users can evaluate whether the generated DSL model meets business requirements. If the DSL model does not meet business requirements, users can input modification information into the optimization problem solving system, eliminating the tedious process of manual modification and programming and improving operational efficiency; the system can respond in real time and generate new optimization results. This enables users to make real-time decisions in different scenarios and quickly adapt to changing needs and conditions.
[0165] For example, refer to Figure 7C , Figure 7C This is a schematic diagram of a page related to solving an optimization problem, wherein the user can input modification information in the input box, or directly modify the mathematical model in the model processing column 704.
[0166] The terminal device can allow the user to modify the mathematical model, that is, the user can modify the DSL model to obtain a more accurate DSL model that better meets his or her own requirements. After that, the DSL can be converted into a standard model file MPS that can be understood by the solver (for example, through the interpretation engine of the modeling tool, the MPS can be but not limited to LP, NL, etc.) and solved. In this way, the reliability and accuracy of the solution results can be guaranteed while greatly reducing labor costs and user requirements.
[0167] Through the above methods, users can evaluate whether the generated DSL model meets business requirements. If the DSL model does not meet business requirements, users can input modification information to the optimization problem solving system. Through the above methods, the tedious process of manual modification and programming is eliminated, and the operation efficiency is improved; the system can respond in real time and generate new optimization results. This allows users to make real-time decisions in different situations and quickly adapt to changing needs and conditions.
[0168] In a possible implementation, a solution to the optimization problem corresponding to the mathematical model may be obtained based on the mathematical model.
[0169] If the mathematical model is modified, the solution result of the optimization problem corresponding to the modified mathematical model can be obtained according to the modified mathematical model.
[0170] In a possible implementation, a third model of the optimization problem can be obtained according to the modified mathematical model, the third model is described by a standard model file MPS, and according to the third model of the optimization problem, a solution result of the optimization problem corresponding to the modified mathematical model is obtained by a solver. For example, the cloud-side device can use a mathematical modeling interpreter to convert the generated mathematical optimization model into a standard model file that can be understood by the solver.
[0171] For example, refer to Fig. 7E , Fig. 7E This is a schematic diagram of a page related to solving an optimization problem, wherein the model processing column 705 is a presentation area for the third model.
[0172] In one possible implementation, the solution results may be analyzed and interpreted, and the analysis results may be converted into natural language descriptions in a business context. For example, the variables in the solution results may be described in natural language. The above steps may be performed by a language model. In this way, the readability of the solution results may be improved.
[0173] In a possible implementation, the terminal-side device can present the solution result, and the user can evaluate the solution result to determine whether it meets the business requirements, and modify the DSL model when it is confirmed that the solution result does not meet the business requirements. Specifically, modification information can be received (that is, the modification information input by the user when confirming that the solution result does not meet the business requirements), and the second model of the optimization problem is obtained according to the modification information; the modification information indicates the modification of the natural language description of the optimization problem or the modified mathematical model, and the cloud-side device can obtain the solution result of the optimization problem corresponding to the second model according to the second model.
[0174] Taking the language model as an example, refer to Figure 8 , Figure 8 This is an illustration of an application framework of the present application, in which the natural language description of the optimization problem input by the user can be transformed into a natural language description of the optimization problem through a language model (e.g. Figure 8 The NLP2DSL module shown in the figure) obtains the DSL model and uses the converter in the solver engine (e.g. Figure 8 The DSL2MPS module shown in FIG. 1 is used to obtain a model (MPS) that can be resolved by the solver, and the solver in the solver engine (eg Figure 8 The OPT-Solver module shown) obtains the solution result (for example Figure 8 The model optimal solution SOL) shown, using the language model (e.g. Figure 8 The SOL2NLP module shown in the figure obtains a natural language description of the solution result in the context and presents it to the user.
[0175] Taking the language model as an example, refer to Fig. 9 , Fig. 9 This is a schematic diagram of an application framework of this application. Figure 8 , Fig. 9 It is shown in Figure 8 More details of the processing process, specifically, can include the following steps:
[0176] 1. Users use natural language to describe business requirements and generate general problem descriptions that include decision optimization objectives, constraints and other elements;
[0177] 2. Convert natural language into language related to mathematical modeling;
[0178] 3. The user evaluates whether the generated model described by the mathematical modeling language (DSL) meets the business requirements;
[0179] 4. The DSL model does not meet business requirements, and the user wants the system to send instructions to fine-tune the model;
[0180] 5. The DSL model meets business requirements and generates standard mathematical model files;
[0181] 6. Input the standard mathematical model file into the mathematical optimization solver and perform the solution;
[0182] 7. Obtain the solution results and analyze and interpret them, converting the analysis results into natural language descriptions in the business context;
[0183] 8. Convert the analytical conclusions of the results into business decision-making plans;
[0184] 9. Users evaluate whether the decision-making plan meets business requirements;
[0185] 10. The decision-making plan does not meet the requirements, and the user issues a command to the system to adjust the model;
[0186] 11. The decision plan meets the requirements and the decision optimization process ends.
[0187] Reference Fig.10 , Fig.10 This is a schematic diagram of an application framework of the present application, which shows Figure 8 and Fig. 9 The deployment diagram of the modules in , including:
[0188] User interface: A user-oriented interface that provides an intuitive and friendly way to operate the system. Users can interact with the invention through various controls and operations, such as entering text, selecting options, dragging elements, clicking buttons, obtaining evaluation results, etc.
[0189] Service call management layer - workflow orchestration engine: Automated management and coordination of decision-making optimization related to business processes. It combines different tasks and activities into a complete workflow, and automatically triggers and executes various tasks according to user instructions and conditions.
[0190] General language model, including:
[0191] NLP2DSL: Convert natural language into mathematical modeling related languages, such as AMPL, ZIMPL, Pyomo and other modeling languages and solver instructions;
[0192] SOL2NLP: Converts the solution results into descriptions with practical business meaning;
[0193] Solving engine, including:
[0194] DSL2MPS: Calls the domain language parsing tool to parse the mathematical modeling language and generate a standard mathematical model file;
[0195] Low-code platform: helps developers quickly call mathematical optimization solutions and generate solutions. It provides a series of visual components and predefined modules to achieve functions such as automatic code generation, system integration and docking, and visual debugging;
[0196] Optimization solver: reads standard mathematical model files, solves the corresponding mathematical optimization problems and generates optimal solutions that meet constraints or satisfactory solutions that meet user requirements.
[0197] Combination of the above Figures 1 to 10 , describes in detail the problem-solving method provided by the embodiment of the present application, and will now be combined with Figure 11-13 , describes in detail the embodiment of the device of the present application. It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, so the parts not described in detail can refer to the previous method embodiment.
[0198] Based on the aforementioned problem solving method, the present application also provides a model generation device. Fig.11 As shown, the problem solving device 1100 includes:
[0199] Interaction module 1101, used to obtain a natural language description of an optimization problem, where the natural language description of the optimization problem is used to describe the problem of adjusting the value of a decision object under given decision conditions so that the optimization target reaches an expected value;
[0200] The conversion module 1102 is used to process the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, wherein the mathematical model is expressed through a domain-specific language, and the mathematical model includes the decision variables, the constraints and the objective function of the optimization problem, wherein the decision object is the natural language description of the decision variables, the decision conditions are the natural language description of the constraints, and the optimization target is the natural language description of the objective function; according to the mathematical model, a solution file is obtained, and the solution file is used to solve the optimization problem through a solver.
[0201] Exemplarily, the above-mentioned conversion modules 1101 and 1102 may be implemented by hardware or software.
[0202] When implemented by software, the interaction module 1101 and the conversion module 1101 may be applications running on a computing device (such as a server). For example, the conversion module 1101 may be a computing engine running on a computing device, etc. The application may be provided to users in the form of a virtualized service. Virtualization services may include virtual machine (VM) services, bare metal server (BMS) services, and container services. Among them, the VM service may be a service that uses virtualization technology to virtualize a virtual machine (VM) resource pool on multiple physical hosts (such as computing devices) to provide users with VMs on demand for use. The BMS service is a service that virtualizes a BMS resource pool on multiple physical hosts to provide users with BMS on demand for use. The container service is a service that virtualizes a container resource pool on multiple physical hosts to provide users with containers on demand for use. VM is a simulated virtual computer, that is, a logical computer. BMS is a high-performance computing service that can be elastically scalable, and its computing performance is no different from that of a traditional physical machine, and it has the characteristics of secure physical isolation. Container is a kernel virtualization technology that can provide lightweight virtualization to achieve the purpose of isolating user space, processes and resources. It should be understood that the VM service, BMS service and container service in the above virtualization services are only used as specific examples. In actual applications, the virtualization service can also be other lightweight or heavyweight virtualization services, which are not specifically limited here.
[0203] When implemented by hardware, the interaction module 1101 and the conversion module 1102 can be implemented by transceiver modules such as transceivers. The conversion module 1102 may include at least one computing device, such as a server, etc. Alternatively, the conversion module 1102 may also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0204] In a possible implementation, the device further includes:
[0205] The solution module 1103 is used to solve the optimization problem according to the solution file to obtain a solution result of the optimization problem.
[0206] The conversion module 1102 may be Fig.10 DSL2MPS module, NLP2DSL module or SOL2NLP module in.
[0207] Among them, the solution module 1103 can be Fig.10 The optimization solver module in .
[0208] The present application also provides a computing device 1200. Fig.12 As shown, the computing device 1200 includes: a bus 1203, a processor 1204, a memory 1206, and a communication interface 1208. The processor 1204, the memory 1206, and the communication interface 1208 communicate through the bus 1203. The computing device 1200 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1200.
[0209] The bus 1203 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12The bus 1203 may include a path for transmitting information between various components of the computing device 1200 (eg, the memory 1206, the processor 1204, and the communication interface 1208).
[0210] The processor 1204 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0211] The memory 1206 may include a volatile memory, such as a random access memory (RAM). The memory 1206 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid state drive (SSD). The memory 1206 stores executable program code, and the processor 1204 executes the executable program code to implement the aforementioned problem-solving method. Specifically, the memory 1206 stores instructions for the optimization problem-solving system to execute the problem-solving method.
[0212] The communication interface 1208 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1200 and other devices or communication networks.
[0213] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0214] like Fig.13 As shown, the computing device cluster includes at least one computing device 1200. The memory 1206 in one or more computing devices 1200 in the computing device cluster may store instructions of the same optimization problem solving system for executing the problem solving method.
[0215] In some possible implementations, one or more computing devices 1200 in the computing device cluster may also be used to execute some instructions of the optimization problem solving system for executing the problem solving method. In other words, a combination of one or more computing devices 1200 may jointly execute instructions of the optimization problem solving system for executing the problem solving method.
[0216] It should be noted that the memory 1206 in different computing devices 1200 in the computing device cluster may store different instructions for executing partial functions of the optimization problem solving system.
[0217] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.14 A possible implementation is shown. Fig.14 As shown, two computing devices 140A and 140B are connected via a network. Specifically, the connection to the network is made through the communication interface in each computing device. In this type of possible implementation, the memory 116 in the computing device 140A may store instructions for executing the functions of the interface module. At the same time, the memory 116 in the computing device 140B may store instructions for executing the functions of the processing module. Alternatively, the memory 116 in the computing device 140A may store instructions for executing part of the functions of the processing module. At the same time, the memory 116 in the computing device 140B may store instructions for executing another part of the functions of the processing module.
[0218] It should be understood that Fig.14 The functions of computing device 140A shown in FIG. 140A may also be performed by multiple computing devices. Similarly, the functions of computing device 140B may also be performed by multiple computing devices.
[0219] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig.13 and Fig.14 Connection mode of computing device cluster. The difference is that the memory 116 in one or more computing devices in the computing device cluster may store the same instructions for executing the template generation method.
[0220] In some possible implementations, the memory 116 of one or more computing devices in the computing device cluster may also store partial instructions for executing the template generation method. In other words, a combination of one or more computing devices may jointly execute instructions for executing the template generation method.
[0221] It should be noted that the memory 116 in different computing devices in the computing device cluster can store different instructions for executing part of the functions of the template generation method. That is, the instructions stored in the memory 116 in different computing devices can implement the functions of one or more modules in the interface module and the processing module.
[0222] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned application to the optimization problem solving system for executing the problem solving method, the training sample generation method, and the model training method.
[0223] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned problem solving method, training sample generation method, and model training method.
[0224] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A mathematical model generation method, characterized in that: Applied to a computing device or a computing device cluster, the method comprises: Obtaining a natural language description of the optimization problem, where the natural language description of the optimization problem is used to describe the problem of adjusting the value of the decision object under given decision conditions so that the optimization target reaches an expected value; Processing the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, wherein the mathematical model is expressed through a domain-specific language and includes decision variables, constraints and an objective function of the optimization problem, wherein the decision object is a natural language description of the decision variable, the decision condition is a natural language description of the constraint, and the optimization target is a natural language description of the objective function; A solution file is obtained according to the mathematical model, and the solution file is used to solve the optimization problem through a solver.
2. The method according to claim 1, characterized in that The method further comprises: The optimization problem is solved according to the solution file to obtain a solution result of the optimization problem.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Acquire natural language modification information input by a user, wherein the natural language modification information indicates modification of the natural language description of the optimization problem; Modify the text content of the natural language description of the optimization problem according to the natural language modification information to obtain a modified natural language description of the optimization problem; According to the modified natural language description of the optimization problem, a modified solution file is obtained again.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: Acquiring mathematical model modification information input by a user, wherein the model modification information indicates modification of the mathematical model; Modify at least one of the decision variables, constraint conditions and objective function of the mathematical model according to the model modification information to obtain the modified mathematical model; According to the modified mathematical model, a modified solution file is obtained.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: A model processing platform is provided, which provides at least one of a problem input column, a model processing column and a result output column, wherein the problem input column is used to display the natural language description of the optimization problem input by the user, the model processing column is used to display the mathematical model, the model processing column is also used to allow the user to input the natural language modification information, and the result output column is used to display the solution result of the optimization problem.
6. The method according to claim 5, characterized in that The decision object in the problem input column and the decision variable in the model processing column are displayed using characters in the same format, or the decision condition in the problem input column and the constraint condition in the model processing column are displayed using characters in the same format, or the optimization goal in the problem input column and the objective function in the model processing column are displayed using characters in the same format.
7. The method according to any one of claims 1 to 6, characterized in that: The natural language description of the optimization problem includes requirements for the solution result or solution process of the optimization problem, and the requirements include: requirements for solution speed, requirements for solution accuracy, and whether it is necessary to quickly provide a feasible solution. The mathematical model meets the requirements.
8. The method according to any one of claims 1 to 7, characterized in that: The step of processing the natural language description of the optimization problem by using a natural language model to obtain a mathematical model of the optimization problem includes: Constructing a prompt Prompt for the optimization problem based on the natural language description of the optimization problem, wherein the prompt indicates converting the natural language description into a model expressed in a domain-specific language DSL; the Prompt is used to guide the natural language model to generate an output corresponding to the Prompt; The Prompt is input into the natural language model to obtain a mathematical model of the optimization problem.
9. A model generation device, characterized in that: Applied to a computing device or a computing device cluster, the apparatus comprises: An interactive module, used to obtain a natural language description of an optimization problem, wherein the natural language description of the optimization problem is used to describe the problem of adjusting the value of a decision object under given decision conditions so that the optimization target reaches an expected value; A conversion module, used for processing the natural language description of the optimization problem through a natural language model to obtain a mathematical model of the optimization problem, wherein the mathematical model is expressed through a domain-specific language, and the mathematical model includes decision variables, constraints and objective function of the optimization problem, wherein the decision object is a natural language description of the decision variable, the decision condition is a natural language description of the constraint, and the optimization target is a natural language description of the objective function; A solution file is obtained according to the mathematical model, and the solution file is used to solve the optimization problem through a solver.
10. The device according to claim 9, characterized in that The device also includes: A solution module is used to solve the optimization problem according to the solution file to obtain a solution result of the optimization problem.
11. The device according to claim 9 or 10, characterized in that The interaction module is further used for: Acquire natural language modification information input by a user, wherein the natural language modification information indicates modification of the natural language description of the optimization problem; The conversion module is also used to: modify the text content of the natural language description of the optimization problem according to the natural language modification information to obtain a modified natural language description of the optimization problem; and re-obtain a modified solution file according to the modified natural language description of the optimization problem.
12. The device according to claim 9 or 10, characterized in that The interaction module is further used for: Acquiring mathematical model modification information input by a user, wherein the model modification information indicates modification of the mathematical model; The conversion module is further used to: modify at least one of the decision variables, constraint conditions and objective function of the mathematical model according to the model modification information to obtain the modified mathematical model; According to the modified mathematical model, a modified solution file is obtained.
13. The device according to any one of claims 9 to 12, characterized in that: The interaction module is further used for: A model processing platform is provided, which provides at least one of a problem input column, a model processing column and a result output column, wherein the problem input column is used to display the natural language description of the optimization problem input by the user, the model processing column is used to display the mathematical model, the model processing column is also used to allow the user to input the natural language modification information, and the result output column is used to display the solution result of the optimization problem.
14. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device, and the at least one computing device includes at least one processor and at least one memory, wherein the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the computing device cluster executes the method as described in any one of claims 1 to 8.
15. A computer-readable storage medium, characterized in that: The method comprises computer-readable instructions; the computer-readable instructions are used to implement the method according to any one of claims 1 to 8.
16. A computer program product, characterized in that The method comprises computer-readable instructions; the computer-readable instructions are used to implement the method according to any one of claims 1 to 8.
Citation Information
Cited By
NL2DSL-based power distribution network semantic analysis and intelligent number asking method and system
CN121456106A
A power distribution network semantic analysis and intelligent query method and system based on NL2DSL
CN121456106B