A method for spatiotemporal process mechanism model service chain arrangement based on directed acyclic graph
By adopting a mechanism model service chain orchestration method based on directed acyclic graphs, the problem of integration and orchestration of multi-domain and interdisciplinary models is solved, realizing efficient sharing and reuse of mechanism models, reducing software and hardware costs, and improving the adaptability and collaboration efficiency of model service chains.
Patent Information
- Application Number
- CN202211427118.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-11-14
AI Technical Summary
Existing technologies struggle to effectively manage and organize multi-domain, interdisciplinary mechanistic models, resulting in diverse model service formats, dispersed deployments, and significant differences in application environments. This makes efficient sharing and reuse difficult, and the adaptive orchestration of model service chains presents challenges.
A service chain orchestration method based on directed acyclic graphs (DAGs) for spatiotemporal process mechanisms is adopted. Model service integration is achieved through the metadata structure of mechanism models, and orchestration rules based on DAGs are constructed to adaptively orchestrate mechanism model service chains. Combined with middleware for model services and ontology, unified description and integration of multi-source heterogeneous models are realized.
It achieves seamless coupling and efficient collaborative operation of multi-source heterogeneous models, avoids the hardware and software costs brought about by model deployment, reduces the learning time cost of secondary development and rewriting, and realizes efficient sharing and reuse of mechanistic models.
Smart Images

