A heterogeneous model framework extraction and matching method, device and storage medium
By extracting and analyzing the characteristics and structure of heterogeneous models, form a template and uniform representation, solve the problem of reuse of heterogeneous models in complex systems, realize the rapid construction and integration of the model, and reduce the cost and cycle of modeling.
Patent Information
- Application Number
- CN202210288527.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In the modeling and simulation of complex systems, it is difficult to reuse multi-field heterogeneous models, resulting in high modeling costs, long cycles and difficult model management.
By extracting the characteristics and structures of the heterogeneous model in the design and construction process, form a template, and use the binary tree structure to uniformly represent the template, store in the frame library, and traversing the element sequence obtained by the binary tree as serialization features, obtain the containing relationship, extract frequency frequency The sequence higher than the threshold is used as a model constructor.
Realize the rapid construction, integration and reuse of heterogeneous models, reduce modeling costs and cycles, simplify model management, and improve modeling efficiency.
Smart Images

Figure CN114610720B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of system modeling and simulation, and more specifically to a method, device and storable medium for extracting and matching a heterogeneous model framework. Background Art
[0002] At present, after years of development, modeling and simulation technology has become a comprehensive technology integrating computer, model theory, scientific computing and other disciplines. In the context of modeling and simulation of complex products in multiple fields, with the emergence of various modeling methods and tools, the model integration method is used to construct complex system models, and the complex system models are coupled with many heterogeneous models, making the modeling and simulation of complex systems more complicated. In actual simulation development, complex system simulation involves models in many fields. With the continuous increase in the number of models in various fields, many models have similarities in function and application. Repeated modeling will not only increase the cost and cycle of modeling, but also generate a lot of redundant information, making the management of the model very difficult.
[0003] However, model reuse can improve the efficiency of modeling engineers and achieve rapid model construction by reusing existing simulation models. Nowadays, there are many studies on the reuse of simulation systems, but there are few studies on the reuse of simulation models. Although the problem of model reuse is similar to that of code reuse, the reuse of models is more complicated because the models involve different fields and have more types. How to use existing simulation resources to achieve the reuse of multi-field heterogeneous models is an urgent issue that needs to be studied in the current complex system simulation.
[0004] Therefore, how to provide a heterogeneous model framework extraction and matching method that can solve the above problems is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of this, the present invention provides a heterogeneous model framework extraction and matching method, device and storable medium, which can refine the characteristics and structure of heterogeneous models in the design and construction process, so as to provide a reference for similar needs. In addition, extracting and analyzing the modeling features of the model helps to have a deep understanding of the heterogeneous model and explore its potential patterns from a theoretical level, which can realize the rapid construction, integration and reuse of the model in different simulation application scenarios and simulation tasks.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] A heterogeneous model framework extraction and matching method, comprising:
[0008] Preprocess the heterogeneous model;
[0009] The pre-processed heterogeneous model forms a template;
[0010] The templates are uniformly represented by using a binary tree structure, and the templates are stored in a framework library;
[0011] The element sequence obtained by traversing the binary tree is used as the serialization feature of the template, and the inclusion relationship of the serialization feature is obtained;
[0012] Sequences with a frequency higher than a preset threshold value in the serialized features are extracted and processed as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
[0013] Preferably, the specific process of preprocessing the heterogeneous model includes:
[0014] The heterogeneous models are classified into different categories, and then the features of the heterogeneous models are extracted.
[0015] Preferably, the specific process of forming a template from the pre-processed heterogeneous model includes:
[0016] Reading the expression under the keyword in the heterogeneous model, and extracting the parameter name contained in the expression;
[0017] Reading the expression under the equation in the heterogeneous model, extracting the parameter names contained in the expression, and forming a parameter list;
[0018] It is determined whether the parameter name under the keyword appears in the parameter list. If not, the keyword name is deleted. If it exists, it is replaced with a consistent name, and finally a template is formed.
[0019] Preferably, the features include: any one or several of domain features, logical features, and descriptive features.
[0020] Preferably, the specific process of uniformly representing the template using a binary tree structure includes:
[0021] The formula contained in the template is split according to spaces and stored in the first list, and whether the length of the formula is equal to 1 is determined. If it is equal to 1, it is directly output as the root node of the binary tree. If it is not equal to 1, the formula is scanned in turn and it is determined whether there are brackets in the formula;
[0022] If there are brackets, remove the brackets contained in the formula and take the operator with the lowest priority in the formula as the root node. The sequence of formula elements before the root node recursively constructs the left subtree, and the sequence of formula elements after the root node recursively constructs the right subtree. If there are no brackets, directly use the recursive method to construct a binary tree until the formula is completely represented by the binary tree.
[0023] Preferably, the element sequence obtained by traversing the binary tree is used as the serialization feature of the template, and the specific process of obtaining the inclusion relationship of the serialization feature includes:
[0024] The formula element sequence obtained by in-order traversal of the binary tree is used as the serialization feature of the template, and a naive algorithm is used to match the serialization features to obtain the inclusion relationship between the templates.
[0025] Furthermore, the present invention also provides a heterogeneous model framework extraction and matching device, comprising:
[0026] Data preprocessing module, used to preprocess heterogeneous models;
[0027] A template forming module, used for forming a template from the pre-processed heterogeneous model;
[0028] A template representation module, used for uniformly representing the template using a binary tree structure, and storing the template in a framework library;
[0029] A processing module, used for traversing the binary tree to obtain an element sequence as a serialization feature of the template, and obtaining an inclusion relationship of the serialization feature;
[0030] The extraction module is used to extract the sequences with a frequency higher than a preset threshold from the serialized features and process them as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
[0031] Furthermore, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the heterogeneous model framework extraction and matching method as described in any one of the above items is implemented.
[0032] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a method, device and storable medium for extracting and matching a heterogeneous model framework, which can refine the characteristics and structure of heterogeneous models in the design and construction process. The extraction of model construction patterns can understand the potential model characteristics and thus realize the reuse of models, thereby providing a reference for similar needs. In addition, extracting and analyzing the modeling characteristics of the model helps to have an in-depth understanding of the heterogeneous model and explore its potential patterns from a theoretical level, which can realize the rapid construction, integration and reuse of models in different simulation application scenarios and simulation tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate Example 1 of the present invention or the technical solution in the prior art, the drawings required for use in Example 1 or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only Example 1 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0034] Figure 1 An overall flow chart of a heterogeneous model framework extraction and matching method provided by the present invention;
[0035] Figure 2 A binary tree representation flow chart of a template provided in an embodiment of the present invention;
[0036] Figure 3 A schematic diagram of a binary tree structure provided by an embodiment of the present invention;
[0037] Figure 4 A structural principle block diagram of a heterogeneous model framework extraction and matching device provided by the present invention. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] Example 1
[0040] See attached Figure 1 As shown, Embodiment 1 of the present invention discloses a heterogeneous model framework extraction and matching method, including:
[0041] Preprocess the heterogeneous model;
[0042] The preprocessed heterogeneous model is formed into a template;
[0043] Use the binary tree structure to uniformly represent templates and store them in the framework library;
[0044] The element sequence obtained by traversing the binary tree is used as the serialization feature of the template to obtain the inclusion relationship of the serialization feature;
[0045] Sequences with a frequency higher than a preset threshold in the serialized features are extracted and processed as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
[0046] In a specific embodiment, the specific process of preprocessing the heterogeneous model includes:
[0047] The heterogeneous models are classified into different categories, and then the features of the heterogeneous models are extracted.
[0048] In a specific embodiment, the specific process of forming a template from the preprocessed heterogeneous model includes:
[0049] Read the expression under the keyword in the heterogeneous model and extract the parameter name contained in the expression;
[0050] Read the expressions under the equations in the heterogeneous model, extract the parameter names contained in the expressions, and form a parameter list;
[0051] Determine whether the parameter name under the keyword appears in the parameter list. If not, delete the keyword name. If it does exist, replace it with a consistent name to form a template.
[0052] In a specific embodiment, the feature includes: any one or several of domain features, logical features, and descriptive features.
[0053] See attached Figure 2-3 As shown, in a specific embodiment, the specific process of uniformly representing the template using the binary tree structure includes:
[0054] The formula contained in the template is split according to spaces and stored in the first list, and it is determined whether the length of the formula is equal to 1. If it is equal to 1, it is directly output as the root node of the binary tree. If it is not equal to 1, the formula is scanned in turn and it is determined whether there are brackets in the formula;
[0055] If there are brackets, remove the brackets contained in the formula and take the operator with the lowest priority in the formula as the root node. Recursively construct the left subtree with the sequence of formula elements before the root node, and recursively construct the right subtree with the sequence of formula elements after the root node. If there are no brackets, directly use the recursive method to construct a binary tree until the formula is completely represented by the binary tree.
[0056] Among them, the root node is the operator with the lowest priority in the model formula. The assignment operator is considered first, then the relational operator, then the arithmetic operator, and so on. The third step is to merge the binary trees. Loop through the binary trees in List 2, take out the first two binary trees each time, and connect them into a new binary tree with a unified name (equ1, equ2, ... equN) as the root node, until all the binary trees are finally merged into one binary tree. The fourth step is to use the element sequence obtained by the in-order traversal of the binary tree as the serialization feature of the template and store it.
[0057] In a specific embodiment, the element sequence obtained by traversing the binary tree is used as the serialization feature of the template, and the specific process of obtaining the inclusion relationship of the serialization feature includes:
[0058] The formula element sequence obtained by in-order traversal of the binary tree is used as the serialization feature of the template, and a naive algorithm is used to match the serialization features to obtain the inclusion relationship between templates.
[0059] Specifically, first assume that one of the two model formulas to be matched is the main string and the other is the pattern string. Next, determine whether the character to be matched is an operator or an operand. If it is an operand, continue to compare backwards. If it is an operator, determine whether the characters to be matched in the main string and the pattern string are equal. If they are equal, continue to compare backwards. Otherwise, the next comparison of the main string starts from the next character that is matched at the beginning, and the pattern string starts from the first character. When the main string and the pattern string are compared to the end, the inclusion relationship between the templates can be obtained.
[0060] The formula element sequence obtained by in-order traversal of the binary tree is used as the serialization feature of the template. The inclusion relationship between templates can be obtained by matching the serialization features with a naive algorithm. The inclusion relationship means that the element sequence in one formula contains some or all elements in another formula. The inclusion relationship is divided into partial inclusion and full inclusion. When calculating the inclusion relationship, the focus is on whether the operators between the template formulas are the same. As shown in Table 1, the similarity between templates can be expressed by three relationships: complete equality, full inclusion, and partial inclusion. For example, the main string is "var1 / var2=var5+var4*(var3-var6)", and the pattern string is the three model formulas in Table 1. The main string and the pattern string are matched to obtain the inclusion relationship between the two: the main string contains all elements in pattern string 1. The main string contains some elements in pattern string 2, and the main string contains multiple partial elements in pattern string 3. According to the inclusion relationship, the similar parts between templates are obtained, and the frequently appearing sequences in the part are extracted for processing (denoising, deduplication) as the model construction pattern. The framework set composed of templates and the model construction pattern are constructed into a heterogeneous model framework library. The model construction mode can be used as a supplement to the template function to match and combine with the template to quickly build a model that meets different application requirements.
[0061] Table 1 Template similarity
[0062]
[0063] See attached Figure 4 As shown, Embodiment 1 of the present invention further provides a heterogeneous model framework extraction and matching device, including:
[0064] Data preprocessing module, used to preprocess heterogeneous models;
[0065] A template forming module is used to form a template from the preprocessed heterogeneous model and store the template in a framework library;
[0066] Template representation module, used to uniformly represent templates using a binary tree structure;
[0067] A processing module is used to traverse the binary tree to obtain the element sequence as the serialization feature of the template and obtain the inclusion relationship of the serialization feature;
[0068] The extraction module is used to extract the sequences with a frequency higher than a preset threshold in the serialized features and process them as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
[0069] Embodiment 1 of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the heterogeneous model framework extraction and matching method as described in any one of the above embodiments 1 is implemented.
[0070] Example 2
[0071] The method provided in Example 1 is specifically applied to the extraction of the fuel cell model, and the specific process is as follows:
[0072] (1) Template extraction: After fuel cell models are extracted and matched, they are classified into different categories. In order to quickly and accurately build models for a certain field or a certain problem, the structural features of the fuel cell model (domain features, logical features, descriptive features, etc.) are extracted to form a template. First, the expression under the keyword in the model is read and the variable names in the expression (such as a, b, c, d) are extracted. Next, the variable names under the equations in the model are read (such as a, b, c, d, va). Finally, check whether the variable names under the keywords in the model also exist in the variable name list of the equation. If so, replace them with a unified name (var1, var2, ... varN). Otherwise, delete them and finally form a template.
[0073] (2) Serialization representation of templates. In order to facilitate the management of subsequent framework libraries, the serialization representation of fuel cell model templates is implemented based on the structured representation method of binary tree. The first step is to read the model file to preprocess the model. The formulas in the model are split according to spaces and stored in List 1. The second step is to build a binary tree. Determine whether the length of the model formula is equal to 1. Since the length of the model formula is greater than 1, the model formula is scanned from left to right to determine whether there are parentheses in the formula. There are no parentheses in the model formula. The operator with the lowest priority is directly used as the root node. The formula element sequence before the root node recursively constructs the left subtree, and the formula element sequence after the root node recursively constructs the right subtree. The established binary trees are stored in List 2 in sequence. The third step is to merge the binary trees. Building a binary tree is to build a binary tree for each model formula in the template. When there are multiple formulas in the template, multiple binary trees need to be built. In order to facilitate subsequent processing, the formula in a template needs to be represented by a binary tree, so it is necessary to merge the binary trees. Take out the first two binary trees in List 2 in turn, use the same name (equ1, equ2, ... equN) as the root node, one as the left subtree and the other as the right subtree to connect them into a new binary tree, until all the binary trees are finally merged into one binary tree. The fourth step uses the element sequence obtained by in-order traversal of the binary tree as the serialization feature of the template for storage.
[0074] (3) Obtain the model construction pattern and use the improved naive matching algorithm to achieve matching between fuel cell model templates. First, set one of the two model formulas to be matched as the main string and the other as the pattern string. Next, determine whether the character to be matched is an operator. If it is an operator and the two are equal, continue to compare backward. Otherwise, the next round of comparison of the main string starts from the next character that is matched at the beginning, and the pattern string starts from the first character and compares backward. If it is an operand, continue to compare backward. After the comparison is completed, the inclusion relationship between the fuel cell model templates is obtained. The inclusion relationship is divided into three types: congruent, full inclusion, and partial inclusion. According to the inclusion relationship, the similar parts of the fuel cell model templates are obtained. On this basis, the sequences with a frequency of occurrence higher than the preset threshold in the fuel cell model template are extracted for processing (de-duplication, denoising) to obtain the model construction pattern. The extraction of the model construction pattern can understand more potential features and realize the management of the framework library at the same time.
[0075] (4) Construct a heterogeneous model framework library. The framework set composed of the fuel cell model template and the model construction mode is constructed into a heterogeneous model framework library. The model construction mode is combined with the template to quickly build a model that meets different application requirements.
[0076] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0077] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A heterogeneous model framework extraction and matching method, characterized in that: include: The heterogeneous model is preprocessed. The specific process includes: Classifying the heterogeneous models according to different categories, and then extracting features of the heterogeneous models; The pre-processed heterogeneous model is formed into a template, and the specific process includes: Reading the expression under the keyword in the heterogeneous model, and extracting the parameter name contained in the expression; Reading the expression under the equation in the heterogeneous model, extracting the parameter names contained in the expression, and forming a parameter list; Determine whether the parameter name under the keyword appears in the parameter list, if not, delete the keyword name, if it exists, replace it with a consistent name, and finally form a template; The template is uniformly represented by a binary tree structure and stored in a framework library. The specific process includes: The formula contained in the template is split according to spaces and stored in the first list, and whether the length of the formula is equal to 1 is determined. If it is equal to 1, it is directly output as the root node of the binary tree. If it is not equal to 1, the formula is scanned in turn and it is determined whether there are brackets in the formula; If there are brackets, remove the brackets contained in the formula and take the operator with the lowest priority in the formula as the root node. Recursively construct the left subtree with the sequence of formula elements before the root node, and recursively construct the right subtree with the sequence of formula elements after the root node. If there are no brackets, directly construct a binary tree by recursive method until the formula is completely represented by the binary tree. The element sequence obtained by traversing the binary tree is used as the serialization feature of the template, and the inclusion relationship of the serialization feature is obtained. The specific process includes: Using the formula element sequence obtained by in-order traversal of the binary tree as the serialization feature of the template, and using a naive algorithm to match the serialization feature to obtain the inclusion relationship between the templates; Sequences with a frequency higher than a preset threshold value in the serialized features are extracted and processed as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
2. A heterogeneous model framework extraction and matching method according to claim 1, characterized in that: The features include: any one or several of domain features, logical features, and descriptive features.
3. A device using the heterogeneous model framework extraction and matching method according to any one of claims 1 to 2, characterized in that: include: Data preprocessing module, used to preprocess heterogeneous models; A template forming module, used for forming a template from the pre-processed heterogeneous model; A template representation module, used for uniformly representing the template using a binary tree structure, and storing the template in a framework library; A processing module, used for traversing the binary tree to obtain an element sequence as a serialization feature of the template, and obtaining an inclusion relationship of the serialization feature; The extraction module is used to extract the sequences with a frequency higher than a preset threshold from the serialized features and process them as model construction patterns. The extraction of model construction patterns can understand more potential features and realize the management of the framework library at the same time.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the heterogeneous model framework extraction and matching method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Automatic formula recognition method and device as well as electronic equipment and storage medium
CN108537183A
Portrait construction method based on multivariate heterogeneous data
CN111984640A