Method and apparatus for modeling discrete event simulation system
By using trained large language models (LLMs) to generate knowledge graphs and modeling codes, the problem of natural language and domain knowledge understanding bias in the automatic production model modeling process is solved, and accurate and efficient modeling of the DES system is achieved.
Patent Information
- Application Number
- PCT/CN2023/122889
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-04-03
AI Technical Summary
When establishing automatic production models, the prior art is limited by natural language understanding deviations and domain knowledge understanding deviations, resulting in a reduced accuracy of the generated model and cannot meet the actual needs of industrial production.
The trained large language model (LLM) is used to model discrete event simulation (DES) systems, and by inputting natural language features into the LLM, a knowledge graph describing the modeling object is generated, and a modeling code is generated based on the knowledge graph.
Accurate modeling of the DES system is realized, the accuracy and efficiency of modeling are improved, and the dependence on the accuracy of input information and the deep understanding of domain knowledge is avoided.
Smart Images

Figure CN2023122889_03042025_PF_FP_ABST
Abstract
Description
A modeling method and device for discrete event simulation system Technical Field
[0001] The present application relates to a construction technology of production models in the industrial field, and in particular to a modeling method and device for a discrete event simulation (DES) system. Background Art
[0002] Currently, to guide production processes in the industrial sector, production processes are typically modeled and a production process model is generated. Production plans are then verified based on the production process model to guide actual industrial production processes. When establishing a production model, the method employed is to derive corresponding modeling code based on very specific and accurate production-related input, such as a bill of materials (BOM) file and / or process routing file. This modeling code is then mapped to a pre-defined modeling library, and the modeling code is executed to output an automated production model.
[0003] As can be seen, the key to accurately building an automated production model is obtaining accurate modeling information. However, in practice, due to misunderstandings of the input natural language and the domain knowledge involved in industrial production systems, accurate modeling information cannot be obtained. This results in reduced accuracy of the generated automated production model, an inability to meet the actual needs of the industrial production process, reduced efficiency, and, in severe cases, serious errors in the actual industrial production process.
[0004] Summary of the Invention
[0005] In view of this, an embodiment of the present application proposes a modeling method for a DES system, which can achieve accurate modeling of the DES system based on natural language understanding, without relying on the accuracy of input information or in-depth understanding of industry knowledge.
[0006] On the other hand, an embodiment of the present application proposes a modeling device for a DES system, which can achieve accurate modeling of the DES system based on natural language understanding, without relying on the accuracy of input information or in-depth understanding of industry knowledge.
[0007] In one embodiment of the present application, a modeling method for a discrete event simulation (DES) system is provided, comprising:
[0008] Inputting natural language features into a trained large language model (LLM), wherein the corpus used in the training of the LLM includes modeling corpus and knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to have the function of generating a knowledge graph describing the modeling object based on the natural language features, and generating modeling code based on the knowledge graph describing the modeling object;
[0009] The trained LLM generates a knowledge graph describing the object based on the natural language features, and generates a modeling code according to the knowledge graph describing the modeling object;
[0010] The modeling code is mapped to a preset modeling library, the modeling code is run, and the DES system is output.
[0011] In the above method, the corpus used by the LLM during training is output from a preset corpus, which includes a modeling corpus and a knowledge graph corpus. The modeling corpus outputs the modeling corpus, and the knowledge graph corpus outputs the knowledge graph corpus describing the domain knowledge and modeling knowledge.
[0012] In the above method, the generation process of the modeling corpus includes:
[0013] Obtaining modeling objects in the DES system and related information of the modeling objects;
[0014] Based on the relevant information of the modeling object, generating corresponding modeling code;
[0015] The corresponding modeling code is subjected to corpus processing to obtain a modeling corpus.
[0016] In the above method, generating corresponding modeling code based on the relevant information of the modeling object includes:
[0017] After determining the type of the modeling object, obtain the modeling code generation template of the corresponding type;
[0018] Matching the relevant information items of the modeling object with the parameter items in the modeling code generation template of the corresponding type;
[0019] According to the matching result, the information value in the relevant information item of the modeling object is filled into the item value in the matching parameter item in the modeling code generation template of the corresponding type;
[0020] Generate the corresponding modeling code based on the filled modeling code generation template of the corresponding type.
[0021] In the above method, the corpus-based processing of the corresponding modeling code includes:
[0022] Parsing the corresponding modeling code according to the preset code items to obtain modeling corpus;
[0023] The preset code items include: name, type, function description, declared variables and code body; wherein, the name and type of the modeling corpus are inherited from the modeling object associated with the corresponding modeling code, the function description is the functional part of the modeling code corresponding to the description, the declared variables include the received variables, and the code body is the remaining corresponding modeling code, representing the execution logic of the corresponding modeling code.
[0024] In the above method, the generation process of the knowledge graph corpus of the modeling knowledge in the knowledge graph corpus includes:
[0025] Obtaining modeling objects and related information of the modeling objects in the DES system;
[0026] Generate a knowledge graph of modeling knowledge based on relevant information of the modeling object;
[0027] The knowledge graph of the modeling knowledge is used as the knowledge graph corpus of the modeling knowledge.
[0028] In the above method, the modeling objects include topology modeling objects and programming modeling objects, wherein:
[0029] The relevant information of the modeling object of the topology class includes: individual information and association information;
[0030] The relevant information of the modeling object of the programming class includes: the code name of the modeling object, the code type, the controlled modeling object information and the code body, and the code body is saved in a preset text file.
[0031] In the above method, the LLM training is completed by setting up an LLM framework, including:
[0032] The extraction unit in the LLM framework extracts the knowledge graph corpus and the modeling corpus, and merges the knowledge graph corpus and the modeling corpus through the merging unit of the LLM framework;
[0033] The training body of the LLM framework adopts a four-layer transformer architecture, including a continuous learning transformer layer, a text understanding transformer layer, a model object graph generation transformer layer and a model code generation transformer layer. The continuous learning transformer layer has an encoder and a decoder, and performs a text-to-text training process, a knowledge graph-to-knowledge graph and a knowledge graph-to-text continuous learning process based on the merged corpus. The text understanding transformer layer trains user needs from a natural language perspective. The model object graph generation transformer layer combines the knowledge graph of the model object and the domain knowledge to train the knowledge graph of the model object; the model code generation transformer layer trains and generates modeling code.
[0034] In another embodiment of the present application, a modeling device for a DES system is provided, comprising: a training unit and an application unit, wherein:
[0035] The training unit is used to input natural language features into a trained large language model (LLM). The corpus used in the training of the LLM includes modeling corpus and knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to have the function of generating a knowledge graph describing a modeling object based on the natural language features, and generating modeling code based on the knowledge graph describing the modeling object;
[0036] The application unit is used for the trained LLM to generate a knowledge graph describing the object based on the natural language features, generate modeling code according to the knowledge graph describing the modeling object, map the modeling code to a preset modeling library, run it, and output a DES system.
[0037] In yet another embodiment of the present application, an electronic device is provided, including:
[0038] processor;
[0039] A memory stores a program, wherein the program is configured to implement any one of the above-mentioned DES system modeling methods when executed by the processor.
[0040] In an embodiment of the present application, a large language model (LLM) trained with a produced corpus is used to model a DES system. Specifically, the trained LLM models the DES system based on the input natural language features. The corpus used in the LLM training includes modeling corpus and knowledge graph corpus. The modeling corpus is a code segment corpus that drives model generation, so as to train the LLM to generate a knowledge graph of a modeling object based on natural language features and to generate modeling code based on the knowledge graph of the generated modeling object. During subsequent DES system modeling, the LLM generates modeling code based on the natural language features, maps the modeling code to a preset modeling library, and runs the modeling code to output the DES system. Furthermore, the corpus used in the LLM training is provided by the generated corpus. The corpus provides a knowledge graph corpus that includes domain knowledge and modeling knowledge, as well as modeling corpus. This avoids biases in understanding natural language and domain knowledge when training the LLM, making the trained LLM more accurate and efficient when modeling the DES system. Therefore, the embodiment of the present application realizes accurate modeling of the DES system based on natural language understanding, without relying on the accuracy of input information or deep understanding of industry knowledge, and can realize the modeling of the DES system while improving modeling accuracy and modeling efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The preferred embodiments of the present application will be described in detail below with reference to the accompanying drawings, so that those skilled in the art can better understand the above and other features and advantages of the present application. In the accompanying drawings:
[0042] FIG1 is a flow chart of a modeling method for a DES system provided in an embodiment of the present application;
[0043] FIG2a is a schematic diagram of the process of interaction between the artificial intelligence assistant platform and engineering personnel provided in an embodiment of the present application to form an initial DES system;
[0044] 2b is a schematic diagram of the process of the artificial intelligence assistant platform provided in an embodiment of the present application interacting with engineering personnel to improve the initial DES system;
[0045] FIG3 is a schematic diagram of the process of modeling the DES system using the trained LLM in this application;
[0046] FIG4a is a schematic diagram of a modeling corpus generation process for a topology modeling object according to an embodiment of the present application;
[0047] FIG4 b is a schematic diagram of a process for generating modeling corpus for a programming modeling object according to an embodiment of the present application;
[0048] FIG5 is a schematic diagram of the structure of a knowledge graph corpus described using a knowledge graph provided in an embodiment of the present application;
[0049] FIG6 is a schematic diagram of a process for generating modeling corpus and knowledge graph corpus based on extracted relevant information of a modeling object according to an embodiment of the present application;
[0050] FIG7 is a schematic diagram of the structure of relevant information of a modeling object provided in an embodiment of the present application;
[0051] FIG8a is a schematic diagram of a process of creating modeling code for a modeling object by using a modeling code generation template according to an embodiment of the present application;
[0052] FIG8 b is a second schematic diagram of a process of creating modeling code for a modeling object by using a modeling code generation template according to an embodiment of the present application;
[0053] FIG9a is a schematic diagram of a modeling corpus of a topology modeling object provided in an embodiment of the present application;
[0054] FIG9 b is a schematic diagram of a modeling corpus of a programming modeling object provided in an embodiment of the present application;
[0055] FIG10 is a schematic diagram of a knowledge graph of modeling knowledge provided in an embodiment of the present application.
[0056] FIG11 is a schematic diagram of the process of training LLM according to an embodiment of the present application;
[0057] FIG12 is a schematic diagram of a specific example of a modeling method for a DES system provided in an embodiment of the present application;
[0058] FIG13 is a schematic diagram of the structure of a modeling device of a DES system provided in an embodiment of the present application.
[0059] The accompanying drawings are numerals as follows: DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of this application clearer, the following embodiments are given to further illustrate this application in detail.
[0061] As can be seen from the background, the main reason for low accuracy and efficiency in automated production modeling is that modeling code is generated directly based on input production-related information, and the modeling process is based on this information. This low accuracy and efficiency are caused by misunderstandings of the input production-related information, including misunderstandings of natural language and domain knowledge related to industrial production systems.
[0062] In an embodiment of the present application, the automatic production model can be implemented by a DES system, which is a system that simulates the behavior and performance of real industrial production processes, real industrial equipment or systems. The DES system obtained through modeling can be used to guide actual industrial production processes.
[0063] To overcome the above-mentioned problems, this embodiment uses an LLM trained with a production corpus to model the DES system. That is, the trained LLM models the DES system based on the input natural language features. The corpus used in the training of the LLM includes modeling corpus and knowledge graph corpus. The modeling corpus is the code segment corpus that drives the model generation, so as to train the LLM to have the ability to generate a knowledge graph of the modeling object based on the natural language features, and to generate modeling code based on the knowledge graph of the generated modeling object. During the subsequent modeling of the DES system, after the LLM generates the modeling code based on the natural language features, the modeling code is mapped to a preset modeling library, and the modeling code is run to output the DES system.
[0064] Furthermore, the corpus used in LLM training is provided by the generated corpus, which provides knowledge graph corpus including domain knowledge and modeling knowledge, as well as modeling corpus, thereby avoiding deviations in the understanding of natural language and domain knowledge when training LLM, making the trained LLM more accurate and efficient when modeling the DES system.
[0065] Therefore, the embodiment of the present application realizes accurate modeling of the DES system based on natural language understanding, without relying on the accuracy of input information or deep understanding of industry knowledge, and can realize the modeling of the DES system while improving modeling accuracy and modeling efficiency.
[0066] Therefore, the embodiments of the present application can achieve modeling of the DES system while improving modeling accuracy and modeling efficiency.
[0067] FIG1 is a flow chart of a modeling method for a DES system provided in an embodiment of the present application, wherein the specific steps include:
[0068] Step 101: inputting natural language features into a trained LLM. The corpus used in the training of the LLM includes modeling corpus and knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to generate a knowledge graph describing a modeling object based on the natural language features, and to generate modeling code based on the knowledge graph describing the modeling object.
[0069] Step 102: The trained LLM generates a knowledge graph describing the object based on the natural language features, and generates a modeling code according to the knowledge graph describing the modeling object;
[0070] Step 103: Map the modeling code to a preset modeling library, run it, and output a DES system.
[0071] In the above method, the corpus used by the LLM during training is output from a preset corpus, which includes a modeling corpus and a knowledge graph corpus. The modeling corpus outputs the modeling corpus, and the knowledge graph corpus outputs the knowledge graph corpus describing the domain knowledge and modeling knowledge.
[0072] The generation process of the modeling corpus includes:
[0073] Obtaining modeling objects and related information of the modeling objects in the DES system;
[0074] Based on the relevant information of the modeling object, generating corresponding modeling code;
[0075] The corresponding modeling code is subjected to corpus processing to obtain a modeling corpus.
[0076] The generation process of the knowledge graph corpus of the modeling knowledge in the knowledge graph corpus includes:
[0077] Obtaining modeling objects and related information of the modeling objects in the DES system;
[0078] Generate a knowledge graph of modeling knowledge based on relevant information of the modeling object;
[0079] The knowledge graph of the modeling knowledge is used as the knowledge graph corpus of the modeling knowledge.
[0080] In an embodiment of the present application, the modeling objects include topology modeling objects and programming modeling objects. The relevant information of the topology modeling objects includes: individual information and association information; the relevant information of the programming modeling objects includes: the code name of the modeling object, the code type, the controlled modeling object information and the code body, and the code body is saved in a preset text file.
[0081] In the embodiment of the present application, generating corresponding modeling code based on the relevant information of the modeling object includes:
[0082] After determining the type of the modeling object, obtain the modeling code generation template of the corresponding type;
[0083] Matching the relevant information items of the modeling object with the parameter items in the modeling code generation template of the corresponding type;
[0084] According to the matching result, the information value in the relevant information item of the modeling object is filled into the item value in the matching parameter item in the modeling code generation template of the corresponding type;
[0085] Generate the corresponding modeling code based on the filled modeling code generation template of the corresponding type.
[0086] In the embodiment of the present application, the corpus processing of the corresponding modeling code includes:
[0087] Parsing the corresponding modeling code according to the preset code items to obtain modeling corpus;
[0088] The preset code items include: name, type, function description, declared variables and code body; wherein, the name and type of the modeling corpus are inherited from the modeling object associated with the corresponding modeling code, the function description is the functional part of the modeling code corresponding to the description, the declared variables include the received variables, and the code body is the remaining corresponding modeling code, representing the execution logic of the corresponding modeling code.
[0089] In the embodiment of the present application, the LLM training is completed by setting up an LLM framework, including:
[0090] The extraction unit in LLM extracts the knowledge graph corpus and the modeling corpus, and merges the knowledge graph corpus and the modeling corpus through the merging unit of LLM;
[0091] The training body of LLM adopts a four-layer transformer architecture, including a continuous learning transformer layer, a text understanding transformer layer, a model object graph generation transformer layer and a model code generation transformer layer. The continuous learning transformer layer has an encoder and a decoder, and performs a text-to-text training process, a knowledge graph-to-knowledge graph and a knowledge graph-to-text continuous learning process based on the merged corpus. The text understanding transformer layer trains user needs from a natural language perspective. The model object graph generation transformer layer combines the knowledge graph of the model object and the domain knowledge to train the knowledge graph of the model object; the model code generation transformer layer trains and generates modeling code.
[0092] As can be seen, the embodiments of this application utilize a trained LLM to generate the modeling code required for modeling. The LLM is then encapsulated into an AI assistant platform, interacting with engineers to accurately parse the natural language provided by them. Engineers directly input natural language, which is then processed by the LLM to generate modeling code. This code is then mapped to a modeling library and executed, completing the DES system modeling. These engineers only need an industrial production background—in other words, knowledge of industrial production but no modeling expertise—to model the DES system, reducing their time and effort.
[0093] Figure 2a illustrates the process of interaction between the AI assistant platform and engineering personnel, as provided in an embodiment of the present application, to establish an initial DES system. The right half of Figure 2a provides an interface for verbal interaction with the engineering personnel. For example, an engineer enters "Help me build an orange juice production line with a daily throughput of 10,000 bottles," and the AI assistant platform responds with "Completed." In the left half of Figure 2b, the AI assistant platform's LLM generates modeling code based on the natural language features entered by the engineer. After mapping the modeling library, the resulting DES system is generated.
[0094] On this basis, the engineering staff can also interact with the artificial intelligence assistant platform and provide more specific commands, such as adding or deleting model objects, or modifying the properties of model objects, to obtain an updated DES system. Figure 2b is a schematic diagram of the process of the artificial intelligence assistant platform provided in an embodiment of the present application interacting with the engineering staff to improve the initial DES system. In the right half of Figure 2b, the engineering staff inquires about the relevant information of the initial DES system and adjusts the commands, and the artificial intelligence assistant platform provides feedback. Including: the engineer inputs "How much area is needed?", the artificial intelligence assistant platform feedback "about 1,000 square meters", the engineer inputs "too big. Reduce the occupied area by half", and the artificial intelligence assistant platform feedback "completed". The updated DES system on the right side of Figure 2b is formed, and the volume of the two tanks is reduced by half (the top layer in the DES system represents two tanks).
[0095] In order to use the trained LLM to model the DES system, the embodiment of the present application needs to include three stages:
[0096] Phase 1: Corpus generation;
[0097] Phase 2: Training LLM;
[0098] Phase 3: Modeling the DES system based on the trained LLM.
[0099] Figure 3 is a schematic diagram of the process of using the trained LLM to model the DES system in this application. In conjunction with Figure 3, the above three steps are described in detail.
[0100] As shown in Figure 3, in stage 301, the corpus generates corpus, and the specific steps include:
[0101] Step 3011: After obtaining the model object of the DES system, execute steps 3012 and 3015;
[0102] Step 3012: Process the model object with modeling corpus.
[0103] Step 3013: Generate modeling corpus;
[0104] Step 3014: Obtain a knowledge graph of domain knowledge;
[0105] Step 3015: Process the knowledge graph corpus based on the knowledge graph and model objects of the domain knowledge;
[0106] Step 3016: Generate a knowledge graph corpus including domain knowledge and modeling knowledge.
[0107] The above process is described in detail below.
[0108] The corpus provided in the embodiment of the present application includes a modeling corpus and a knowledge graph corpus, wherein the modeling corpus includes a modeling corpus, and the knowledge graph corpus includes a knowledge graph describing domain knowledge and modeling knowledge.
[0109] The modeling corpus in the modeling corpus is actually modeling code generated based on the information of the modeling object. The process of obtaining the modeling code is completed by programming. The modeling corpus can be used not only to train the LLM but also to be used in the model library, directly for the creation of model objects from model code.
[0110] In the embodiment of the present application, since the model objects in the DES system are generated by modeling codes, when preparing the modeling corpus, all model objects applied by the DES system are converted into modeling codes.
[0111] In an embodiment of the present application, there are two types of modeling objects: one is a topological modeling object, such as a workstation. As shown in Figure 4a, Figure 4a is a schematic diagram of the modeling corpus generation process for a topological modeling object provided in an embodiment of the present application. In the left half of Figure 4a, a topological modeling object is provided, and in the right half of Figure 4a, an interface for generating a modeling corpus based on the modeling object is illustrated. The other is a programming modeling object, such as the production method used in the DES system, as shown in Figure 4b, Figure 4b is a schematic diagram of the modeling corpus generation process for a programming modeling object provided in an embodiment of the present application. In the left half of Figure 4b, a programming modeling object is provided, and in the right half of 4b, a code interface for generating the modeling object is illustrated, including the type and name part 4b1 of the modeling object, the document string part 4b2 of the modeling object, the variable declaration part 4b3 of the modeling object, and the modeling code body part 4b4 of the modeling object.
[0112] In the embodiment of the present application, the knowledge graph corpus in the knowledge graph corpus mainly includes two parts: domain knowledge corpus and modeling knowledge corpus. The knowledge graph corpus output by the knowledge graph corpus is used as training data by the LLM to train the LLM so that the LLM can determine which DES system to model to meet the user requirements from the operational perspective. In other words, the LLM is trained to determine the various different modeling objects that need to be included in the modeled DES system, the attributes of these modeling objects, and the relationships between these modeling objects.
[0113] The domain knowledge corpus is pre-defined by domain experts in the DES system and describes the product types, product structures, and production process routes involved in the DES system. The modeling knowledge corpus is the modeling code extracted from all modeling objects in the DES system. It includes the DES system's simulation results, individual information about the corresponding modeling objects, their attributes and performance, and the relationships between the corresponding modeling objects.
[0114] Figure 5 is a schematic diagram of the structure of the knowledge graph corpus described by the knowledge graph provided in the embodiment of the present application. In the dotted box in the left half of the figure, a knowledge graph describing domain knowledge is shown, which includes raw material nodes 510, parts 511, assembly components 512, products 513, packaging box nodes 514 and finished product nodes 515, which respectively describe the different components of the product in the production process. It also includes rotation nodes 516, platform test nodes 517, assembly nodes 518 and packaging nodes 527 that describe each production link of the product. Each node is connected by edges with different attributes to describe the association relationship between each node. In the dotted box in the right half of Figure 5, a knowledge graph describing modeling knowledge is shown, including a test process node 519 describing the test process, an assembly process node 520 describing the assembly process, a connector node 521 describing the connector, a packaging node 522 describing the packaging process, a rotation process node 523 describing the rotation process, a recycling pool node 524 describing the recycling process, a production line node 525 describing the production line, an execution production node 526 describing the execution of production, and a control method node 528 describing the control method, etc. The nodes are connected by edges with different attributes to describe the association and execution order of the modeling codes represented by each node in the entire production link.
[0115] As can be seen, the knowledge graph depicted in Figure 5 is a DES system simulating an industrial production system for a product assembly. Edges with affiliation attributes are used between nodes in the product structure, describing the different components of the product during the production process. The product's composition during the production process is described as finished products, products, parts, and assembly components, with edges used to represent the relationships between them. When DES simulates a process industry system, a knowledge graph is required to describe the process industry's composition, including recipes, recipe entities, or formulas. This description is similar to the knowledge graph in Figure 5 and will not be repeated here.
[0116] The knowledge graph shown in FIG5 shows the knowledge about product structure, process priority and the relationship between them. It can also be expanded to include resource information, document information and other knowledge, and can be expanded as needed, which is not limited here.
[0117] In this embodiment of the present application, there is another type of latent information: if some raw material nodes are related to a process step node, and the process step node is modeled by a modeling object node, then it can be inferred that the modeling object node is also related to the raw material node. In Figure 5, it is also necessary to establish an inference association between the raw material node and the modeling object node, that is, an edge with an inference association attribute between the two. This inference can be implemented by embedding some knowledge graph inference engines, and reflecting the inference association relationship in the knowledge graph.
[0118] The knowledge graph describing domain knowledge in Figure 5 also includes production nodes describing different production processes, which are also related to different component composition nodes. They are connected by edges such as input attributes or output attributes, indicating that a certain component structure is input into a certain production process, or that a certain production process outputs a certain component structure.
[0119] From the knowledge graph describing modeling knowledge in Figure 5, it can be seen that the entire production process of the DES system is divided into multiple modeling objects. The process node describing each modeling object code is associated with other process nodes. Each process node describes the individual information, attribute information and performance information of the modeling object.
[0120] It can be seen that existing LLMs are all trained based on plain text, without introducing knowledge graphs as corpus training. Therefore, when the trained LLM parses the model code used for DES system modeling, it can only reflect the model structure in the DES system, that is, the individual information of the model objects, but cannot reflect the domain knowledge and modeling knowledge involved in the model objects. For example, it cannot reflect how the product is assembled through a specific sequence of process steps, or whether the product production steps are performed discretely or sequentially. As a result, the obtained model code contains limited meaning, and the accuracy and efficiency of subsequent DES system modeling based on it are low. However, the embodiment of the present application uses a knowledge graph to describe the corpus for training the LLM, and the knowledge graph corpus includes domain knowledge corpus and modeling knowledge corpus. Therefore, when training the LLM, the individual information, attribute information, and functional information of each modeling object, as well as the association information between modeling objects, are fully reflected. It also includes domain knowledge, making the trained LLM more accurate when modeling the DES system.
[0121] The embodiment of the present application uses knowledge graph corpus as the corpus for training LLM. Knowledge graph is an effective way to represent domain knowledge and modeling knowledge. It has rich semantics and can be understood by humans and by training LLM.
[0122] The corpus in the embodiment of the present application can generate not only modeling corpus but also knowledge graph corpus when domain knowledge is included, based on the extracted information about all modeling objects in the DES system. Detailed description is given below.
[0123] FIG6 is a schematic diagram of a process for generating modeling corpus and knowledge graph corpus based on the extracted relevant information of the modeling object according to an embodiment of the present application, wherein the process includes:
[0124] Step 601: Provide a modeling object of a DES system.
[0125] Step 602: Extract relevant information of the modeling object.
[0126] In this step, the modeling objects include topology modeling objects and programming modeling objects.
[0127] The relevant information of the topological modeling objects includes: individual information and association information. For example, the individual information is the name and type of the modeling object and the characteristic information of the modeling object. The association information is the association information between the modeling object and other modeling objects, such as the superior association, the predecessor association and the subsequent association.
[0128] The modeling object information of the programming class includes the code name, code type, controlled modeling object information and code body of the modeling object, wherein the code body can be saved in a preset text file.
[0129] As shown in Figure 7, Figure 7 is a schematic diagram of the relevant information structure of the modeling objects provided in an embodiment of the present application. As shown in the figure, for a topology modeling object 701, the relevant information is stored in information table 1 702, while for a programming modeling object 703, the relevant information is stored in information table 2 704. In both information table 1 702 and information table 2, the columns represent information categories, and the rows represent the information values under the corresponding information categories. In other words, the relevant information of the modeling objects is presented in a list format.
[0130] Step 603: Generate corresponding modeling code based on the relevant information of the modeling object.
[0131] In this step, the extracted relevant information of the modeling object is filled into the corresponding preset template, and then the corresponding modeling code is generated based on the filled template.
[0132] This step is implemented in four sub-steps:
[0133] The first step is to determine the type of the modeling object and obtain the corresponding type of modeling code generation template from the code template library 6031;
[0134] The second step is to match the relevant information items of the modeling object with the parameter items in the modeling code generation template of the corresponding type;
[0135] The third step is to fill the information value in the relevant information item of the modeling object into the item value in the matching parameter item in the modeling code generation template of the corresponding type according to the matching result;
[0136] The fourth step is to generate the corresponding modeling code based on the filled modeling code generation template of the corresponding type.
[0137] In this step, for each type of modeling object in the DES system, a modeling code generation template is predefined. The template is implemented by a code segment in a computer language, and the parameter values in its parameter items are blank and will be filled in later when the modeling code is generated.
[0138] As shown in Figure 8a, Figure 8a is a schematic diagram of the process of creating modeling code for a modeling object using a modeling code generation template provided in an embodiment of the present application. This type of template is applicable to topological modeling objects, and the modeling code created based on it includes: individual information and associated information of the modeling object. The relevant information of the modeling object is stored in List 2 704. After the relevant information of the modeling object is extracted from List 2 704, it is filled in the matching parameter items in Modeling Code Generation Template 801 of Figure 8a. Based on the filled template, code conversion is performed to generate modeling code 802 for the topological modeling object.
[0139] As shown in Figure 8b, Figure 8b is a schematic diagram of the second process of creating the modeling code of the modeling object using the modeling code generation template provided by the embodiment of the present application. This type of template is suitable for programming modeling objects, such as production method objects. The modeling code created based on this template includes: the code name of the modeling object, the code type, the controlled modeling object information, and the code body. The relevant information of the modeling object is stored in List 1 702. After the relevant information of the modeling object is extracted from List 1 702, it is filled in the matching parameter item in the modeling code generation template 803 of Figure 8b. Based on the filled template, code conversion is performed to generate the modeling code 804 of the programming modeling object.
[0140] Step 604: Perform corpus processing on the generated modeling code.
[0141] In this step, the generated modeling code is subjected to corpus processing, including: splitting the modeling code based on preset code items to obtain modeling corpus.
[0142] The preset code items include:
[0143] Name (name), type (type), function description (docstring), declared variables (variable) and code body. Among them, the name and type of a modeling corpus can be inherited from the corresponding modeling code. The function description is used to describe the function of the corresponding modeling code. It can be added manually or inherited from the corresponding modeling code. The declaration can be used to receive variables and is not a required code item. The code body represents the execution logic of the modeling code.
[0144] As shown in Figure 9a, Figure 9a is a schematic diagram of the modeling corpus of the topology modeling object provided in an embodiment of the present application. The modeling corpus of the topology modeling object includes: name 901, type 902, function description 903, declared variables 904 and code body 905.
[0145] As shown in Figure 9b, Figure 9b is a schematic diagram of the modeling corpus of the programming class modeling object provided by the embodiment of the present application. The modeling corpus of the programming class modeling object includes: name 906, type 907, function description 908, declared variables 909 and code body 910.
[0146] In this step, the modeling code is split based on the preset code items, specifically including:
[0147] For types and names, inherit from the corresponding modeling code;
[0148] For function descriptions, they are identified and split using preset string comments, such as " / *", "* / ", or " / / ", etc.
[0149] For declared variables, they are identified by using preset characters, such as the characters "Var" or "Param", or by using some keywords in the programming language;
[0150] For the code ontology, the remaining codes in the corresponding modeling code are defined as the code ontology.
[0151] Step 605: Obtain the modeling corpus of the modeling object.
[0152] In this step, the modeling corpus of the modeling object has 5 code items, which are used as training data for training LLM and are input into LLM for training.
[0153] Step 606: Generate a knowledge graph of modeling knowledge as modeling knowledge corpus based on the relevant information of the modeling object.
[0154] In this step, as shown in Figure 10, Figure 10 is a schematic diagram of the knowledge graph of modeling knowledge provided by an embodiment of the present application. Among them, for the modeling object of the topology class, its relevant information is stored in the information table 2 704 of the programming object of the topology class, and a modeling object node describing the modeling object of the topology class is set. Its association with other modeling objects is described by an edge, such as the previous column or the next column, which is represented by an edge with a hasPrecusor attribute. Its ontological information (for example, name, type, processing time or volume, etc.) is described as an attribute value, and the edge with all the association (hasProperty) attributes with the modeling object node represents the association.
[0155] For the level at which the modeling object is located in the production process, the edge with the belonging association (isPartOf) attribute is used to associate it with the modeling object node of the previous level. For example, the production line node of the factory is the parent object of all workstation modeling object nodes, so the edge between the modeling object nodes of all workstations and the production line nodes is the edge with the isPartOf attribute.
[0156] A modeling object node at the previous level, such as a production line node, can have an edge with a performance node describing a certain performance, such as a throughput node (describing a throughput of 1,000 pieces per day). Performance nodes can also be derived from operational requirements or from DES system simulation results.
[0157] For programming modeling objects, their related information is stored in information table 1 702 of the topology programming object. These are described as modeling object nodes for programming modeling objects, with names, types, and attributes for controlling other modeling objects and content. Attributes can be stored in preset text and associated with the text identifier. Similarly, edges are established with all associated attributes, using the related information of the programming modeling objects as attribute values.
[0158] Step 607: Input the knowledge graph of the domain knowledge, and use the knowledge graph of the domain knowledge as the domain knowledge corpus.
[0159] Step 608: organically combine the knowledge graph of modeling knowledge and the knowledge graph of domain knowledge;
[0160] In this step, the nodes in the knowledge graph of modeled knowledge are associated with the related nodes in the knowledge graph of domain knowledge using modeledBy edges, as shown in Figure 4.
[0161] Step 609: Obtain the knowledge graph corpus.
[0162] In this way, the knowledge graph corpus and modeling object corpus can be generated from the corpus and used as training data for LLM to train LLM.
[0163] As shown in FIG3 , in step 302 , the LLM is trained. The specific steps involved include:
[0164] Step 3021: Based on the modeling corpus, train the LLM's function of generating a knowledge graph describing the modeling object based on natural language features;
[0165] Step 3022: Based on the knowledge graph corpus, train the function of generating modeling code in the LLM according to the knowledge graph describing the modeling object.
[0166] Figure 11 is a schematic diagram of the process of training an LLM provided in an embodiment of the present application. The structure of the LLM in the embodiment of the present application is based on the existing LLM structure obtained by training with natural language as training data, in which a knowledge graph extraction unit is added and the processing unit is improved.
[0167] The framework of LLM includes an extraction unit, which includes a knowledge graph extraction unit 1101 and a text extraction unit 1102. The knowledge graph extraction unit 1101 is used to extract knowledge graph corpus, and the text extraction unit 1102 extracts modeling corpus.
[0168] The LLM framework also includes a merging unit 1107 that merges the knowledge graph corpus and the modeling corpus;
[0169] The LLM framework also includes a processing unit, which adopts a four-layer transformer architecture, specifically a continuous learning transformer layer 1103, a text understanding transformer layer 1104, a model object graph generation transformer layer 1105, and a model code generation transformer layer 1106. Among them, the continuous learning transformer layer 1103 has an encoder and a decoder, and performs a continuous learning process of training text to text, knowledge graph to knowledge graph, and knowledge graph to text based on the merged corpus. The text understanding transformer layer 1104 is used to train user needs from a natural language perspective. The model object graph generation transformer layer 1105 combines the knowledge graph of model objects and domain knowledge to train the knowledge graph of model objects; the model code generation transformer layer 1106 trains and generates modeling code.
[0170] After training the LLM using the above architecture, it can be used in modeling the DES system.
[0171] In an embodiment of the present application, the text understanding transformer layer 1104 in the LLM can use an existing mask-based method, that is, after tokenizing the input text, a random subset with a token span of a certain length (for example: 3) is sampled, replaced with masked tokens, and then the model is taught to replace the missing tokens.
[0172] In an embodiment of the present application, the object graph generation transformer layer 1105 in the LLM can also adopt the existing mask-based method. When the knowledge graph is embedded into this layer, some nodes or edges are randomly replaced with masks, and then the object graph generation transformer layer is trained to replace the lost tokens to complete the training of the object graph generation transformer layer 1105.
[0173] After the training is completed, the knowledge graph extraction unit 1101 and the text extraction unit 1102 can be embedded into the LLM for use as a reference when the LLM is used.
[0174] As shown in FIG3 , in step 303 , the DES system is modeled based on the trained LLM. The specific process is as follows:
[0175] Step 3031: The engineer inputs natural language features describing the establishment of a DES system to the trained LLM.
[0176] Step 3032: The trained LLM parses the natural language features;
[0177] Step 3033: The trained LLM generates a knowledge graph describing the modeling object;
[0178] Step 3034: The trained LLM analyzes the knowledge graph of the modeling object;
[0179] Step 3035: The trained LLM generates modeling code;
[0180] Step 3036: Map the generated modeling code to the preset modeling library, run it, and output the DES system.
[0181] A specific example is given to illustrate the embodiments of the present application in detail.
[0182] FIG12 is a schematic diagram of a specific example of a modeling method for a DES system provided in an embodiment of the present application, which provides an interface for interacting with a user.
[0183] The user inputs the natural language features of a certain industrial production process into the trained LLM. The trained LLM outputs the modeling code of the industrial production process. The modeling code is mapped to the preset model library and run to realize the model of an industrial production process, which is displayed in the interface in Figure 12.
[0184] FIG13 is a schematic diagram of the structure of a modeling device for a DES system provided in an embodiment of the present application, wherein the device includes: a training unit 1301 and an application unit 1302, wherein:
[0185] The training unit 1301 is configured to input natural language features into a trained large language model (LLM). The corpus used in the training of the LLM includes modeling corpus and knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to generate a knowledge graph describing a modeling object based on the natural language features, and to generate modeling code based on the knowledge graph describing the modeling object.
[0186] The application unit 1302 is used for the trained LLM to generate a knowledge graph describing the object based on the natural language features, generate modeling code according to the knowledge graph describing the modeling object, map the modeling code to a preset modeling library, run it, and output a DES system.
[0187] In another embodiment of the invention, an electronic device is provided, comprising: a processor; and a memory storing a program configured to implement the aforementioned DES system modeling method when executed by the processor. The electronic device specifically comprises a processor configured to execute the steps of the aforementioned DES system modeling method. The electronic device provided in the aforementioned embodiment also includes a non-transitory computer-readable storage medium storing a computer program configured to execute the steps of the aforementioned DES system modeling method when executed by the processor.
[0188] Specifically, the non-transitory computer-readable storage medium can be a general storage medium, such as a mobile disk, a hard disk, FLASH, a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), or a portable compact disk read-only memory (CD-ROM). When the computer program on the non-transitory computer-readable storage medium is executed by the processor, it can trigger the processor to execute the various steps of the above-mentioned DES system modeling method.
[0189] In practical applications, the non-transitory computer-readable storage medium may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, can perform the steps of the above-described DES system modeling method.
[0190] In another embodiment of the present application, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to execute a DES system modeling method in the aforementioned embodiment.
[0191] Yet another embodiment of the present application provides a computer program product, including a computer program or instructions, which implements each step of the above-mentioned DES system modeling method when executed by a processor.
[0192] The flowcharts and block diagrams in the accompanying drawings of the present application show the possible implementation architecture, functions and operations of the systems, methods and computer program products according to the various embodiments disclosed in the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in the order of the standards in different figures. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0193] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims disclosed in this application may be combined and / or coupled in various ways, even if such combinations and / or couplings are not explicitly disclosed in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application may be combined and / or coupled in various ways, and all such combinations and / or couplings fall within the scope disclosed in this application.
[0194] Specific embodiments are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application and is not intended to limit the present application. For those skilled in the art, changes can be made in the specific implementation methods and application scope based on the ideas, spirit and principles of the present application. Any modifications, equivalent replacements, improvements, etc. made by them should be included in the scope of protection of this application.
[0195] Nouns and pronouns referring to persons in this patent application are not limited to a specific gender.
Claims
1. A modeling method for discrete event simulation DES system, characterized in that: include: Inputting natural language features into a trained large language model LLM, wherein the corpus used in the training of the LLM includes a modeling corpus and a knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to have the function of generating a knowledge graph describing a modeling object based on natural language features, and generating a modeling code according to the knowledge graph describing the modeling object; The trained LLM generates a knowledge graph describing the object based on the natural language features, and generates a modeling code according to the knowledge graph describing the modeling object; The modeling code is mapped to a preset modeling library, the modeling code is run, and the DES system is output.
2. The method according to claim 1, characterized in that The corpus used by the LLM during training is output from a preset corpus, which includes a modeling corpus and a knowledge graph corpus. The modeling corpus outputs the modeling corpus, and the knowledge graph corpus outputs the knowledge graph corpus that describes the domain knowledge and modeling knowledge.
3. The method according to claim 2, characterized in that The generation process of the modeling corpus includes: Obtaining modeling objects in the DES system and related information of the modeling objects; Based on the relevant information of the modeling object, generate a corresponding modeling code; The corresponding modeling code is corpus-processed to obtain a modeling corpus.
4. The method according to claim 3, characterized in that The generating corresponding modeling code based on the relevant information of the modeling object includes: After determining the type of the modeling object, obtain the modeling code generation template of the corresponding type; Matching the relevant information items of the modeling object with the parameter items in the modeling code generation template of the corresponding type; According to the matching result, the information value in the relevant information item of the modeling object is filled into the item value in the matching parameter item in the modeling code generation template of the corresponding type; Generate the corresponding modeling code based on the filled modeling code generation template of the corresponding type.
5. The method according to claim 3, characterized in that The corpus processing of the corresponding modeling code includes: Parsing the corresponding modeling code according to preset code items to obtain modeling corpus; The preset code items include: name, type, function description, declared variables and code body; wherein, the name and type of the modeling corpus are inherited from the modeling object associated with the corresponding modeling code, the function description is the functional part of the modeling code corresponding to the description, the declared variables include the received variables, and the code body is the remaining corresponding modeling code, representing the execution logic of the corresponding modeling code.
6. The method according to claim 2, characterized in that The generation process of the knowledge graph corpus of the modeling knowledge in the knowledge graph corpus includes: Obtaining modeling objects and related information of the modeling objects in the DES system; Based on the relevant information of the modeling object, a knowledge graph of modeling knowledge is generated; The knowledge graph of the modeling knowledge is used as the knowledge graph corpus of the modeling knowledge.
7. The method according to any one of claims 3 to 6, characterized in that: The modeling objects include topology modeling objects and programming modeling objects, wherein: The relevant information of the modeling object of the topology class includes: individual information and association information; The relevant information of the modeling object of the programming class includes: the code name of the modeling object, the code type, the controlled modeling object information and the code body, and the code body is saved in a preset text file.
8. The method according to claim 1, characterized in that The LLM training is completed through the set LLM framework, including: The extraction unit in the LLM framework extracts the knowledge graph corpus and the modeling corpus, and merges the knowledge graph corpus and the modeling corpus through the merging unit of the LLM framework; The training body of the LLM framework adopts a four-layer transformer architecture, including a continuous learning transformer layer, a text understanding transformer layer, a model object graph generation transformer layer and a model code generation transformer layer, wherein the continuous learning transformer layer has an encoder and a decoder, and performs a text-to-text training process, a knowledge graph-to-knowledge graph and a knowledge graph-to-text continuous learning process based on the merged corpus. The text understanding transformer layer trains users' needs from a natural language perspective, the model object graph generation transformer layer combines the knowledge graph of the model object and the domain knowledge to train the knowledge graph of the model object; the model code generation transformer layer trains to generate modeling code.
9. A modeling device for a DES system, characterized in that: include: A training unit (1301) and an application unit (1302), wherein: The training unit (1301) is used to input natural language features into a trained large language model LLM, wherein the corpus used in the training of the LLM includes a modeling corpus and a knowledge graph corpus describing domain knowledge and modeling knowledge, so as to train the LLM to have the function of generating a knowledge graph describing a modeling object based on natural language features, and generating a modeling code based on the knowledge graph describing the modeling object; The application unit (1302) is used for the trained LLM to generate a knowledge graph describing an object based on the natural language features, generate a modeling code according to the knowledge graph describing the modeling object, and map the modeling code to the Project into the preset modeling library, run it, and output the DES system.
10. An electronic device, characterized in that: include: processor; A memory storing a program, wherein the program is configured to implement a DES system modeling method according to any one of claims 1 to 8 when executed by the processor.
Citation Information
Patent Citations
Response recommendation method, reply recommendation device and intelligent equipment
CN112527998A
Large language model training method and device based on knowledge graph
CN116662577A
Knowledge graph construction method and system, computer equipment and storage medium
CN116775906A
System and methods for performing NLP related tasks using contextualized word representations
US20190197109A1