Figure CN116244301B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of geographic information mechanism model arrangement, and in particular to a spatiotemporal process mechanism model service chain arrangement method based on a directed acyclic graph. BACKGROUND
[0002] As the mapping of real entities in virtual space, digital twin technology makes full use of mechanism models, sensor updates, operation history and other data to reflect the full life cycle process of the corresponding entity, and has been fully developed and applied in the field of engineering construction in China in recent years. When facing some complex problems such as spatiotemporal process simulation, it is necessary to use multi-disciplinary mechanism models to cooperate to solve the problems. However, these models have the characteristics of multiple service forms, scattered deployment, and large differences in application environment, making it difficult to effectively manage and organize them. Therefore, it is urgent to research an integration and arrangement method of mechanism models to meet the needs of users to efficiently share and reuse models, and to support effective analysis and solution of complex spatiotemporal process problems.
[0003] The integration of mechanism models can be achieved through three ways: tight coupling, embedded coupling and loose coupling. The tight coupling integration method generally serves only one field and is generally in the form of professional software, and the model reusability is poor. The embedded coupling is based on tight coupling and adds model development and calling interfaces, greatly improving its flexibility. The loose coupling integration method provides a unified model calling interface to users, combined with model calling middleware, and can directly use existing models without reconstruction or rewriting, which is an important prerequisite for efficient management and organization of cross-disciplinary mechanism models.
[0004] However, due to the characteristics of multi-source and heterogeneity of mechanism models in various fields, it is necessary to implement middleware between the services and ontologies of each type of model, and to build a metadata structure that can persistently describe the models as the basis for model arrangement. At the same time, there are adjacent and non-adjacent dependency relationships between model services in the process of model arrangement, which brings about specific association relationships between model services and input and output data sources. Therefore, how to design a general and efficient mechanism model metadata standard and model integration method to achieve adaptive arrangement of mechanism model service chains is still a challenging topic and a difficult problem to be solved. SUMMARY
[0005] To solve the problems in the prior art, the present application provides a spatiotemporal process mechanism model service chain arrangement method based on a directed acyclic graph, which achieves the purpose of adaptive arrangement of spatiotemporal process mechanism models and solves the problems mentioned in the background.
[0006] To achieve the above object, the application provides the following technical scheme: a time-space process mechanism model service chain arrangement method based on a directed acyclic graph, comprising the following steps:
[0007] S10, integrating model services based on a mechanism model metadata structure;
[0008] S20, constructing a time-space process mechanism model arrangement rule based on a directed acyclic graph and adaptively arranging.
[0009] Further, the step S10 specifically comprises:
[0010] Step S101, a user fills in the corresponding metadata and uploads according to the prepared mechanism model metadata structure based on the already deployed mechanism model;
[0011] Step S102, after the server end receives the uploading request, it is converted into a metadata object and stored in the metadatabase;
[0012] Step S103, the user selects the model and sends a request, the server end queries the corresponding metadata from the database and converts it into a metadata object, and generates the corresponding page and returns it to the user after rendering;
[0013] Step S104, the user submits the model running parameter value in the page and submits, the server end acquires the model type corresponding to the model according to the model ID used by the user, finds the corresponding model calling object in the model calling container, and completes the model calling through the object.
[0014] Further, the mechanism model metadata structure comprises model basic information and model running information; the model basic information comprises a model ID, a model name and a model type; the model running information comprises a model calling entry for realizing an external calling interface information of the model, model option information, and a model parameter information set comprising all running parameter related information of the model.
[0015] Further, the time-space process mechanism model arrangement rule based on a directed acyclic graph comprises a basic mechanism model rule and a multi-mechanism model arrangement rule;
[0016] The basic mechanism model rule comprises two conditions and one property, and is used to constrain the relationship between the model and the input and output data source in a single mechanism model service;
[0017] For the abstract result G of all mechanism models M (V I ,V M ,V O ,E), the abstract graph g M (v I ,vM ,v O ,e) should satisfy condition (1),
[0018]
[0019] where M represents mechanism model nodes, I represents input data source nodes, O represents output data source nodes, v represents a set of nodes of a certain type, e represents a set of directed edges between nodes, n v represents the number of nodes of a certain type;
[0020] In the case of satisfying condition (1), the directed edges between nodes continue to satisfy condition (2),
[0021]
[0022] The model abstraction graph at this time has property (I);
[0023]
[0024] where condition (1) ensures the number of nodes in a single model service and the acyclic nature of the graph, that is, there cannot be a node that is both an input data source and an output data source, and condition (2) ensures the clear definition of directed edges between nodes.
[0025] Further, the multi-mechanism model orchestration rules include six conditions, including two sufficient and necessary conditions, and one inference, to achieve the constraints on the model orchestration combination process;
[0026] A model directed acyclic graph Consider it as an initial model combination directed acyclic graph with a model node number of 1 Add a new model graph to the model combination graph To ensure that both generate a new combination graph Still a directed acyclic graph, condition (3) needs to be met,
[0027]
[0028]
[0029] where I represents input data source nodes, O represents output data source nodes, M represents mechanism model nodes, OI represents intermediate data source nodes, E represents directed edges between nodes, n v represents the number of nodes of a certain type, e represents the number of edges in the graph;
[0030] From condition (3), inference (a) is obtained,
[0031]
[0032] wherein < v A ,v B represents a directed edge between A, B nodes;
[0033] On the basis of satisfying condition (3), condition (4) needs to be satisfied,
[0034]
[0035] The sufficient and necessary condition (5) of condition (4) is:
[0036]
[0037] On the basis of satisfying condition (4) or (5), condition (6) needs to be satisfied:
[0038]
[0039] The sufficient and necessary condition (7) of condition (6) is:
[0040]
[0041] Wherein, id is the in-degree of a node;
[0042] On the basis of satisfying condition (6) or (7), condition (8) needs to be satisfied:
[0043]
[0044] If Then
[0045] Condition (3) and condition (8) jointly ensure that after each update model task link, the model combination graph is always a directed acyclic graph.
[0046] Further, the adaptive arrangement in the step S20 specifically includes:
[0047] Step S201, the user selects the model to be arranged, and inputs the parameters;
[0048] Step S202, repeat step S201 until the arrangement is completed, and generate the corresponding space-time process mechanism model service chain metadata template;
[0049] Step S203, submit the metadata template to the server side, and persistently store it in the space-time process mechanism model service chain metadata database;
[0050] Step S204, the user selects the model combination that has been arranged, adds the parameter values to be inputted to it in combination with the metadata template returned by the database, generates service chain execution information and submits it to the server side.
[0051] Further, the spatiotemporal process mechanism model service chain metadata structure in step S202 includes a service chain ID and a service chain model combination information set; each unit of the service chain model combination information set contains five parts: a unit ID, a model ID, a parameter key-value pair set, an input data source parameter index, and an output data source parameter index.
[0052] Further, after the server side receives the service chain execution information in step S204, the execution order of each unit in the service chain execution information is determined by inference (b) and inference (c), and then the service chain is executed based on the spatiotemporal process mechanism model service chain adaptive execution algorithm;
[0053] Inference (b): If all input data sources of a mechanism model service of a unit are legal, the model can be executed smoothly, and all output data sources are also legal after execution;
[0054] Inference (c): If all input data sources of an executable service chain are legal, the model arrangement combination task can be completed under the condition of ensuring the reasonable execution order of each unit.
[0055] Further, the spatiotemporal process mechanism model service chain adaptive execution algorithm includes service chain connectivity verification, data source legality verification, and service chain model recursive execution, and the algorithm specifically includes the following:
[0056] Step S301, verify the connectivity of the service chain: first, the connectivity of the service chain needs to be verified, the set of input data sources and output data sources of each unit in the service chain is recorded, and intersection operation is performed between each unit and other units; if the intersection of the data source set of a certain unit and the set of all other units is empty, it is considered that the unit is not connected with the service chain and does not meet the arrangement rule (4), and therefore the running process is ended; if the service chain is connected, step S302 is executed;
[0057] Step S302, record all input data sources of the service chain execution information: compare the service chain execution information with the corresponding metadata template, obtain all legal input data source parameter values of the service chain inputted by the user in step S204 and record them;
[0058] Step S303, establish an empty output data source record;
[0059] Step S304, judging the number of remaining units in the service chain execution information: if the number of remaining units in the service chain is 0, there can be two cases: the service chain is empty, or the service chain has been executed completely, no matter which case, the running process is ended; if the number of remaining units is not 0, step S305 is executed;
[0060] Step S305, entering the first unit of the service chain;
[0061] Step S306, judging whether all input data sources of the unit exist in the input or output record: according to the inference (b), all data sources in the input and output records are legal, so all input data sources of the model need to be found in the two records, if there is a data source that does not exist, step S313 is executed; if all input data sources exist, step S307 is executed;
[0062] Step S307, judging whether the output data source of the unit exists in the output record: based on condition (7), the first judgment is made, if the output record contains an output data source of the unit, that is, the in-degree of the model combination graph node corresponding to the data source is greater than 1, it means that the service chain is not arranged according to condition (6), the running process is ended; if the judgment result is false, step S308 is executed;
[0063] Step S308, judging whether the output data source of the unit exists in the input record: based on condition (8), the second judgment is made, if the input record contains the output data source of the step, a loop is formed in the model combination graph corresponding to the service chain, the running process is ended; if the judgment result is false, step S309 is executed;
[0064] Step S309, executing the model in the unit, that is, step S104 is executed;
[0065] Step S310, adding the output data source of the unit to the output record: since a certain output data source of the unit can be an input data source of another unit, according to the inference (b), the data source is added to the output record;
[0066] Step S311, deleting the unit in the service chain execution information: to prevent the repeated execution of the same unit, the unit is deleted in the service chain execution information;
[0067] Step S312, judging whether the current service chain is completed: if the current service chain is completed, but due to step S306, there can be a unit in the service chain that has not been executed, so step S304 needs to be executed again; if the current iteration is not completed, step S313 is executed;
[0068] Step S313, entering the next step of the service chain, and then step S306 is executed;
[0069] After steps S301-S313, if the validity of the service chain is verified and executed, the legitimacy of all expected output data sources is guaranteed, and the operation task of the spatiotemporal process mechanism model combination is completed.
[0070] The application has the advantages that in the case of solving complex problems by cooperation of mechanism models from multiple disciplines, the application realizes unified description and effective integration of multi-source heterogeneous models, achieves the effect of reusing and sharing existing models, thereby avoiding the software and hardware cost caused by model deployment; the application proposes a spatiotemporal process mechanism model service chain adaptive arrangement method based on a directed acyclic graph, designs a service chain organization method meeting the rule and an execution and verification algorithm, realizes seamless coupling between multi-source heterogeneous mechanism models by combining the middleware between model services and ontologies, and achieves the effect of efficient cooperative operation of model combination, thereby avoiding the huge learning time cost caused by secondary development, rewriting or reconstruction of existing mechanism models. BRIEF DESCRIPTION OF DRAWINGS
[0071] Figure 1 is a step flowchart of the arrangement method of the application;
[0072] Figure 2 is an integrated flowchart of model services realized based on the mechanism model metadata structure disclosed by the embodiment of the application;
[0073] Figure 3 is a schematic diagram of the mechanism model metadata structure disclosed by the embodiment of the application;
[0074] Figure 4 is a schematic diagram of the spatiotemporal process mechanism model adaptive arrangement flow based on a directed acyclic graph disclosed by the embodiment of the application;
[0075] Figure 5 is an abstract diagram of the relationship between the mechanism model data source and the model disclosed by the embodiment of the application;
[0076] Figure 6 is an abstract diagram of the arrangement result of the mechanism model disclosed by the embodiment of the application;
[0077] Figure 7 is a schematic diagram of the spatiotemporal process mechanism model service chain metadata structure based on a directed acyclic graph disclosed by the embodiment of the application.
[0078] Figure 8 is a schematic diagram of the spatiotemporal process mechanism model service chain adaptive execution algorithm flow based on a directed acyclic graph disclosed by the embodiment of the application. DETAILED DESCRIPTION
[0079] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of the present application.
[0080] Embodiment 1
[0081] When facing some complex problems such as geological disaster simulation, mechanism models from multiple fields and disciplines are needed, including geography, geology, meteorology, hydrology and the like. Although researchers in various professions have developed tens of thousands of models, it is impractical to build a single model that can simulate such a complex process. Integration and combination of models is a solution, which can reuse existing models, thereby avoiding huge costs of developing new models or reconstructing old models.
[0082] However, due to the various forms of mechanism models from various disciplines and fields, scattered deployment and great differences in application environment, it is difficult to share and reuse these mechanism models, and great software and hardware and learning time costs are brought when multi-disciplinary model cooperation is needed to solve practical problems. Therefore, if the external calling interface information of each mechanism model can be summarized and summarized, and described through a universal data format, the representation, publication and calling of each model can be realized through a unified service interface, which can greatly reduce the integration difficulty of multi-source heterogeneous models. On this basis, how to reasonably arrange the formally unified mechanism model services is one of the keys to solving the coupling and cooperation of multiple models.
[0083] To solve the above problems, the present application provides a technical solution: a spatiotemporal process mechanism model service chain arrangement method based on directed acyclic graph, please refer to Figure 1 , comprising the following steps:
[0084] S10, integrating model services based on mechanism model metadata structure;
[0085] S20, constructing spatiotemporal process mechanism model arrangement rules based on directed acyclic graph and self-adapting arrangement.
[0086] The mechanism model metadata structure includes model basic information and model running information, and the mechanism model metadata is represented, transmitted and persistently stored using a semi-structured data structure.
[0087] The spatiotemporal process mechanism model arrangement rules based on directed acyclic graph include basic mechanism model rules and multi-mechanism model arrangement rules.
[0088] The basic mechanism model rule includes two conditions and one property for constraining the relationship between the model and the input and output data source in a single mechanism model service.
[0089] The multi-mechanism model orchestration rule includes six conditions, two of which are sufficient and necessary conditions, and one inference, which realizes the constraint on the model orchestration combination process.
[0090] The adaptive orchestration specifically includes:
[0091] The user selects the model to be orchestrated and inputs the parameters;
[0092] Repeat the above steps until the orchestration is completed, and generate the corresponding spatiotemporal process mechanism model service chain metadata template;
[0093] Submit the metadata template to the server side and store it in the spatiotemporal process mechanism model service chain metadata database;
[0094] The user selects the already orchestrated model combination, combines the metadata template returned by the database, adds the input parameter values, generates the service chain execution information, and submits it to the server side.
[0095] The server side receives the service chain execution information, and then completes the execution of the service chain based on the spatiotemporal process mechanism model service chain adaptive execution algorithm;
[0096] The spatiotemporal process mechanism model service chain adaptive execution algorithm includes service chain connectivity verification, data source legality verification, and service chain model recursive execution, and the two verification parts of the algorithm together with the spatiotemporal process mechanism model service chain metadata structure satisfy the constraint of the spatiotemporal process mechanism model orchestration rule based on the directed acyclic graph.
[0097] Embodiment 2
[0098] In the mechanism model orchestration process, there is a clear directed relationship between the model service and the respective input and output data source, and there is a serial and parallel relationship between the model services, which brings the characteristics of linear and nonlinear to the service chain; the connection between the model tasks is the sharing of data sources, and there is an execution sequence problem, for example, the input data source of a model is the output data source of the previous step model; the input data source of the mechanism model should be a legal value, and the value of the output data source should be empty before the model execution, so as to avoid the occurrence of illegal situations such as loop in the execution process. Based on the above idea, the present application provides a spatiotemporal process mechanism model service chain adaptive orchestration method based on a directed acyclic graph, which first realizes the integration of model services based on the mechanism model metadata structure, and the flowchart is as shown in Figure 2
[0099] Step S101: The user fills in the corresponding metadata according to the formulated mechanism model metadata structure according to the mechanism model that has been deployed, and uploads it. If it is a new type of model, the corresponding calling middleware needs to be written in the model calling container. Figure 3
[0100] The mechanism model metadata is transmitted and stored in JSON format. The mechanism model metadata structure includes model basic information and model running information. The former includes model unique identifier (model ID), model name, model type, and other fields for representing model basic information. Its main function is to help users understand the model and make decisions.
[0101] The model running information includes model calling entry, model option information, model parameter information set, and model running parameter. The model running parameter mainly includes input data source parameter, output data source parameter, numerical parameter, string parameter, Boolean value parameter, and key-value pair set parameter. Each parameter must include parameter name and parameter type fields. Through this metadata design method, when a new field needs to be added to an old parameter type or a new parameter type needs to be added, the metadata structure can be easily expanded.
[0102] Step S102: After receiving the upload request, the server side converts it into a metadata object and stores it in the meta database.
[0103] In order to build the mapping between the mechanism model meta database type and the server side metadata type, the corresponding metadata entity class needs to be implemented according to the mechanism model metadata structure. By means of object-oriented thinking, a parameter type virtual class is designed for the model parameter information part of the model running information in the metadata. It contains two basic attributes: parameter name and parameter type. All model parameter information classes inherit from this parameter virtual class and expand attributes such as default value on this basis, thereby realizing the dynamic collection processing of the model parameter information part in the metadata entity class object.
[0104] Step S103: The user selects the model and sends a request. The server side queries the corresponding metadata from the database and converts it into a metadata object. After rendering, the corresponding page is returned to the user.
[0105] Each model parameter in the mechanism model metadata corresponds to a different type of control in the front end, for example, a numerical type parameter corresponds to a numerical input box, a string type parameter corresponds to a text input box, a Boolean type parameter corresponds to a checkbox, and a key-value pair set parameter corresponds to a drop-down menu. Through the metadata control page rendering method, not only is the uniformity of the mechanism model user call interface ensured, but also the stability of the running parameter information in the whole life cycle of the model call is ensured.
[0106] Step S104: The user submits the model running parameter values in the page and submits, and the server side acquires the model type corresponding to the model according to the model ID used by the user, finds the corresponding model call object in the model call container, and completes the model call through the object.
[0107] The model call module of the server side plays a control role in the running entrance of the mechanism model, is a middleware of the model service and the model body, connects the parameters provided by the user and the model program, and how to select the corresponding mechanism model according to the dynamic model call information and ensure successful execution is a problem that needs to be solved by the model call module. Therefore, the model call module manages all model call class objects in a container manner, and these classes all implement the same model call interface, which mainly defines the basic control methods of the model call and running feedback and other model running processes. Therefore, even if a new type of mechanism model needs to be integrated, the call class of the model can be efficiently expanded in the container by implementing the interface. According to the model type value acquired from the metadata database by the user during the call, the corresponding model call class object in the container can be acquired based on reflection. Through this way of using the interface and the container management to realize the model call, the coupling degree between the model call classes is effectively reduced, the extensibility of the module when facing the need to integrate new types of mechanism models is fully ensured, and the reusability of the call class is greatly improved.
[0108] In the above embodiment, the mechanism model metadata structure is applied to the integration of multiple source heterogeneous models, the purpose is to uniformly manage the external call interfaces of various models, and to publish services in a standardized form, to provide data and logical basis for the next step of the directed acyclic graph-based spatiotemporal process mechanism model scheduling. Figure 4 As shown in the following specific process of the next step:
[0109] Step S201: The user selects the model to be scheduled and inputs the parameters.
[0110] In order to ensure the high reusability of the service chain, some parameters in this step can be specified during the current scheduling, or can be input by the user during the subsequent service chain call.
[0111] Step S202: repeat step S201 until the scheduling is completed, and generate the corresponding spatiotemporal process mechanism model service chain metadata template.
[0112] Since there is a topological relationship between the model and the model node in the process of model scheduling, the serial or parallel relationship between multiple models in the running process is caused, and the corresponding service chain has linear and nonlinear characteristics, so the execution order of each step in the service chain needs to be reasonably controlled; in addition, the service chain should avoid the generation of loops, for example, the output data source of a mechanism model should not be a legal value. Therefore, the present application uses a directed acyclic graph as the basic idea of adaptive model scheduling, and applies it to the subsequent spatiotemporal process mechanism model metadata design and execution and verification algorithm implementation.
[0113] A directed acyclic graph is a directed graph that cannot return to the starting point through several edges. In the process of using multiple mechanism models to solve complex problems, the chain structure coupled by the models can be abstracted as a directed acyclic graph in general, therefore, the present application extends the basic concept of the directed acyclic graph based on the basic definition of the directed acyclic graph, and combines the mechanism model metadata standard defined above, so that it can be more suitable for the adaptive scheduling of the spatiotemporal process model service chain.
[0114] The relationship between the data source and the model in the entire running process of a mechanism model is abstractly expressed, and the basic mechanism model rule is proposed based on this. If the relationship between the input data source and the output data source and the model is classified, there are four cases, i.e. one-to-one, one-to-many, many-to-one and many-to-many modes, wherein M represents a mechanism model node, I represents an input data source node, O represents an output data source node, and E represents a directed edge between nodes. Figure 5
[0115] Therefore, for the abstract result G M (V I ,V M ,V O ,E) of all mechanism models, each node in the abstract graph g M (v I ,v M ,v O ,e) in the case of a mechanism model running process should satisfy condition (1), wherein v represents a set of nodes, e represents a set of directed edges between nodes, and n v represents the number of nodes.
[0116]
[0117] In the case of satisfying condition (1), the directed edges between nodes should continue to satisfy condition (2), and the model abstract graph at this time has property (I), where <v A ,v B > represents a directed edge between A and B nodes, id is the in-degree of a certain node, and od is the out-degree of a certain node:
[0118]
[0119]
[0120] Among them, condition (1) ensures the number of nodes in a single model service and the acyclic nature of the graph, that is, there cannot be a node that is both an input data source and an output data source, and condition (2) ensures the clear definition of the directed edges between nodes. Under the constraints of the above conditions, a mechanism model execution process can be abstracted as a directed acyclic graph, and accurate definition of the process is ensured, thereby avoiding, for example, the existence of edges connecting data source nodes or the incorrect direction of directed edges between data source nodes and models.
[0121] On the basis of the above basic mechanism model rules, multi-mechanism model orchestration combination rules can be extended. As shown in Figure 6 , three mechanism models in Figure 5 are used in this graph and connected into a new directed acyclic graph, where I represents an input data source node, O represents an output data source node, M represents a mechanism model node, OI represents an intermediate data source node, that is, a node that serves as both a model data input source and another model data input source, and E represents a directed edge between nodes. Assuming that there is a model directed acyclic graph , it can be regarded as an initial model combination directed acyclic graph with a model node number of 1. If a new model graph is added to the model combination graph, in order to ensure that the new combination graph is still a directed acyclic graph, condition (3) needs to be satisfied first, where n v represents the number of a certain node, and e represents the number of edges in the graph.
[0122]
[0123]
[0124] From condition (3), inference (a) is easily obtained, where <v A ,v B > represents a directed edge between A and B nodes:
[0125]
[0126] The meaning of condition (3) is that the number of newly added edges of the new model combination directed acyclic graph must be equal to the number of edges of the added mechanism model directed acyclic graph, so as to avoid the generation of illegal conditions such as newly added directed edges between data source nodes and data source nodes, and between model nodes and model nodes; in addition, this condition also defines that the connection mode of the added model graph and the original combination graph must be the sharing of data source nodes. On the basis of this condition, easy inference (a) is obtained, which means that for the output data source node of any added model graph and the model node of the original combination graph, there is no directed edge from the former to the latter, which ensures the partial acyclicity of the graph.
[0127] On the basis of satisfying condition (3), condition (4) needs to be satisfied:
[0128]
[0129] The sufficient and necessary condition (5) of condition (4) is:
[0130]
[0131] The meaning of condition (4) is that the added mechanism model directed acyclic graph must have a data source node combined with the data source node of the original model combination directed acyclic graph to become a common node. Therefore, the sufficient and necessary condition (5) is obtained, that is, any sub-model graph in the mechanism model combination directed acyclic graph must have another sub-model graph constituting a non-empty data source node intersection. This condition ensures the connectivity of the mechanism model combination directed acyclic graph.
[0132] On the basis of satisfying condition (4) or (5), condition (6) needs to be satisfied:
[0133]
[0134] The sufficient and necessary condition (7) of condition (6) is obtained, where id is the in-degree of a node:
[0135]
[0136] The meaning of condition (6) is that all output data source nodes of the added mechanism model directed acyclic graph cannot be combined with any intermediate and output data source nodes in the original model combination directed acyclic graph to become common nodes, therefore, the sufficient and necessary condition (7) of this condition is obtained, that is, the in-degree of all intermediate data source nodes and output data source nodes of the mechanism model combination directed acyclic graph is equal to 1. This condition avoids the generation of illegal conditions such as multiple models outputting to the same data source, and ensures the legality of the model combination graph.
[0137] On the basis of satisfying condition (6) or (7), condition (8) needs to be satisfied:
[0138]
[0139] If then
[0140] The meaning of condition (8) is that if the added mechanism model has a directed acyclic graph input data source node that is any data source node of the original model combination directed acyclic graph, then any output data source of the model cannot share a node with any input data source of the original model combination directed acyclic graph, thereby avoiding the generation of a loop.
[0141] Conditions (3) and (8) jointly ensure that after each update model task link, the model combination graph is always a directed acyclic graph. The basic mechanism model rule and the multi-mechanism model orchestration rule not only ensure the connectivity, legality, directionality and acyclicity of the multi-mechanism model orchestration combination graph, but also provide theoretical support for the metadata construction of the mechanism model service chain and the verification and execution of the service chain.
[0142] The multi-model collaborative execution process represented by the directed acyclic graph can be abstracted as a chain data structure, and each mechanism model execution process information based on the above rules is taken as a basic unit. According to the mechanism model metadata structure and conditions (1), (2) and (3) above, a JSON format spatiotemporal process mechanism model service chain metadata structure is proposed.
[0143] The data structure includes two parts: a service chain unique identifier (service chain ID) and a service chain model combination information set. Each unit of the service chain model combination information set contains five parts: a unit unique identifier (unit ID); a model ID, which is the unique identifier of the model used in the unit and is determined by the metadata of the model; a parameter key-value pair set, which contains all the model running parameter key-value pairs of the unit model and is determined by the metadata of the model and the user; an input data source parameter index, which contains all the input data source parameter names of the unit model and is determined by the metadata of the model; and an output data source parameter index, which contains all the output data source parameter names of the unit model and is determined by the metadata of the model, as shown in Figure 7 .
[0144] Each parameter of each unit must exist and be non-empty, thereby satisfying condition (1); all input data source parameters in the input data source parameter index can be regarded as directed edges from their nodes to the node of the unit model, and similarly, the output data source parameter index can also be regarded as directed edges from the node of the unit model to all output data source nodes, thereby satisfying condition (2).
[0145] The model combination is chained with the unit information represented by each sub-model directed acyclic graph in the directed acyclic graph, that is, the service chain metadata of the combination can be obtained, because the input and output data source parameter names in each unit come from the metadata of the model in the unit, which ensures the constant number of directed edges between the data source node and the model node, so the combination graph corresponding to the mechanism model service chain composed of all units must meet condition (3).
[0146] Step S203: submit the metadata template to the server side and store it in the spatiotemporal process mechanism model service chain metadata database.
[0147] Step S204: the user selects the model combination that has been arranged, adds the parameter values to be input to the metadata template returned by the database, generates service chain execution information and submits it to the server side.
[0148] In order to ensure that the arranged service chain has high flexibility, the present application divides the data conforming to the spatiotemporal process mechanism model service chain metadata structure into two categories, namely the metadata template and the service chain execution information. The former refers to the metadata generated by the user when arranging in steps S201 and S202, which contains some parameters without specified parameter values, which are determined by the user when calling; the latter refers to the complete service chain metadata containing all required parameters generated after the user calls and specifies the parameter values in the metadata template that have not been determined.
[0149] The server side receives the service chain execution information and completes the execution of the service chain through the spatiotemporal process mechanism model service chain adaptive execution algorithm based on the arrangement rule. Since the JSON format metadata cannot guarantee the order, the execution order of each unit in the service chain execution information cannot be determined temporarily, in order to solve this problem, the present application proposes inferences (b) and (c) based on the metadata structure and single model service execution method:
[0150] (b) If all input data sources of a mechanism model service of a unit are legal, the model can be executed smoothly, and all output data sources are also legal after execution.
[0151] (c) If all input data sources of an executable service chain are legal, the model arrangement combination task can be completed under the condition of ensuring the reasonable execution order of each unit.
[0152] The legality of the data source input of each unit is indispensable for the smooth execution of the service chain. According to the arrangement rules, there are two modes for the data source input of a new unit: selecting a legal data source outside the chain and specifying an existing data source in the chain. The legality of the data of the latter can be ensured by inference (b), but the execution order of each unit is required to ensure. Therefore, based on inference (c), the present application relies on the legality judgment of the input data source parameter of each unit in the service chain execution information to control the execution order.
[0153] Combined with the model adaptive arrangement rules, the spatiotemporal process mechanism model service chain adaptive execution algorithm mainly includes three parts: service chain connectivity verification (step S301), data source legality verification (steps S306-S308), and service chain model recursive execution (steps S304-S305, S309-S313). The algorithm running process steps are shown in Figure 8
[0154] Step S301: Verify the connectivity of the service chain
[0155] Firstly, the connectivity of the service chain needs to be verified, and the principle is based on condition (5). The method is to traverse the entire service chain execution information, record the set of input data sources and output data sources of each unit in the service chain, and perform intersection operation between each unit and other units. If the intersection of the data source set of a unit and the set of all other units is empty, then the unit is not connected with the service chain, which does not meet the arrangement rule of condition (4), and thus the running process is ended. If the service chain is connected, step S302 is executed.
[0156] Step S302: Record all input data sources of the service chain execution information.
[0157] By comparing the service chain execution information with the corresponding metadata template, all legal input data source parameter values of the service chain input by the user in step S204 can be obtained and recorded.
[0158] Step S303: Establish an empty output data source record.
[0159] Step S304: Judge the number of remaining units in the service chain execution information.
[0160] If the number of remaining units in the service chain is 0, there may be two cases: the service chain is empty, or the service chain has been executed. Regardless of which case, the running process is ended; if it is not 0, step S305 is executed.
[0161] Step S305: Enter the first unit of the service chain.
[0162] Step S306: judging whether all input data sources of the unit exist in the input or output record
[0163] According to the inference (b), all data sources in the input and output records are legal, so all input data sources of the model need to be found in the two records. If there is a data source that does not exist, step S313 is executed; if all input data sources exist, step S307 is executed.
[0164] Step S307: judging whether the output data source of the unit exists in the output record.
[0165] Based on condition (7), the first judgment is made. If the output record contains an output data source of the unit, that is, the in-degree of the model combination graph node corresponding to the data source is greater than 1, it means that the service chain is not arranged according to condition (6), and the running process is ended. If the judgment result is false, step S308 is executed.
[0166] Step S308: judging whether the output data source of the unit exists in the input record.
[0167] Based on condition (8), the second judgment is made. If the input record contains the output data source of the step, a loop is formed in the model combination graph corresponding to the service chain, and the running process is ended. If the judgment result is false, step S309 is executed.
[0168] Step S309: executing the model in the unit, that is, step S104 is executed.
[0169] Step S310: adding the output data source of the unit to the output record.
[0170] Since a certain output data source of the unit may be an input data source of another unit, according to the inference (b), the data source is added to the output record.
[0171] Step S311: deleting the unit from the service chain execution information
[0172] To prevent the same unit from being executed repeatedly, the unit will be deleted from the service chain execution information.
[0173] Step S312: judging whether the current service chain traversal is completed
[0174] If the current service chain traversal is completed, but due to step S306, there may be a unit in the service chain that has not been executed, so step S304 needs to be executed again. If the current traversal is not completed, step S313 is executed.
[0175] Step S313: entering the next step of the service chain, and then executing S306.
[0176] After steps S301-S313, if the validity of the service chain is verified and executed, the legitimacy of all expected output data sources is guaranteed, and the operation task of the spatiotemporal process mechanism model combination is completed.
[0177] By summarizing the external callable interface information of the mechanism model, the application proposes a mechanism model description standard, realizes the existing mechanism model reuse method based on the B / S architecture, and realizes the integration of multi-source heterogeneous models through the container management mode.
[0178] The application combines the topological relationship between the model and the data source in the coupling and cooperation of the multi-mechanism model, proposes a self-adaptive arrangement rule suitable for the mechanism model based on the idea of the directed acyclic graph, and guarantees the directivity, connectivity, acyclicity and legitimacy of the model arrangement result.
[0179] Through the arrangement rule, the legitimacy judgment of the data source is taken as the basic idea, the description standard of the spatiotemporal process service chain and the self-adaptive verification and execution method are designed, and the seamless coupling and cooperation between the multi-disciplinary mechanism models are finally realized.
[0180] Although the application is described in detail with reference to the foregoing embodiments, those skilled in the art can modify the technical solutions recorded in the foregoing embodiments or replace some technical features with equivalent ones, and any modification, equivalent replacement, improvement, etc. within the spirit and principles of the application shall be included in the protection scope of the application.
Claims
1. A method for service chain orchestration of spatiotemporal process mechanism model based on directed acyclic graph, characterized in that, The method comprises the following steps: S10, integrating the model service based on the mechanism model metadata structure; specifically comprising: Step S101, the user fills in the corresponding metadata according to the prepared mechanism model metadata structure and uploads according to the already deployed mechanism model; Step S102, after the server end receives the uploading request, it is converted into a metadata object and stored in the meta database; Step S103, the user selects the model and sends a request, the server end queries the corresponding metadata from the database and converts it into a metadata object, and generates a corresponding page after rendering and returns it to the user; Step S104, the user submits the model running parameter value in the page and submits, the server end acquires the model type corresponding to the model ID used by the user, finds the corresponding model calling object in the model calling container, and completes the model calling through the object; S20, constructing a directed acyclic graph-based spatiotemporal process mechanism model scheduling rule and self-adaptive scheduling; the self-adaptive scheduling specifically comprises: Step S201, the user selects the model to be scheduled and inputs the parameters; Step S202, repeat step S201 until the scheduling is completed, and generate a corresponding spatiotemporal process mechanism model service chain metadata template; Step S203, submit the metadata template to the server end and store it in the spatiotemporal process mechanism model service chain meta database; Step S204, the user selects the already scheduled model combination, combines the metadata template returned by the database, adds the to-be-input parameter value, generates service chain execution information and submits it to the server end; after the server end receives the service chain execution information, the execution order of each unit in the service chain execution information is determined by inference (b) and inference (c), and then the service chain is executed based on the spatiotemporal process mechanism model service chain self-adaptive execution algorithm; Inference (b): if all input data sources of a mechanism model service of a unit are legal, the model can be executed smoothly, and all output data sources are also legal after execution; Inference (c): if all input data sources of an executable service chain are legal, the model scheduling combination task can be completed under the condition of ensuring the reasonable execution order of each unit.
2. The method of claim 1, wherein the method is based on a directed acyclic graph. The mechanism model metadata structure includes model basic information and model running information; the model basic information includes model ID, model name and model type; the model running information includes model calling entry for implementing model external calling interface information, model option information, and model parameter information set including all running parameter related information of the model.
3. The method of claim 1, wherein the method is based on a directed acyclic graph. The spatiotemporal process mechanism model scheduling rule based on the directed acyclic graph includes a basic mechanism model rule and a multi-mechanism model scheduling rule; The basic mechanism model rule contains two conditions and one property, which is used to constrain the relationship between the model and the input and output data sources in a single mechanism model service; For the abstract result G of all mechanism models M (V I ,V M ,V O ,E), in the case of a mechanism model running process, each node in the abstract graph g M (v I ,v M ,v O ,e) should meet the condition (1), Wherein, M represents mechanism model node, I represents input data source node, O represents output data source node, v represents the collection of certain node, e represents the collection of directed edge between nodes, n v represents the number of certain node; In the case of satisfying condition (1), the directed edge between the nodes continues to satisfy condition (2), At this time, the model abstract graph has property (I); Wherein, condition (1) guarantees the number of each node in a single model service and the acyclic property of the graph, i.e. there cannot be a node that is both an input data source and an output data source, and condition (2) guarantees the explicit definition of the directed edges between each node.
4. The method of claim 3, wherein the method is based on a directed acyclic graph. The multi-mechanism model arrangement rule includes six conditions, wherein two sufficient and necessary conditions and one inference are included, and the combination process of model arrangement is constrained; a model directed acyclic graph considering the initial model combination directed acyclic graph as a model with one node adding a new model graph to the initial model combination directed acyclic graph to ensure that both generate a new combination graph still a directed acyclic graph, condition (3) needs to be fulfilled, wherein I represents an input data source node, O represents an output data source node, M represents a mechanism model node, OI represents an intermediate data source node, E represents a directed edge between nodes, n v denotes the number of certain nodes, e denotes the number of edges in the graph; From condition (3), inference (a) is obtained, where <v A ,v B > represents a directed edge between A and B nodes; On the basis of satisfying condition (3), condition (4) needs to be satisfied, The sufficient and necessary condition (5) of condition (4) is: On the basis of satisfying condition (4) or (5), condition (6) needs to be satisfied: The sufficient and necessary condition (7) of condition (6) is obtained, Wherein, id is the in-degree of a node; On the basis of satisfying condition (6) or (7), condition (8) needs to be satisfied: If then Conditions (3) and (8) jointly guarantee that after each update of the model task link, the model combination graph is always a directed acyclic graph.
5. The method of claim 1, wherein: The spatiotemporal process mechanism model service chain metadata structure in step S202 includes a service chain ID and a service chain model combination information set; each unit of the service chain model combination information set includes five parts: a unit ID, a model ID, a parameter key-value pair set, an input data source parameter index, and an output data source parameter index.
6. The method of claim 1, wherein: The adaptive execution algorithm of the spatiotemporal process mechanism model service chain includes service chain connectivity verification, data source legality verification, and service chain model recursive execution, and the algorithm specifically includes the following: Step S301, verify the connectivity of the service chain: first, the connectivity of the service chain needs to be verified, the set of input data sources and output data sources of each unit in the service chain is recorded by traversing the entire service chain execution information, and the intersection operation is performed between each unit and other units; if the intersection of the data source set of a certain unit and the set of all other units is empty, then it is considered that the unit is not connected with the service chain, and does not meet the arrangement rule of condition (4), Therefore, the running process is ended; If the service chain is connected, step S302 is executed; Step S302, record all input data sources of the service chain execution information: compare the service chain execution information with the corresponding metadata template, obtain all legal input data source parameter values of the service chain input by the user in step S204, and record them; Step S303, establish an empty output data source record; Step S304, judge the number of remaining units in the service chain execution information: if the number of remaining units in the service chain is 0, there can be two cases: the service chain is empty, or the service chain execution is completed, regardless of which case, the running process is ended; if it is not 0, step S305 is executed; Step S305, enter the first unit of the service chain; Step S306, judging whether all input data sources of the unit exist in the input or output record: according to the inference (b), all data sources in the input and output records are legal, so all input data sources of the model need to be found in the two records, if there is a data source that does not exist, step S313 is executed; if all input data sources exist, step S307 is executed; Step S307, judging whether the output data source of the unit exists in the output record: based on condition (7), the first judgment is made, If the output record contains an output data source of the unit, that is, the in-degree of the model combination graph node corresponding to the data source is greater than 1, it means that the service chain is not arranged according to condition (6), End the running process; If the judgment result is false, step S308 is executed; Step S308, judging whether the output data source of the unit exists in the input record: based on condition (8), the second judgment is made, If then If the input record contains the output data source of the step, a loop is formed in the model combination graph corresponding to the service chain, and the running process is ended; if the judgment result is false, step S309 is executed; Step S309, executing the model in the unit, that is, step S104 is executed; Step S310, adding the output data source of the unit to the output record: since a certain output data source of the unit may be an input data source of another unit, according to the inference (b), the data source is added to the output record; Step S311, deleting the unit in the service chain execution information: to prevent the same unit from being executed repeatedly, the unit is deleted in the service chain execution information; Step S312, judging whether the current service chain is completed: if the current service chain is completed, but due to step S306, there may be a unit in the service chain that has not been executed, so step S304 needs to be executed again; if the current iteration is not completed, step S313 is executed; Step S313, entering the next step of the service chain, and then executing S306; After steps S301-S313, if the validity of the service chain is verified and executed, the legality of all expected output data sources is guaranteed, and the running task of the space-time process mechanism model combination is completed.
Citation Information
Patent Citations
Robot fleet management and additive manufacturing for value chain networks
CA3177985A1
Cloud application deployment method based on log mining
CN108153532A