A state diagram generation method, device, electronic device and storage medium
By inputting the node coordinate constraint rules of the state graph and the target network graph to satisfyability model theory solver, the traditional method's inefficiency problem under massive state and complex migration relationships is solved, and efficient state graph generation is achieved.
Patent Information
- Application Number
- CN202411997236.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When faced with massive states and complex state migration relationships, the traditional state diagram drawing method is less efficient and it is difficult to quickly find a reasonable state position.
By obtaining the target network diagram corresponding to the target state set, input the node coordinate constraint rules and the target network diagram into the satisfactory model theory solver to solve the node coordinate values that meet the constraint rules, and generate a state diagram based on these coordinate values and edges.
It realizes efficient visualization operations on a large number of state sets, and accurately handles complex constraints by satisfying the theory of sensitivity mode, and automatically generates a state diagram layout that meets user needs, improving the efficiency of generating state diagrams corresponding to massive states.
Smart Images

Figure CN119397205B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a state diagram generation method, device, electronic device and storage medium. Background Art
[0002] At present, when it is necessary to model and visualize a state machine with a large number of states, the states need to be reasonably arranged and connected to form a state diagram so that technicians can intuitively and clearly understand the connection relationship between various states. The traditional state diagram drawing method relies on expert experience to assign corresponding positions to each state, draw the state mark corresponding to the state according to the above position, and connect the corresponding state mark according to the migration relationship between the states. However, when faced with massive states and complex state migration relationships, in order to find a reasonable state position, a lot of calculations and attempts are often required, which is inefficient.
[0003] Therefore, how to improve the efficiency of generating state diagrams corresponding to a large number of states has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] Embodiments of the present invention provide a state diagram generation method, device, electronic device and storage medium, which can improve the efficiency of generating state diagrams corresponding to a large number of states.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a state diagram generation method, the method comprising:
[0006] Obtain a target network graph corresponding to the target state set; wherein the nodes in the target network graph represent the target states in the target state set, and the edges in the target network graph represent the state transition relationship between the target states;
[0007] Input the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver to obtain node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules;
[0008] A state graph corresponding to the target state set is generated based on the node coordinate values and the edges.
[0009] Optionally, the step of inputting the node coordinate constraint rules corresponding to the target state set and the target network graph into a satisfiability model theory solver to obtain node coordinate values corresponding to each node in the target network graph output by the satisfiability model theory solver includes:
[0010] The node coordinate constraint rules, the target network diagram and the solution target corresponding to the target state set are input into the satisfiability model theory solver, so that the satisfiability model theory solver solves multiple groups of pending node coordinate sets based on the node coordinate constraint rules and the target network diagram, and determines the target node coordinate set from the multiple groups of pending node coordinate sets based on the solution target, and outputs the node coordinate values corresponding to each node contained in the target node coordinate set.
[0011] Optionally, the target network diagram includes at least one of a source node corresponding to the starting state in the target state set and a directed edge indicating the direction of state migration between target states; wherein the source node is used to indicate the starting solution node to the satisfiability model theory solver, and the directed edge is used to indicate the solution traversal direction to the satisfiability model theory solver.
[0012] Optionally, the node coordinate constraint rules include at least one of node coordinate range constraint rules, node coordinate distance constraint rules, and adjacent node connection line constraint rules; wherein the node coordinate range constraint rules are used to constrain the coordinate range of node coordinates, the node coordinate distance constraint rules are used to constrain the coordinate distance between multiple node coordinates, and the adjacent node connection line constraint rules are used to constrain the relative distance and relative angle between the connecting line of the node coordinates of the first adjacent node pair and the connecting line of the node coordinates of the second adjacent node pair.
[0013] Optionally, the node coordinate distance constraint rule includes at least one of an arbitrary node distance constraint condition and a related node distance constraint condition.
[0014] Optionally, before inputting the node coordinate constraint rules corresponding to the target state set and the target network graph into the satisfiability model theory solver, the method further includes:
[0015] In the case where the node coordinate constraint rule includes a node coordinate range constraint rule, acquiring the total state amount of the target state set and the average number of characters of the state identifier of the target state;
[0016] Based on the state total amount and the average character amount of the state identifier, the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule are determined.
[0017] Optionally, after determining the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule based on the total state amount and the average character amount of the state identifier, the method further includes:
[0018] In the case where the node coordinate constraint rule includes an adjacent node connection constraint rule, obtaining the total state amount of the target state set and the total edge amount in the target network graph;
[0019] Determine the node density based on the abscissa range, the ordinate range and the total amount of states, and determine the edge density based on the abscissa range, the ordinate range and the total amount of edges;
[0020] The relative distance lower limit value and the relative angle lower limit value of the adjacent node connection constraint rule are determined based on the node density and the edge density; wherein the relative distance lower limit value is used to constrain the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and the relative angle lower limit value is used to constrain the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair.
[0021] Optionally, generating a state graph corresponding to the target state set based on the node coordinate values and the edges includes:
[0022] Determine the node distance between adjacent node pairs according to the node coordinate values;
[0023] Determine a connection line style between the adjacent node pairs based on the node distance; wherein the connection line style includes at least one of a connection line color, a connection line width, and a connection line shape;
[0024] A state mark of the target state is generated based on the node coordinate value corresponding to the target state, and a connecting line between the state marks is generated based on the connecting line style to obtain the state diagram.
[0025] Optionally, the node coordinate values include three-dimensional coordinate values, and generating a state graph corresponding to the target state set based on the node coordinate values and the edges includes:
[0026] Generate corresponding state marks based on the node coordinate values in a three-dimensional coordinate system, and generate connecting lines of the state marks based on the edges in the three-dimensional coordinate system to obtain a state three-dimensional model;
[0027] A state diagram corresponding to the target state set is obtained based on the state three-dimensional model.
[0028] On the other hand, an embodiment of the present invention discloses a state diagram generating device, the device comprising:
[0029] A target network graph module is used to obtain a target network graph corresponding to a target state set; wherein the nodes in the target network graph represent target states in the target state set, and the edges in the target network graph represent state transition relationships between the target states;
[0030] A node coordinate module, used for inputting the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver, and obtaining the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules;
[0031] A state diagram module is used to generate a state diagram corresponding to the target state set based on the node coordinate values and the edges.
[0032] On the other hand, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the aforementioned method.
[0033] The embodiment of the present invention further discloses a computer-readable storage medium on which instructions are stored. When executed by one or more processors, the processors execute the method as described above.
[0034] The embodiment of the present invention includes the following advantages: in the state diagram generation method provided in the embodiment of the present invention, a target network diagram corresponding to the target state set is obtained; wherein, the nodes in the target network diagram represent the target states in the target state set, and the edges in the target network diagram represent the state transition relationship between the target states; the node coordinate constraint rules corresponding to the target state set and the target network diagram are input into the satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; and the state diagram corresponding to the target state set is generated based on the node coordinate values and the edges. In this way, the visualization operation of a large number of state sets is realized, and the state position can be solved through the satisfiability modulus theory, so that the user can flexibly and conveniently set complex constraints for the solution process, and the complex constraints are accurately processed through the satisfiability modulus theory, and the state diagram layout that meets the user's needs is automatically generated, which helps to improve the efficiency of generating state diagrams corresponding to massive states. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0036] Figure 1 It is a flow chart of steps of a state diagram generation method provided by an embodiment of the present invention;
[0037] Figure 2 is a target network diagram provided by an embodiment of the present invention;
[0038] Figure 3 is a state diagram provided by an embodiment of the present invention;
[0039] Figure 4 is a flowchart of another method for generating a state diagram provided by an embodiment of the present invention;
[0040] Figure 5 is a block diagram of a state diagram generating device provided by an embodiment of the present invention;
[0041] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] 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 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.
[0043] Reference Figure 1 , shows a flow chart of the steps of a state diagram generation method provided by an embodiment of the present invention, such as Figure 1 As shown, the method may specifically include the following steps:
[0044] Step 101: Obtain a target network graph corresponding to a target state set; wherein the nodes in the target network graph represent target states in the target state set, and the edges in the target network graph represent state transition relationships between the target states.
[0045] In an embodiment of the present invention, the target state set represents a state set contained in a state machine, and may also be a state set of software or hardware. The above-mentioned target state set may be composed of the state of a processor, the state of a cache, or the state machine of an operating system state machine of an operating system, etc., which is not specifically limited in the embodiment of the present invention. For example, in an on-chip network (OCN) supporting the CHI protocol (Cache Coherence Interconnect Protocol), the system architecture may include two request nodes (RN), a home node (HN), and a subordinate node (SN). These components communicate and coordinate through the CHI protocol (Cache Coherence Interconnect Protocol) to achieve cache consistency and efficient data access management. The slave node may undergo the following state transition in an atomic operation: when hn sn write is 1, the slave node will enter the atomic_sn_3_1 state from the SN_Initial state, and then, based on this, when sn hn dbidresp is 1, it will enter the atomic_sn_4_1 state, and then when hn sn writedata is 1, it will return to the SN_Initial state, thus forming a logic tree. By analyzing the above state transition relationship, a network diagram that can represent the state transition logic can be generated.
[0046] A network graph is a data structure that can be used to represent the relationship between a set of objects. A network graph can also be called a graph. A network graph can be composed of nodes (Vertices) and edges (Edges), and the nodes in the network graph are connected by edges. In an embodiment of the present invention, a target network graph corresponding to a target state set can be obtained, in which the target state in the target state set is represented by a node, and the state transition relationship between the target states is represented by an edge.
[0047] Specifically, the state identifier of each target state in the target state set can be obtained, and then the state transition relationship information corresponding to the target state set can be queried based on the state identifier to determine the state transition relationship between the target states, generate each target state as a node, and generate edges between nodes with state transition relationships. These nodes and edges together constitute the target network graph of the target state set. Among them, the state transition relationship can include at least the state identifiers of two target states. For example, the state transition relationship can include state A and state B, indicating that state A and state B can be directly converted; a state transition relationship can also include a migration direction. For example, the state transition relationship can include state A and state B, and the migration direction is state A to state B, indicating that state A can be directly converted to state B, while state B cannot be directly converted to state A; a state transition relationship can also include a migration condition, indicating the triggering condition for the state transition to occur.
[0048] Exemplarily, the target state set E includes 5 target states: state 1 to state 5, and the corresponding state transition relationships may include: state 1-state 2, state 1-state 3, state 2-state 4, state 2-state 5, state 3-state 4, state 4-state 5.
[0049] Reference Figure 2 , Figure 2 A target network diagram provided by an embodiment of the present invention is shown, such as Figure 2 As shown, a target network diagram can be generated for the above target state set E, wherein nodes 1 to 5 correspond to states 1 to 5 respectively, and an edge between nodes corresponds to a state transition relationship; for example, the edge between node 1 and node 2 is generated based on the above state transition relationship "state 1-state 2", and the edge between node 4 and node 3 is generated based on the above state transition relationship "state 3-state 4", and so on.
[0050] Step 102: input the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver to obtain node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules.
[0051] In an embodiment of the present invention, a target state set may correspond to a node coordinate constraint rule, and different target state sets may correspond to the same node coordinate constraint rule or may correspond to different node coordinate constraint rules. The node coordinate constraint rule may represent a restriction condition on the node coordinate value of each node in the target network diagram to be solved. The node coordinate constraint rule corresponding to the target state set and the target network diagram corresponding to the target state set may be input into a satisfiability model theory solver, and the satisfiability model theory solver solves the node coordinate value corresponding to each node in the target network diagram according to the node coordinate constraint rule, so that the node coordinate value corresponding to each node satisfies the above-mentioned node coordinate constraint rule. Among them, the node coordinate constraint rule may be in the form of a logical expression. Satisfiability Modulo Theories (SMT) can be used for logical solving, and can be specifically used to solve problems under given constraint rules.
[0052] In the embodiment of the present invention, the satisfiability model theory solver may include but is not limited to a Z3 solver, a CVC5 solver, etc., and the embodiment of the present invention does not make any specific limitation.
[0053] Specifically, the node coordinate constraint rules can be described by the logical expression of the SMT language, and the SMT solver is called through the interface provided by the SMT library to solve the problem. Among them, the SMT language can include the SMT-LIB language; the SMT library can include Z3-Py supporting python, which can be used to call the Z3 solver, and PySMT supporting python, which can be used to call a variety of solvers. The above SMT language can be flexibly selected according to the user's operating system, development environment, etc., and the embodiment of the present invention does not specifically limit it.
[0054] Specifically, the node coordinate constraint rules described in the SMT language can be directly configured, and then the node coordinate constraint rules and the corresponding target network diagram can be input into the SMT solver for solving; the node coordinate constraint rules and the target network diagram generated by the above steps can also be input into the interface of the SMT library, and the SMT library can call the corresponding SMT solver for solving according to the node coordinate constraint rules and the target network diagram, which is not specifically limited in the embodiment of the present invention. Among them, the target network diagram can be input into the SMT solver in a data format that matches the SMT solver.
[0055] Optionally, the node coordinate constraint rules may be in a natural language form described by the user. In response to the node coordinate constraint rules described by the user in natural language, the node coordinate constraint rules in natural language form may be input into a code generation model (e.g., a code generation model trained based on a Transformer model) to obtain the node coordinate constraint rules in SMT language form output by the code generation model, and then the node coordinate constraint rules in SMT language form and the target network diagram may be input into a satisfiability model theory solver in the above manner for solving, to obtain the node coordinate values corresponding to each node in the target network diagram output by the solver.
[0056] In an embodiment of the present invention, the node coordinate constraint rules can be used to constrain the range of node coordinates corresponding to nodes in the target network diagram, the distance between node coordinates corresponding to multiple nodes, etc., so as to solve the node coordinate values that meet the node coordinate constraint rules.
[0057] For example, the specific content of a node coordinate constraint rule may be: the distance between adjacent node coordinates is equal to a, and the distance between node coordinates corresponding to adjacent nodes is less than or equal to 5a. Wherein, adjacent nodes represent nodes directly connected by an edge in the target network graph.
[0058] Step 103: Generate a state graph corresponding to the target state set based on the node coordinate values and the edges.
[0059] In the embodiment of the present invention, after obtaining the node coordinate values corresponding to each node in the target network graph, the state mark of the target state corresponding to the node coordinate value can be drawn at the node coordinate value position in the plane coordinate system, and then connecting lines are drawn between the state marks according to the edges in the node graph to obtain the state graph corresponding to the target state set. Among them, the state mark can include but is not limited to points, patterns, characters, etc., and the connecting line can include solid lines, dotted lines, etc., which are not specifically limited in the embodiment of the present invention.
[0060] For example, if Figure 2 The target network diagram shown and the corresponding node coordinate constraint rules are input into the satisfiability model theory solver, and the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver are shown in Table 1 below:
[0061]
[0062] Table 1
[0063] Reference Figure 3 , Figure 3 A state diagram provided by an embodiment of the present invention is shown, where the coordinates corresponding to each node in Table 1 are plotted as solid points, and according to Figure 2 The edges between the nodes in Figure 3Draw the corresponding connecting lines in the figure, and add the state identification characters (state 1 to state 5) of the corresponding target state to the solid points corresponding to the drawn nodes, and you can get the following: Figure 3 It should be noted that in actual application, the target state set may contain a large number of target states, and the generated state diagram may contain a large number of state marks and a large number of connecting lines.
[0064] In summary, in a state diagram generation method provided by an embodiment of the present invention, a target network diagram corresponding to a target state set is obtained; wherein, the nodes in the target network diagram represent the target states in the target state set, and the edges in the target network diagram represent the state transition relationship between the target states; the node coordinate constraint rules corresponding to the target state set and the target network diagram are input into the satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; and a state diagram corresponding to the target state set is generated based on the node coordinate values and the edges. In this way, visualization operations on a large number of state sets are realized, and the state positions can be solved through the satisfiability modulus theory, so that users can flexibly and conveniently set complex constraints for the solution process, and the complex constraints can be accurately processed through the satisfiability modulus theory to automatically generate a state diagram layout that meets user needs, which helps to improve the efficiency of generating state diagrams corresponding to massive states.
[0065] Optionally, in some embodiments, the step of inputting the node coordinate constraint rules corresponding to the target state set and the target network graph into a satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network graph output by the satisfiability model theory solver may specifically include:
[0066] The node coordinate constraint rules, the target network diagram and the solution target corresponding to the target state set are input into the satisfiability model theory solver, so that the satisfiability model theory solver solves multiple groups of pending node coordinate sets based on the node coordinate constraint rules and the target network diagram, and determines the target node coordinate set from the multiple groups of pending node coordinate sets based on the solution target, and outputs the node coordinate values corresponding to each node contained in the target node coordinate set.
[0067] In an embodiment of the present invention, the satisfiability model theory solver can perform multiple rounds of solving based on the node coordinate constraint rules and the target network diagram to determine multiple groups of pending node coordinate sets that satisfy the node coordinate constraint rules, and one group of pending node coordinate sets can include the pending node coordinates corresponding to each node. Then, for each group of pending node coordinate sets, the solution target is used to verify it, and the degree to which each group of pending node coordinate sets satisfies the solution target is determined. The group of pending node coordinate sets that best satisfies the solution target is determined as the target node coordinate set, and each coordinate in the target node coordinate set is the node coordinate value corresponding to each node.
[0068] In an embodiment of the present invention, the solution target may include but is not limited to at least one of a target of the sum of adjacent node distances, a target of the mean of adjacent node distances, a target of the total number of adjacent node line crossings, etc. Exemplarily, in the case where the solution target is a target of the sum of adjacent node distances, the target of the sum of adjacent node distances may be a target of minimizing the sum of adjacent node distances, and the satisfiability model theory solver may solve all pending node coordinate sets that can satisfy the node coordinate constraint rules according to the node coordinate constraint rules, and then calculate the corresponding sum of adjacent node distances for each pending node coordinate set, and select the pending node coordinate set with the smallest sum of adjacent node distances as the target node coordinate set.
[0069] Among them, the sum of the distances between adjacent nodes can be used to constrain the sum of the distances between the node coordinates of all adjacent node pairs in the target network diagram, that is, to constrain the total length of all connecting lines in the generated state diagram, which can effectively avoid too dense connecting lines and help improve the readability of the state diagram. For example, a sum of the distances between adjacent nodes can be:
[0070]
[0071] Among them, minimize means minimization, li represents the distance between the node coordinates of the i-th adjacent node pair, and n represents the total number of adjacent node pairs. The above-mentioned adjacent node distance sum target can minimize the adjacent node distance sum.
[0072] Another neighbor node distance sum objective could be:
[0073]
[0074] Among them, li represents the distance between the node coordinates of the i-th adjacent node pair, n represents the total number of adjacent node pairs, Indicates the total distance limit value.
[0075] Optionally, in some embodiments, the solution goal may include multiple sub-goals at the same time, such as minimizing the sum of adjacent node distances and minimizing the mean of adjacent node distances. Each sub-goal may be set with a corresponding weight, and the score corresponding to each pending node coordinate set may be calculated by weighting or weighted averaging according to the sub-goals and corresponding weights, and the pending node coordinate set with the smallest score value may be used as the target node coordinate set. In this way, the node coordinates that better meet the user's needs are determined, and the readability of the state diagram generated based on the node coordinates is improved.
[0076] Optionally, in some embodiments, the target network diagram includes at least one of a source node corresponding to the starting state in the target state set and a directed edge indicating the direction of state migration between target states; wherein the source node is used to indicate the starting solution node to the satisfiability model theory solver, and the directed edge is used to indicate the solution traversal direction to the satisfiability model theory solver.
[0077] The target network graph may include at least one source node corresponding to the starting state in the target state set, that is, the target network graph may be an active graph. The source node has no predecessor node, but only successor nodes. Therefore, the source node can represent the starting state in the target state set. The satisfiability model theory solver can use the source node as the starting solution node, traverse each node from the starting solution node and solve the node coordinate value corresponding to each node, thereby improving the solution efficiency.
[0078] The edges in the target network graph can be directed edges or undirected edges, that is, the target network graph can be a directed graph. In the case where the target network graph is a directed graph, the directed edges in the target network graph can indicate the state migration direction between the corresponding nodes of the two target states connected thereto. Through the directed edges in the target network graph, the solution traversal direction of the satisfiability model theory solver can be guided, so that the satisfiability model theory solver traverses and calculates the node coordinates of each node according to the state migration direction. Since the state migration direction between each target state can cover all target states in the state set, therefore, solving each node by using the directed edge determined by the state migration direction as the solution traversal direction can effectively avoid the generation of loops in the local part of the target network graph during the traversal process, which helps to improve the solution efficiency of the satisfiability model theory solver.
[0079] In an embodiment of the present invention, the target network graph may also include source nodes and directed edges at the same time, that is, the target network graph may be an active directed graph, so that the satisfiability model theory solver may use the source node as the starting node for solving, and traverse each node in the target network graph in turn according to the state migration direction indicated by the directed edge and solve the corresponding node coordinates, thereby further improving the solving efficiency.
[0080] Optionally, in some embodiments, the node coordinate constraint rules in the embodiments of the present invention may include: at least one of: a node coordinate range constraint rule, a node coordinate distance constraint rule, and an adjacent node connection constraint rule.
[0081] In an embodiment of the present invention, a node coordinate range constraint rule may be used to constrain the coordinate range of a node coordinate. For example, a possible node coordinate range constraint rule may be expressed as:
[0082]
[0083] The above node coordinate range constraint rule means that the node coordinate horizontal coordinate x of all nodes is constrained between 0 and 10, and the node coordinate vertical coordinate y of all nodes is constrained between 0 and 10, that is, the node coordinates of all nodes are constrained within a rectangular area, so as to avoid the problem that the node coordinate value to be solved is too large or too small, which leads to the reduction of efficiency of subsequent processing process, and can also effectively limit the size of the state diagram generated subsequently.
[0084] In an embodiment of the present invention, a node coordinate distance constraint rule may be used to constrain the coordinate distance between multiple node coordinates. For example, a possible node coordinate distance constraint rule may be expressed as:
[0085]
[0086] The above node coordinate distance constraint rule means that any node coordinate ( , ) and any other node coordinates ( , ) is limited to d. This can effectively avoid the situation where the distance between node coordinates is too small, resulting in too dense distribution of target states in the generated state diagram, which helps to improve the readability of the state diagram.
[0087] It should be noted that the above node coordinate distance constraint rule also limits the maximum distance between node coordinates, thereby effectively avoiding the excessively large distance between node coordinates that causes the target states in the generated state diagram to be too sparsely distributed, and can also improve the readability of the state diagram.
[0088] Optionally, in an embodiment of the present invention, the node coordinate distance constraint rule may include at least one of an arbitrary node distance constraint and an adjacent node distance constraint. Among them, the arbitrary node distance constraint can be used to constrain the distance between the node coordinates corresponding to any two nodes, for example, the distance between any two node coordinates is greater than or equal to 1. For example, the adjacent node distance constraint may be: the distance between the node coordinates corresponding to two adjacent nodes is less than or equal to dl (for example, 10). By setting the adjacent node distance constraint, the length of the connecting line in the generated state diagram can be limited to avoid the appearance of too short or too long connecting lines, which helps to improve the readability of the state diagram.
[0089] In an embodiment of the present invention, the adjacent node connection line constraint rule is used to constrain the relative distance and relative angle between the connection line of the node coordinates of the first adjacent node pair and the connection line of the node coordinates of the second adjacent node pair. Wherein, the adjacent node pair represents two nodes directly connected by an edge, the first adjacent node pair can represent any pair of adjacent nodes in the target network diagram, the second adjacent node pair represents any pair of adjacent nodes in the target network diagram except the first adjacent node pair, and the connection line of the node coordinates of the adjacent node pair represents the connection line between the node coordinates corresponding to the two adjacent nodes. Exemplarily, a possible adjacent node connection line constraint rule can be expressed as follows: for each first adjacent node pair, there is at least one node coordinate in the connection line e1 between the two node coordinates of the first adjacent node pair, which does not overlap with the connection line e2 between the two node coordinates of any second adjacent node pair. The adjacent node connection constraint rule can be used to limit the relative angle between the connection lines formed by any two adjacent node pairs to be greater than 0, or the relative angle is equal to 0 and the relative distance is greater than 0, thereby ensuring that the connection lines formed by any two adjacent node pairs will not overlap, which helps to increase the readability of the subsequently generated state diagram.
[0090] By setting the above adjacent node connection constraint rules, it is possible to avoid mutual interference between connection lines in the subsequently generated state diagram to a certain extent, thereby affecting user observation and helping to improve the readability of the state diagram.
[0091] It should be noted that the above node coordinate constraint rules can be further converted into SMT language before being input into the satisfiability model theory solver. For example, if the node coordinate range constraint rule is , it can be converted into the following SMT language:
[0092] (assert (> x0))
[0093] (assert (> y0))
[0094] (assert( <x10))
[0095] (assert (< y10)).
[0096] Among them, the assert statement is used to add a logical expression as a constraint rule. > x0 means that the constraint is x greater than 0, < x10 means that the constraint is x less than 10, and so on.
[0097] In some embodiments, the step of generating the state diagram corresponding to the target state set based on the node coordinate values and the edges may specifically include:
[0098] Step A1, determining the node distance of the adjacent node pair according to the node coordinate values.
[0099] In the embodiments of the present invention, since the adjacent node pairs need to generate corresponding connection lines, and the lengths of the connection lines may vary and the number is large, in order to further improve the readability of the state diagram, different styles of connection lines can be drawn for adjacent node pairs with different distances during the drawing of the connection lines.
[0100] Specifically, the node distance of the adjacent node pair can be calculated according to the node coordinate values. For example, an adjacent node pair includes node A1 and node B1, the node coordinate value obtained by solving node A1 is (1, 2), and the node coordinate value obtained by solving node B2 is (4, 6), then the node distance of this adjacent node pair is 5.
[0101] Step A2, determining the connection line style between the adjacent node pairs based on the node distance; wherein, the connection line style includes at least one of the connection line color, the connection line width, and the connection line form.
[0102] In the embodiments of the present invention, the connection line style between the adjacent node pairs can be determined according to the node distance of the adjacent node pairs. Among them, the connection line style can include but is not limited to at least one of the connection line color (such as red, black, blue, etc.), the connection line width, and the connection line form (such as solid line, dotted line, dot-dash line), and the embodiments of the present invention do not make specific limitations.
[0103] Specifically, the corresponding relationship between multiple distance ranges and different connection line styles can be preset. After obtaining the node distance of the adjacent node pair, the connection line style corresponding to the distance range including the node distance can be obtained based on the above corresponding relationship. The corresponding relationship between m distance intervals and different connection line styles can also be preset. First, the maximum distance and the minimum distance can be determined from the node distances of all adjacent node pairs, the distance range can be determined according to the maximum distance and the minimum distance, the distance range can be equally divided into m distance intervals, and then for the node distance of each adjacent node pair, the distance interval it belongs to can be determined, and the connection line style corresponding to this distance interval can be obtained based on the above corresponding relationship.
[0104] Step A3, generating a state mark of the target state based on the node coordinate values corresponding to the target state, generating connecting lines between the state marks based on the connecting line styles, and obtaining the state diagram.
[0105] In an embodiment of the present invention, a state mark can be generated at a corresponding position in the coordinate system according to the node coordinate value of the node corresponding to the target state in the target network diagram, and a connecting line in the style of a connecting line of the adjacent node pair can be generated between the state mark pairs corresponding to the adjacent node pairs according to the edges between the nodes corresponding to the state mark.
[0106] Optionally, corresponding state transition condition text description information may be added to each connection line in the state diagram according to the state transition condition corresponding to the connection line, thereby further improving the information richness of the state diagram.
[0107] In an embodiment of the present invention, the node distance of the adjacent node pair is determined according to the node coordinate value; the connection line style between the adjacent node pairs is determined based on the node distance; wherein the connection line style includes at least one of the connection line color, connection line width, and connection line shape; the state mark of the target state is generated based on the node coordinate value corresponding to the target state, and the connection line between the state marks is generated based on the connection line style to obtain a state diagram. In this way, the migration process between each target state can be represented in the state diagram by connecting lines of various styles, which helps to improve the intuitiveness and information display efficiency of the state diagram.
[0108] Reference Figure 4 , shows a flowchart of another state diagram generation method provided by an embodiment of the present invention, such as Figure 4 As shown, the method may specifically include the following steps:
[0109] Step 201, obtaining a target network graph corresponding to a target state set; wherein the nodes in the target network graph represent target states in the target state set, and the edges in the target network graph represent state transition relationships between the target states.
[0110] This step can refer to step 101, and will not be described in detail in this embodiment of the present invention.
[0111] Step 202 , when the node coordinate constraint rule includes a node coordinate range constraint rule, obtain the total state quantity of the target state set and the average character quantity of the state identifier of the target state.
[0112] In the embodiment of the present invention, different target state sets have different characteristics, such as different total state amounts. In order to generate high-quality state graphs for target state sets with different characteristics, node coordinate constraint rules with high adaptability can be generated specifically according to the characteristics of the target state sets.
[0113] Specifically, if the node coordinate constraint rule includes a node coordinate range constraint rule, the total state quantity of the target state set and the average number of characters of the state identifier of the target state can be determined, and the node coordinate range constraint rule is determined according to the total state quantity and the average number of characters of the state identifier. The total state quantity represents the total number of target states included in the target state set, and the average number of characters of the state identifier represents the average number of characters of the state identifier corresponding to each target state included in the target state set.
[0114] Step 203: Determine the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule based on the total state amount and the average character amount of the state identifier.
[0115] In an embodiment of the present invention, since the state diagram needs to display the state marks corresponding to all target states in the target state set, and the state diagram can also display the state identifiers of the target states corresponding to each state mark, in order to avoid congestion of state marks and state identifiers in the state diagram, the horizontal axis range and the vertical axis range of the node coordinate range constraint rule can be determined based on the total state amount and the average character amount of the state identifier.
[0116] Specifically, in one embodiment, a coordinate range model can be pre-constructed, and the coordinate range model can output the corresponding horizontal coordinate range and vertical coordinate range according to the input total state amount and the average number of characters of the state identification. The input and output of the coordinate range model can have a positive correlation, that is, the larger the input total state amount and the average number of characters of the state identification, the larger the output horizontal coordinate range and vertical coordinate range. It should be noted that the horizontal coordinate range and vertical coordinate range output by the above-mentioned coordinate range model can be the same value or different values, and the embodiment of the present invention does not specifically limit this.
[0117] In another embodiment, a first coordinate range model and a second coordinate range model can be pre-constructed, the first coordinate range model can output a first horizontal coordinate range and a first vertical coordinate range according to the total amount of the input state, and the second coordinate range model can output a second horizontal coordinate range and a second vertical coordinate range according to the average character amount of the input state identifier, and then the first horizontal coordinate range and the second horizontal coordinate range can be averaged or weighted averaged to obtain the horizontal coordinate range of the node coordinate range constraint rule, and the first vertical coordinate range and the second vertical coordinate range can be averaged or weighted averaged to obtain the vertical coordinate range of the node coordinate range constraint rule; a larger range can also be selected from the first horizontal coordinate range and the second horizontal coordinate range as the horizontal coordinate range of the node coordinate range constraint rule, and a larger range can be selected from the first vertical coordinate range and the second vertical coordinate range as the vertical coordinate range of the node coordinate range constraint rule. The above-mentioned coordinate range model may include but is not limited to a mathematical model, a rule model, a machine learning model, etc., and the embodiment of the present invention is not specifically limited.
[0118] In the embodiment of the present invention, when the node coordinate constraint rule includes the node coordinate range constraint rule, the total state amount of the target state set and the average character amount of the state identifier of the target state are determined; based on the total state amount and the average character amount of the state identifier, the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule are determined. The node coordinate range constraint rule can be adapted to the total state amount and the state identifier length of the target state set, so that the generated state diagram can have a more reasonable size, which helps to improve the readability of the state diagram.
[0119] Step 204, when the node coordinate constraint rule includes an adjacent node connection constraint rule, obtain the total state quantity of the target state set and the total edge quantity in the target network graph.
[0120] In an embodiment of the present invention, since the state diagram also includes connecting lines, and the total amount of connecting lines is related to the total amount of edges in the target network diagram, the larger the total amount of edges, the higher the density of connecting lines in the state diagram. In addition, the larger the total amount of states in the target state set, the greater the state marking density in the state diagram. Therefore, when the node coordinate constraint rules include adjacent node connection constraint rules, the total amount of states of the target state set and the total amount of edges of the state transition relationship can be determined, and then the appropriate node coordinate constraint rules can be determined based on the total amount of states and the total amount of edges.
[0121] Step 205: determine the node density based on the abscissa range, the ordinate range and the total amount of states, and determine the edge density based on the abscissa range, the ordinate range and the total amount of edges.
[0122] In an embodiment of the present invention, the horizontal axis range and the vertical axis range of the node coordinate range constraint rule can limit the size of the state diagram, and the total state quantity limits the total amount of state marks in the state diagram. Therefore, the node range area can be calculated according to the horizontal axis range and the vertical axis range of the node coordinate range constraint rule, and then the ratio between the node range area and the total state quantity is calculated to obtain the node density.
[0123] For example, if the horizontal axis range and the vertical axis range are both 100, and the total state amount is 500, then the corresponding node density can be calculated to be 100*100 / 500=20. That is, in the generated state diagram, each unit area contains an average of 20 node markers.
[0124] Step 206, determining the relative distance lower limit value and the relative angle lower limit value of the adjacent node connection constraint rule based on the node density and the edge density; wherein the relative distance lower limit value is used to constrain the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and the relative angle lower limit value is used to constrain the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair.
[0125] In an embodiment of the present invention, the node density and edge density can reflect the degree of crowding of graphic elements in the subsequently generated state diagram. If the node density and edge density are high, a larger relative distance lower limit value and a larger relative angle lower limit value can be set to make the connecting lines in the generated state diagram easier to observe. Otherwise, a smaller relative distance lower limit value and a smaller relative angle lower limit value can be set to reduce the difficulty of solving the node coordinates and improve the efficiency of solving the node coordinates.
[0126] In an embodiment of the present invention, the relative distance lower limit value and the relative angle lower limit value of the adjacent node connection constraint rule can be determined based on the node density and the edge density. The relative distance lower limit value is used to constrain the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and the relative angle lower limit value is used to constrain the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair.
[0127] Specifically, in one embodiment, a lower limit value model can be pre-constructed, and the lower limit value model can output corresponding relative distance lower limit values and relative angle lower limit values according to the input node density and edge density. The input and output of the lower limit value model can have a positive correlation, that is, the greater the input node density and edge density, the greater the output relative distance lower limit values and relative angle lower limit values.
[0128] In another embodiment, a first lower limit value model and a second lower limit value model can be pre-constructed, and the first lower limit value model can output a first relative distance lower limit value and a first relative angle lower limit value according to the input node density, and the second lower limit value model can output a second relative distance lower limit value and a second relative angle lower limit value according to the input edge density, and then the first relative distance lower limit value and the second relative distance lower limit value can be averaged or weighted averaged to obtain the relative distance lower limit value of the adjacent node connection constraint rule, and the first relative angle lower limit value and the second relative angle lower limit value can be averaged or weighted averaged to obtain the relative angle lower limit value of the adjacent node connection constraint rule; a larger range can also be selected from the first relative distance lower limit value and the second relative distance lower limit value as the relative distance lower limit value of the adjacent node connection constraint rule, and a larger range can be selected from the first relative angle lower limit value and the second relative angle lower limit value as the relative angle lower limit value of the adjacent node connection constraint rule. The above-mentioned lower limit value model can include but is not limited to a mathematical model, a rule model, a machine learning model, etc., and the embodiment of the present invention is not specifically limited.
[0129] In an embodiment of the present invention, when the node coordinate constraint rule includes the adjacent node connection constraint rule, the total state amount of the target state set and the total edge amount in the target network diagram can be determined; the node density can be determined based on the horizontal coordinate range, the vertical coordinate range and the total state amount, and the edge density can be determined based on the horizontal coordinate range, the vertical coordinate range and the total edge amount; the relative distance lower limit value and the relative angle lower limit value of the adjacent node connection constraint rule can be determined based on the node density and the edge density. In this way, a larger relative distance lower limit value and a larger relative angle lower limit value can be set when the node density and edge density are high, thereby improving the readability of the state diagram generated subsequently; a smaller relative distance lower limit value and a smaller relative angle lower limit value can be set when the node density and edge density are low, thereby reducing the difficulty of solving the node coordinates and improving the efficiency of solving the node coordinates subsequently.
[0130] Step 207, input the node coordinate constraint rules corresponding to the target state set and the target network diagram into the satisfiability model theory solver, and obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules.
[0131] This step can be referred to as step 102, and will not be described in detail in this embodiment of the present invention.
[0132] It should be noted that, in the embodiment of the present invention, the node coordinate constraint rules can be input into the satisfiability model theory solver in the form of SMT language. For example, an example of an SMT language input into the satisfiability model theory solver can be as follows:
[0133] Set the logical type to quantifier-free linear integer expression:
[0134] (set-logic QF_LIA);
[0135] Declare an integer variable x to record the node's horizontal coordinate value:
[0136] (declare-fun x()Int);
[0137] Declare another integer variable y to record the horizontal coordinate value of the node:
[0138] (declare-fun y()Int);
[0139] Declare the variable total-distance to record the total distance of adjacent nodes:
[0140] (declare-fun total-distance()Real);
[0141] The SMT language form for writing node coordinate range constraint rules:
[0142] (assert(>x 0));
[0143] (assert(>y 0));
[0144] (assert( <x 10));
[0145] (assert( <y 10));
[0146] Write the SMT language form of the adjacent node distance sum target:
[0147] (minimize(total-distance);
[0148] Check satisfiability statement:
[0149] (check-sat);
[0150] Get the values of variables x and y to get the node coordinates:
[0151] (get-value(xy)).
[0152] Step 208: Generate a state graph corresponding to the target state set based on the node coordinate values and the edges.
[0153] This step can refer to step 103, and will not be described in detail in this embodiment of the present invention.
[0154] In some embodiments, the step of generating a state graph corresponding to the target state set based on the node coordinate values and the edges may specifically include:
[0155] Step B1, generating corresponding state marks based on the node coordinate values in a three-dimensional coordinate system, generating connecting lines of the state marks based on the edges in the three-dimensional coordinate system, and obtaining a state three-dimensional model.
[0156] In an embodiment of the present invention, the node coordinate values can be solved as three-dimensional coordinate values, and accordingly, the above-mentioned node coordinate constraint rules can be constraint rules applicable to three-dimensional coordinates. Corresponding state marks can be generated based on the node coordinate values in the three-dimensional coordinate system, and connecting lines of corresponding state marks can be generated based on the edges between nodes in the target network diagram in the three-dimensional coordinate system to obtain a state three-dimensional model. It should be noted that the connection line style in the state three-dimensional model can also be determined based on the node distance of adjacent node pairs in the three-dimensional coordinate system, that is, connection lines of different lengths can correspond to different connection line styles, which will not be repeated in the embodiment of the present invention.
[0157] Step B2: acquiring a state diagram corresponding to the target state set based on the state three-dimensional model.
[0158] In an embodiment of the present invention, a state diagram corresponding to a target state set can be obtained based on a state three-dimensional model. Specifically, the target number of state diagrams can be generated as needed, target viewpoints for the target number of three-dimensional models can be determined, and then two-dimensional images corresponding to the state three-dimensional model can be rendered at each target viewpoint to obtain multiple state diagrams corresponding to the target state set.
[0159] Among them, the above-mentioned target number can be a preset value (for example, 3), or can be set by the user for the target state set, or can be generated according to the size of the state three-dimensional model, so that a larger state three-dimensional model corresponds to a higher number of targets, which is not specifically limited in the embodiment of the present invention.
[0160] In an embodiment of the present invention, a corresponding state mark is generated based on the node coordinate value in a three-dimensional coordinate system, and a connecting line of the corresponding state mark is generated based on the edge between nodes in the target network diagram in the three-dimensional coordinate system to obtain a state three-dimensional model, and a state diagram corresponding to the target state set is obtained based on the state three-dimensional model. In this way, a state three-dimensional model can be generated through three-dimensional node coordinate values. Since the three-dimensional model can display the complex migration relationship between each target state from a higher dimension, the state diagram generated based on the state three-dimensional model can more accurately show the migration relationship between the target states, further improving the readability of the state diagram.
[0161] Optionally, in some embodiments, the step of acquiring a state diagram corresponding to the target state set based on the state three-dimensional model may specifically include:
[0162] Determine multiple target viewpoints corresponding to the state three-dimensional model; wherein the state mark in the state three-dimensional model does not overlap with the connection path between the same target viewpoint, and the connection path does not overlap with the connection line, and render the two-dimensional images corresponding to the state three-dimensional model based on the multiple target viewpoints to obtain a state diagram.
[0163] In an embodiment of the present invention, in order to enable the user to more effectively observe the state transition characteristics of the target state set through the state diagram, a state diagram of multiple different viewpoints can be generated according to the state three-dimensional model. Specifically, the multiple target viewpoints corresponding to the state three-dimensional model can be first determined, and the connection paths between each target viewpoint and each state mark in the state three-dimensional model can be made non-overlapping, so that each state mark in the state three-dimensional model observed from the target viewpoint will not be blocked by other state marks; it can also be made that the connection paths between each target viewpoint and each state mark in the state three-dimensional model do not pass through all the connection lines in the state three-dimensional model, so that each state mark in the state three-dimensional model observed from the target viewpoint will not be blocked by the connection lines. Among them, the number of viewpoints of multiple target viewpoints can be flexibly set according to actual business needs, and the embodiment of the present invention does not make specific limitations.
[0164] Specifically, generate viewpoint coordinate constraint rules corresponding to the above-mentioned restriction conditions for the target viewpoint, input the viewpoint coordinate constraint rules and the above-mentioned state three-dimensional model into the satisfiability model theory solver, and use the satisfiability model theory solver to solve multiple viewpoint coordinates that satisfy the above-mentioned viewpoint coordinate constraint rules in the three-dimensional coordinate system where the state three-dimensional model is located to obtain the above-mentioned target viewpoint.
[0165] In the embodiment of the present invention, after obtaining multiple target viewpoints, the state three-dimensional model can be rendered for each target viewpoint to obtain a two-dimensional image of the state three-dimensional model at the target viewpoint, and the two-dimensional image can be directly used as a state diagram, or the two-dimensional image can be post-processed to obtain the state diagram. The above post-processing may include but is not limited to at least one of adding a state identifier, zooming in, zooming out, upsampling, downsampling, etc., which is not specifically limited in the embodiment of the present invention.
[0166] Specifically, the state three-dimensional model and the target viewpoint can be input into computer graphics software or a 3D rendering engine (such as Blender), and the state three-dimensional model can be rendered based on the target viewpoint by the computer graphics software or the 3D rendering engine to obtain a two-dimensional image corresponding to the target viewpoint.
[0167] In the embodiment of the present invention, multiple target viewpoints corresponding to the state three-dimensional model can be determined; wherein the state mark in the state three-dimensional model does not overlap with the connection path between the same target viewpoint, and the connection path does not overlap with the connection line, and the two-dimensional images corresponding to the state three-dimensional model are rendered based on the multiple target viewpoints to obtain a state diagram. In this way, the state diagram rendered based on the target viewpoint can have a high readability.
[0168] In summary, in another state diagram generation method provided by an embodiment of the present invention, a target network diagram corresponding to a target state set is obtained; wherein, the nodes in the target network diagram represent the target states in the target state set, and the edges in the target network diagram represent the state transition relationship between the target states; the node coordinate constraint rules corresponding to the target state set and the target network diagram are input into the satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; and a state diagram corresponding to the target state set is generated based on the node coordinate values and the edges. In this way, visualization operations on a large number of state sets are realized, and the state positions can be solved through the satisfiability modulus theory, so that users can flexibly and conveniently set complex constraints for the solution process, and the complex constraints can be accurately processed through the satisfiability modulus theory to automatically generate a state diagram layout that meets user needs, which helps to improve the efficiency of generating state diagrams corresponding to massive states.
[0169] Reference Figure 5 , shows a block diagram of a state diagram generating device provided by an embodiment of the present invention, such as Figure 5 As shown, the device may specifically include:
[0170] The target network graph module 301 is used to obtain a target network graph corresponding to a target state set; wherein the nodes in the target network graph represent target states in the target state set, and the edges in the target network graph represent state transition relationships between the target states;
[0171] The node coordinate module 302 is used to input the node coordinate constraint rules corresponding to the target state set and the target network diagram into the satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules;
[0172] The state diagram module 303 is used to generate a state diagram corresponding to the target state set based on the node coordinate values and the edges.
[0173] Optionally, the node coordinate module is also used to input the solution targets corresponding to the node coordinate constraint rules, the target network diagram and the target state set into the satisfiability model theory solver, so that the satisfiability model theory solver solves multiple sets of pending node coordinate sets based on the node coordinate constraint rules and the target network diagram, and determines the target node coordinate set from the multiple sets of pending node coordinate sets based on the solution targets, and outputs the node coordinate values corresponding to each node contained in the target node coordinate set.
[0174] Optionally, the target network diagram includes at least one of a source node corresponding to the starting state in the target state set and a directed edge indicating the direction of state migration between target states; wherein the source node is used to indicate the starting solution node to the satisfiability model theory solver, and the directed edge is used to indicate the solution traversal direction to the satisfiability model theory solver.
[0175] Optionally, the node coordinate constraint rules include at least one of node coordinate range constraint rules, node coordinate distance constraint rules, and adjacent node connection line constraint rules; wherein the node coordinate range constraint rules are used to constrain the coordinate range of node coordinates, the node coordinate distance constraint rules are used to constrain the coordinate distance between multiple node coordinates, and the adjacent node connection line constraint rules are used to constrain the relative distance and relative angle between the connecting line of the node coordinates of the first adjacent node pair and the connecting line of the node coordinates of the second adjacent node pair.
[0176] Optionally, the node coordinate distance constraint rule includes at least one of an arbitrary node distance constraint condition and a related node distance constraint condition.
[0177] Optionally, the device further comprises:
[0178] A first acquisition module, configured to acquire the total state quantity of the target state set and the average number of characters of the state identifier of the target state when the node coordinate constraint rule includes a node coordinate range constraint rule;
[0179] The range determination module is used to determine the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule based on the state total amount and the average character amount of the state identifier.
[0180] Optionally, the device further comprises:
[0181] A second acquisition module is used to acquire the total state amount of the target state set and the total edge amount in the target network graph when the node coordinate constraint rule includes an adjacent node connection constraint rule;
[0182] A density determination module, configured to determine the node density based on the abscissa range, the ordinate range and the total amount of states, and to determine the edge density based on the abscissa range, the ordinate range and the total amount of edges;
[0183] A lower limit value determination module is used to determine the relative distance lower limit value and the relative angle lower limit value of the adjacent node connection constraint rule based on the node density and the edge density; wherein the relative distance lower limit value is used to constrain the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and the relative angle lower limit value is used to constrain the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair.
[0184] Optionally, the state diagram module includes:
[0185] A node distance submodule, used to determine the node distance of adjacent node pairs according to the node coordinate values;
[0186] A connection line style submodule, used to determine the connection line style between the adjacent node pairs based on the node distance; wherein the connection line style includes at least one of the connection line color, connection line width, and connection line shape;
[0187] The first state diagram generating submodule is used to generate a state mark of the target state based on the node coordinate value corresponding to the target state, and to generate a connecting line between the state marks based on the connecting line style to obtain the state diagram.
[0188] Optionally, the node coordinate value includes a three-dimensional coordinate value, and the state diagram module includes:
[0189] A state three-dimensional model submodule, used to generate corresponding state marks based on the node coordinate values in a three-dimensional coordinate system, and to generate connecting lines of the state marks based on the edges in the three-dimensional coordinate system to obtain a state three-dimensional model;
[0190] The state diagram acquisition submodule is used to acquire the state diagram corresponding to the target state set based on the state three-dimensional model.
[0191] In summary, in the state diagram generation device provided by the embodiment of the present invention, a target network diagram corresponding to the target state set is obtained; wherein the nodes in the target network diagram represent the target states in the target state set, and the edges in the target network diagram represent the state transition relationship between the target states; the node coordinate constraint rules corresponding to the target state set and the target network diagram are input into the satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; and a state diagram corresponding to the target state set is generated based on the node coordinate values and the edges. In this way, visualization operations on a large number of state sets are realized, and the state positions can be solved through the satisfiability modulus theory, so that users can flexibly and conveniently set complex constraints for the solution process, and the complex constraints can be accurately processed through the satisfiability modulus theory to automatically generate a state diagram layout that meets user needs, which helps to improve the efficiency of generating state diagrams corresponding to massive states.
[0192] Reference Figure 6 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the state diagram generation method of the above embodiment. The executable instructions can form a program.
[0193] An embodiment of the present invention provides a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the state diagram generating method of the aforementioned embodiment.
[0194] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0195] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. It should be noted that all actions of acquiring signals, information or data in the present invention are carried out under the premise of complying with the corresponding data protection laws and policies of the country of residence and with the authorization given by the owner of the corresponding device. The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0196] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0198] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0199] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0200] The above is a detailed introduction to a state diagram generation method, a state diagram generation device, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a general technician in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A state diagram generation method, characterized in that: The method comprises: Obtain a target network graph corresponding to the target state set; wherein the nodes in the target network graph represent the target states in the target state set, and the edges in the target network graph represent the state transition relationship between the target states; Input the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver to obtain node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules; Generate a state graph corresponding to the target state set based on the node coordinate values and the edges; The node coordinate constraint rules include node coordinate range constraint rules and adjacent node line constraint rules; wherein the adjacent node line constraint rules include a relative distance lower limit value for constraining the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and a relative angle lower limit value for constraining the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair; Before inputting the node coordinate constraint rules corresponding to the target state set and the target network diagram into the satisfiability model theory solver, the method further includes: Determine the node density based on the total state amount of the target state set, the abscissa range and the ordinate range of the node coordinate range constraint rule, and determine the edge density based on the abscissa range, the ordinate range and the total amount of edges in the target network graph; The relative distance lower limit value and the relative angle lower limit value are determined based on the node density and the edge density.
2. The method according to claim 1, characterized in that The step of inputting the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver to obtain the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver includes: The node coordinate constraint rules, the target network diagram and the solution target corresponding to the target state set are input into the satisfiability model theory solver, so that the satisfiability model theory solver solves multiple groups of pending node coordinate sets based on the node coordinate constraint rules and the target network diagram, and determines the target node coordinate set from the multiple groups of pending node coordinate sets based on the solution target, and outputs the node coordinate values corresponding to each node contained in the target node coordinate set.
3. The method according to claim 1, characterized in that The target network diagram includes at least one of a source node corresponding to the starting state in the target state set and a directed edge indicating the state migration direction between target states; wherein the source node is used to indicate the starting solution node to the satisfiability model theory solver, and the directed edge is used to indicate the solution traversal direction to the satisfiability model theory solver.
4. The method according to claim 1, characterized in that: The node coordinate constraint rule includes a node coordinate distance constraint rule; wherein the node coordinate distance constraint rule is used to constrain the coordinate distance between multiple node coordinates.
5. The method according to claim 4, characterized in that The node coordinate distance constraint rule includes at least one of an arbitrary node distance constraint condition and a related node distance constraint condition.
6. The method according to claim 1, characterized in that Before inputting the node coordinate constraint rules corresponding to the target state set and the target network graph into the satisfiability model theory solver, the method further includes: Acquire the total state quantity of the target state set and the average number of characters of the state identifier of the target state; Based on the state total amount and the average character amount of the state identifier, the horizontal coordinate range and the vertical coordinate range of the node coordinate range constraint rule are determined.
7. The method according to claim 1, characterized in that The generating a state graph corresponding to the target state set based on the node coordinate values and the edges includes: Determine the node distance between adjacent node pairs according to the node coordinate values; Determine a connection line style between the adjacent node pairs based on the node distance; wherein the connection line style includes at least one of a connection line color, a connection line width, and a connection line shape; A state mark of the target state is generated based on the node coordinate value corresponding to the target state, and a connecting line between the state marks is generated based on the connecting line style to obtain the state diagram.
8. The method according to claim 1, characterized in that: The node coordinate values include three-dimensional coordinate values, and the state graph corresponding to the target state set is generated based on the node coordinate values and the edges, including: Generate corresponding state marks based on the node coordinate values in a three-dimensional coordinate system, and generate connecting lines of the state marks based on the edges in the three-dimensional coordinate system to obtain a state three-dimensional model; A state diagram corresponding to the target state set is obtained based on the state three-dimensional model.
9. A state diagram generating device, characterized in that: The device comprises: A target network graph module is used to obtain a target network graph corresponding to a target state set; wherein the nodes in the target network graph represent target states in the target state set, and the edges in the target network graph represent state transition relationships between the target states; A node coordinate module, used for inputting the node coordinate constraint rules corresponding to the target state set and the target network diagram into a satisfiability model theory solver, and obtaining the node coordinate values corresponding to each node in the target network diagram output by the satisfiability model theory solver; wherein the node coordinate values satisfy the node coordinate constraint rules; the node coordinate constraint rules include node coordinate range constraint rules and adjacent node connection constraint rules; wherein the adjacent node connection constraint rules include a relative distance lower limit value for constraining the relative distance between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair, and a relative angle lower limit value for constraining the relative angle between the node coordinate connection line of the first adjacent node pair and the node coordinate connection line of the second adjacent node pair; A state diagram module, used for generating a state diagram corresponding to the target state set based on the node coordinate values and the edges; A density determination module, configured to determine the node density based on the total state amount of the target state set, the abscissa range and the ordinate range of the node coordinate range constraint rule, and determine the edge density based on the abscissa range, the ordinate range and the total amount of edges in the target network graph; A lower limit value determination module is used to determine the lower limit value of the relative distance and the lower limit value of the relative angle based on the node density and the edge density.
10. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: Instructions are stored thereon, which, when executed by one or more processors, cause the processors to perform the method as claimed in any one of claims 1 to 8.