A method for reconstructing the execution path of behavioral rules for incomplete action sets
Through the behavioral rule execution path reconstruction method for incomplete action sets, the problem of insufficient simulation capabilities caused by incomplete basic action sets is solved, automatic cutting of rule logic is realized, simulation capabilities are quickly formed, the development cycle is shortened, and it is suitable for urgent needs scenarios.
Patent Information
- Application Number
- CN202410992755.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-24
AI Technical Summary
In agent-based simulation, incomplete basic action sets will affect the execution of the behavior rule layer, causing the user-required application layer to fail to run normally. Existing solutions cannot be applied to urgent need scenarios due to their long development cycles.
Provides a behavior rule execution path reconstruction method for incomplete action sets. By obtaining the invalid components in the initial execution path, traversing the target components that their data depends on, determining the set of invalid components, and trimming them based on whether they affect the connectivity of the execution path. , automatically generates reconstruction execution paths, bypasses basic actions that are not yet supported, and quickly develops simulation capabilities.
It realizes automatic and rapid tailoring of rule logic, bypasses basic actions that are not yet supported, shortens the development cycle, quickly forms simulation capabilities, and enables simulation experiments to be executed as quickly as possible.
Smart Images

Figure CN118520708B
Abstract
Description
Technical Field
[0001] The present application relates to the field of simulation technology, and in particular to a method for reconstructing a behavior rule execution path for an incomplete action set. Background Art
[0002] Agent-Based Simulation is one of the most important means in the field of system simulation modeling. This modeling method has unique advantages for systems with multiple and complex interactions. Agent-based simulation often first establishes a virtual environment to represent the internal environment of the modeled object in the real world; the active entities in the virtual environment are called agents, representing the people, families, vehicles or equipment in the modeled object, and simulation is performed by establishing interactions between agents and between agents and virtual environments. Compared with abstract system dynamics methods or process-centric discrete event modeling methods, agent-based simulation can accurately depict the interaction process between different agents in the system, and can reflect the dynamic changes and inherent characteristics of the real-world system, making it more superior in understanding, managing or designing complex systems.
[0003] The key to agent-based simulation is the control of agent behavior. According to the order of behavior control logic from objective to subjective, it is usually divided into three levels: agent basic actions, behavior rules, and application methods. Among them, the bottom layer is the agent's basic actions, that is, the most basic behavior of the agent itself; above this is the agent's behavior rules, which are action patterns with certain universality based on the encapsulation of several basic actions; the top layer is the agent's application method, which is based on a combination of several action styles and represents the most subjective application method of the agent controller.
[0004] In the above control hierarchy, the basic action layer is the foundation. If the basic actions are incomplete, it will affect the execution of the behavior rule layer, and then affect the user's required application method layer. For the problem of incomplete basic action set, the existing solution is relatively intuitive, that is, the required basic actions are developed and completed before simulation, but this method may not be applicable to urgent scenarios due to the long development cycle. Summary of the invention
[0005] Based on this, it is necessary to provide a behavior rule execution path reconstruction method for incomplete action sets to address the above technical problems, bypass basic actions that are not currently supported, quickly form simulation capabilities, realize the execution of simulation experiments as quickly as possible, and shorten the development cycle.
[0006] The present application provides a behavior rule execution path reconstruction method for an incomplete action set, the method comprising:
[0007] Get the initial execution path of the behavior rules;
[0008] Taking the invalid component existing in the initial execution path as a starting point, traversing the initial execution path, and obtaining at least one target component having data dependency with the invalid component;
[0009] Determine an invalid component set according to the invalid component and the at least one target component;
[0010] If the invalid component set does not affect the connectivity of the initial execution path, the basic components in the invalid component set are deleted to obtain a reconstructed execution path of the behavior rule.
[0011] Wherein, the method further comprises:
[0012] According to the reconstructed execution path of the behavior rule, program code corresponding to the behavior rule is automatically generated.
[0013] Wherein, the method further comprises:
[0014] If the invalid component set affects the connectivity of the initial execution path of the behavior rule, a prompt signal is output to prompt that the invalid components are missing from the basic component set.
[0015] The step of traversing the initial execution path with the invalid component existing in the initial execution path as a starting point to obtain at least one target component having data dependency with the invalid component further includes:
[0016] respectively comparing the output of the invalid component with the input of the basic component in the initial execution path;
[0017] If the output of the invalid component is the input of the basic component, the basic component is used as the target component.
[0018] The initial execution path of the behavior rule further includes a start component and an end component; the method further includes:
[0019] If there are other connected paths between the start component and the end component except the invalid component set, determining that the invalid component set does not affect the connectivity of the initial execution path;
[0020] If there is no other connected path between the start component and the end component except the invalid component set, it is determined that the invalid component set affects the connectivity of the initial execution path.
[0021] Wherein, the method further comprises:
[0022] Determine a current component, where the current component is a component selected from a set of connected components, where an initial value of the set of connected components is a start component;
[0023] Determine whether the successor component of the current component is a component in the invalid component set;
[0024] If the successor component of the current component is not a component in the invalid component set, then the successor component of the current component is added to the connected component set;
[0025] Return to the step of determining the current component until the successor component of the current component is the end component, and determine that there are other connected paths between the start component and the end component except the invalid component set.
[0026] If the successor component of the current component is a component in the invalid component set, it is determined that no other connection paths other than the invalid component set exist between the start component and the end component.
[0027] Wherein, the method further comprises:
[0028] After adding the successor component of the current component to the connected component set, the current component is deleted from the connected component set.
[0029] The initial execution path and the reconstructed execution path each include at least one basic component, and the at least one basic component is connected in sequence according to a specified logical order.
[0030] The above-mentioned behavior rule execution path reconstruction method for incomplete action sets can automatically and quickly tailor the rule logic according to the support of the underlying basic actions, thereby bypassing the basic actions that are not currently supported, quickly forming simulation capabilities, realizing the execution of simulation experiments as soon as possible, and shortening the development cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is an agent-based simulation control hierarchy and example diagram in one embodiment;
[0032] Figure 2 A flowchart of a method for reconstructing a behavior rule execution path for an incomplete action set in one embodiment;
[0033] Figure 3 A schematic diagram of a flow chart of connectivity analysis of a behavior rule execution path in one embodiment;
[0034] Figure 4 This is a flowchart of an application method of a fixed-point photography function in one embodiment;
[0035] Figure 5 for Figure 4 Schematic diagram of the initial execution path of the flight rules;
[0036] Figure 6 for Figure 5 Schematic diagram of the reconstructed execution path of the flight rules;
[0037] Figure 7 The figure is a flow chart of a method for reconstructing a behavior rule execution path for an incomplete action set in one embodiment. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0039] Agent-Based Simulation is one of the most important means in the field of system simulation modeling. This modeling method has unique advantages for systems with multiple and complex interactions. Agent-based simulation often first establishes a virtual environment to represent the internal environment of the modeled object in the real world; the active entities in the virtual environment are called agents, representing the people, families, vehicles or equipment in the modeled object, and simulation is performed by establishing interactions between agents and between agents and virtual environments. Compared with abstract system dynamics methods or process-centric discrete event modeling methods, agent-based simulation can accurately depict the interaction process between different agents in the system, and can reflect the dynamic changes and inherent characteristics of the real-world system, making it more superior in understanding, managing or designing complex systems.
[0040] The key to agent-based simulation is the control of agent behavior. According to the order of behavior control logic from objective to subjective, it is usually divided into three levels: agent basic actions, behavior rules, and application methods. Figure 1As shown on the left. Among the three layers of logic, the lower layer is the control basis of the upper layer, and the upper layer calls the interface exposed by the lower layer for logical control. Among them, the lowest layer is the basic action of the intelligent agent, that is, the most basic behavior of the intelligent agent itself; above this is the behavior rules of the intelligent agent, which is an action mode with certain universality formed by encapsulating several basic actions; the top layer is the application mode of the intelligent agent, which is based on a combination of several action styles and represents the most subjective application mode of the intelligent agent controller. Among them, the basic actions and behavior rules of the intelligent agent can be built-in to the system, while the application mode can be adaptively configured by the user. The advantage of such hierarchical control is that each layer only needs to care about the interface exposed by the next lower layer, without perceiving unnecessary details of other layers, thereby reducing the coupling between the layers, simplifying the complexity of the logic design of each layer, and facilitating the replacement and reuse of logic. Taking the modeling and simulation of a sweeping robot as an example, the basic action layer at the bottom is the basic capabilities of the sweeping robot itself, including its components, such as tire rolling, side brush rotation, etc. The behavior rule layer is further encapsulated on this basis, such as the behavior rule of local vacuuming, which first moves to the area to be cleaned through the basic action of tire rolling, then gathers dust to the suction port through the rotation of the side brush, and finally sucks the dust into the dust collection box through the fan, thus completing local vacuuming; the top layer is a number of user-defined cleaning modes, such as the fast cleaning mode, which is completed by combining the three behavior rules of local vacuuming, avoiding obstacles, and returning to charge. Such hierarchical control design is also followed in other real-time strategy games such as drone simulation and StarCraft.
[0041] In the above control hierarchy, the basic action layer is the foundation. If the basic actions are incomplete, it will affect the execution of the behavior rule layer, and then affect the user's required application method layer. For the problem of incomplete basic action set, the existing solution is relatively intuitive, that is, the required basic actions are developed and completed before simulation, but this method may not be applicable to urgent and urgent scenarios due to the long development cycle. For example, users need to experiment with the fixed-point photography function of the drone in a simulation environment, and need to use the rules of vertical take-off and landing, hovering, and maneuvering in the behavior rule layer. The maneuvering rules use the rotor angle / speed adjustment and terrain detection actions in the basic action layer. However, if the drone model does not support terrain detection actions for the time being, the maneuvering rules will not be executed, which will affect the execution of the fixed-point photography function. According to the existing solution ideas, one is to wait for the terrain detection action to be developed and completed before continuing the simulation experiment, and the other is to redevelop the maneuvering rules and temporarily avoid the use of terrain detection actions. However, both methods require the simulation experiment to be suspended first, which has the problem of a long development cycle.
[0042] Based on this, the present application provides a method for reconstructing the execution path of behavioral rules for an incomplete action set, which can automatically and quickly tailor the rule logic according to the support of the underlying basic actions, thereby bypassing the basic actions that are not currently supported, quickly forming simulation capabilities, realizing the execution of simulation experiments as quickly as possible, and shortening the development cycle.
[0043] like Figure 2 As shown, the behavior rule execution path reconstruction method for an incomplete action set of the present application may include the following steps:
[0044] S210. Obtain an initial execution path of the behavior rule; wherein the initial execution path includes at least one basic component, which is the basic action of the agent in the lower-level model, and the at least one basic component is connected in sequence according to a certain logical order.
[0045] In an embodiment of the present application, the initial execution path can be determined according to specific behavioral rules, and the basic components in the initial execution path can be valid components (i.e., basic actions included in the action set of the lower-level model) or invalid components (i.e., basic actions missing from the action set of the lower-level model).
[0046] Optionally, the initial execution path can be presented in the form of a logic flow chart, which may include at least one node and an edge for connecting the nodes, wherein the node in the logic flow chart may be a start component, a basic component or an end component, and the edge in the logic flow chart represents the connection and data dependency between the components. In engineering practice, the experimenter can design a logic flow chart corresponding to the behavior rules based on specific requirements, and use the description file of the logic flow chart as the input of the simulation experiment. Based on the representation of the logic flow chart, the method of the present application can convert the analysis of the impact of invalid actions on the behavior rules in the model into the analysis of the impact of invalid components in the logic flow chart on the connectivity of the entire logic flow chart, and can cut the logic flow chart according to the analysis results, that is, reconstruct the execution path, so as to remove the impact of invalid actions on the behavior rules.
[0047] S220, traversing the initial execution path with the invalid component existing in the initial execution path as a starting point, and obtaining at least one target component having data dependency with the invalid component;
[0048] Since the basic action that is not supported in the action set of the lower-level model is a component in the initial execution path, the method of the present application can analyze with the invalid component as the starting point, and find the target component in the initial execution path that has a data dependency relationship with the invalid component to construct an invalid component set.
[0049] S230, determining an invalid component set according to the invalid component and the at least one target component; the method of the present application can form an invalid component set by including the invalid component itself in the execution path and the set of all target components with which the invalid component has data dependency. This means that, in the current situation, all components in the invalid component set cannot be executed.
[0050] S240: If the invalid component set does not affect the connectivity of the initial execution path, then delete the basic components in the invalid component set to obtain a reconstructed execution path of the behavior rule.
[0051] The connectivity of the execution path refers to whether the end component can be reached from the start component of the logic flow graph through at least one basic component. If the end component can be reached from the start component, it means that the execution path is connected and has connectivity. If the end component cannot be reached from the start component, it means that the execution path is not connected.
[0052] For example, since the action set of the lower-level model does not contain invalid components, in order to quickly conduct simulation experiments, you can consider deleting the invalid component and its related basic components (i.e., components in the invalid component set). At this time, if all components in the invalid component set are deleted, the start component and the end component cannot be connected, which means that the invalid component set affects the connectivity of the initial execution path. If all components in the invalid component set are deleted, the start component and the end component can still be connected, which means that the invalid component set does not affect the connectivity of the initial execution path.
[0053] When the invalid component set does not affect the connectivity of the initial execution path, all components in the invalid component set can be deleted to obtain a reconstructed execution path, and a simulation experiment can be quickly performed based on the reconstructed execution path, thereby improving the efficiency of the simulation experiment. The reconstructed execution path can also include a start component, at least one basic component, and an end component, and at least one basic component in the reconstructed execution path is a basic action supported by the lower-level model. The reconstructed execution path can also be represented in the form of a logic flow chart.
[0054] If the invalid component set affects the connectivity of the initial execution path of the behavior rule, a prompt signal is output to prompt that the action set of the lower model lacks the invalid component. At this time, the execution path can only be made connected by adding the invalid component to the basic action of the lower model.
[0055] Furthermore, based on the reconstructed execution path of the behavior rules, the method of the present application can also automatically generate program codes corresponding to the behavior rules. In an embodiment of the present application, each basic action in the lower-level model can correspond to a piece of program code to complete the function of the basic action. The program code corresponding to each basic action can be encapsulated through an API (Application Programming Interface) interface, and the API interface can be exposed to the upper-level behavior rules. The behavior rules must ultimately support the call of the application layer in the form of a program (such as source code or a dynamic library). The method of the present application can generate program code for behavior rules according to the existing low-code generation method, and the program code corresponding to the behavior rule can call the API interface supported by the action set to implement the functional description of the corresponding behavior rule.
[0056] Optionally, the step of determining the target component further includes:
[0057] respectively comparing the output of the invalid component with the input of the basic component in the initial execution path;
[0058] If the output of the invalid component is the input of the basic component, the basic component is used as the target component.
[0059] For example, the logic flow chart corresponding to the initial execution path of the behavior rule contains a component A (i.e., an invalid component) that is not supported in the lower-level model. The method of the present application can use component A as the starting point to search for the initial execution path of the behavior rule, and compare the output of component A with the input of all basic components in the initial execution path one by one. If the output of component A is the input of another component B, it means that component B has a data dependency on component A, and component B can be used as a target component, where component B can be a component supported in the lower-level model or a component not supported in the lower-level model. Afterwards, the method of the present application can use the target component B as an invalid component and repeat the above operations until all target components are found. Furthermore, the method of the present application can merge the invalid component and the target component that has a data dependency relationship with the invalid component to generate an invalid component set.
[0060] Optionally, the method of the present application may also include a connectivity analysis process for the execution path. The method of the present application may start from the starting component in the initial execution path of the behavior rule, and detect the connectivity of the execution path by determining the connection relationship between each basic component and the components in the invalid component set according to the connection relationship between each basic component in the logic flow chart corresponding to the initial execution path. Specifically, Figure 3 As shown, the connectivity analysis of the above execution path may also include the following steps:
[0061] S310, determining the current component, wherein the current component may be a component selected from a connected component set, wherein the initial value in the connected component set is the start component, that is, the start component of the execution path is used as the current component for the first time.
[0062] S320. Determine whether the successor component of the current component is a component in the invalid component set; wherein the successor component of the current component refers to the component connected to the output edge of the current component, that is, the output of the current component is the input of its successor component, and the successor component of the current component has a data dependency on the current component.
[0063] If the successor component of the current component is not a component in the invalid component set, step S330 is executed to add the successor component of the current component to the connected component set. Further, after adding the successor component of the current component to the connected component set, the current component can be deleted from the connected component set.
[0064] Afterwards, return to step S310, and repeat steps S310-S330 until the successor component of the current component is the end component. Further, if the successor component of the current component is the end component, the end component can be added to the connected component set. When it is detected that the connected component set contains the end component, it indicates that there are other connected paths from the start component to the end component of the initial execution path of the behavior rule except the invalid component set. At this time, it can be determined that the invalid component set does not affect the connectivity of the initial execution path, that is, the invalid component set does not affect the connectivity of the logic flow chart of the behavior rule. Furthermore, the method of the present application can delete all components in the invalid component set from the initial execution path, obtain a reconstructed execution path, and generate a program code corresponding to the behavior rule according to the reconstructed execution path.
[0065] If it is detected in step S320 that the successor component of the current component is a component in the invalid component set, it indicates that there is no other connected path between the start component and the end component of the initial execution path of the behavior rule except the invalid component set. At this time, it can be determined that the invalid component set affects the connectivity of the initial execution path, that is, the invalid component set affects the connectivity of the logic flow chart of the behavior rule. Furthermore, the method of the present application can output a prompt signal to prompt the simulation experimenter that the basic action corresponding to the invalid component is missing in the lower model.
[0066] The following is an example of the implementation method of conducting a drone fixed-point photography experiment in a simulation environment. Figure 1 In the simulation control level shown in the figure, fixed-point photography belongs to the application mode layer, which will be completed by combining the rules of take-off, landing, flying, and photography in the behavior rule layer, such as Figure 4As shown in the figure, each behavior rule is composed of basic actions in the lower model in a certain logical order. For example, the flight rules include basic model actions such as maneuvering according to path points and terrain detection, as shown in the figure. Figure 5 Now suppose that the terrain detection maneuver used in the flight rules (such as Figure 5 The behavior rule execution path reconstruction method of this application can be used based on this situation. Figure 4 The fixed-point photography function shown is working properly. Figure 7 As shown, the specific implementation is as follows:
[0067] (1) Obtain the initial execution path of the flight rules, that is, load Figure 5 Flowchart of the flight rules shown.
[0068] (2) Analyze data dependency. Since the "terrain detection" component (i.e., invalid component) is not currently supported, we start the analysis with this invalid component as the starting point. We find that the output of the "terrain detection" component will be used as the input of the "route planning" component to plan the route according to the terrain, and the output of the "route planning" component will be used as the input of the "maneuver according to the planned route" component to control the UAV maneuver according to the planned route. Therefore, the "route planning" component and the "maneuver according to the planned route" component have data dependencies on the "terrain detection" component, such as Figure 5 The grid is filled as shown.
[0069] (3) Construct an invalid component set. After step (2), all components that are related to the invalid component itself and have data dependencies with it are merged together to form an invalid component set. .
[0070] (4) Analysis of the impact of invalid component sets on the connectivity of the flight rules execution path. Figure 5 In the logic flow chart corresponding to the flight rules shown in the figure, if the invalid component set If all components in are deleted, we can get Figure 6 At this point, you can check Figure 6 Whether the "start" component to the "end" component in the flowchart is still connected, it is found that the flowchart is still connected from the "start" component to the "end" component, so it can be determined that the invalid component set has no effect on the connectivity of the execution path of the flight rules.
[0071] (5) Delete invalid components. Since the invalid component set does not affect the connectivity of the execution path of the flight rules, it can be deleted in Figure 5 All components in the invalid component set in the logic flow chart shown are deleted, the reconstruction of the flow chart execution path is completed, and the reconstruction execution path of the flight rule is obtained, such as Figure 6 shown.
[0072] (6) Generate rule code. Figure 6 The reconstruction execution path shown in the figure shows that the method of the present application can automatically generate the program code of the flight rules. Since the basic actions and their associated actions that are not supported by the lower-level model have been deleted from the program code, the remaining parts can be supported by the lower-level model, so the flight rules can be run, thereby supporting the simulation of the fixed-point photography function.
[0073] It can be seen that the behavior rule execution path reconstruction method for incomplete action sets of the present application can automatically and quickly tailor the rule logic according to the support of the underlying basic actions, thereby bypassing the basic actions that are not currently supported, quickly forming simulation capabilities, realizing the execution of simulation experiments as soon as possible, and shortening the development cycle.
[0074] It should be understood that although Figure 2-Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0075] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0076] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A behavior rule execution path reconstruction method for an incomplete action set, characterized in that: The method comprises: Get the initial execution path of the behavior rules; Taking the invalid component existing in the initial execution path as a starting point, traversing the initial execution path, and obtaining at least one target component having data dependency with the invalid component; Determine an invalid component set according to the invalid component and the at least one target component; If the invalid component set does not affect the connectivity of the initial execution path, then deleting the basic components in the invalid component set to obtain a reconstructed execution path of the behavior rule; The initial execution path of the behavior rule includes a start component and an end component; the method further includes: Determine a current component, where the current component is a component selected from a set of connected components, where an initial value of the set of connected components is a start component; Determine whether the successor component of the current component is a component in the invalid component set; If the successor component of the current component is not a component in the invalid component set, then the successor component of the current component is added to the connected component set; Return to the step of determining the current component until the successor component of the current component is the end component, and determine that there are other connected paths between the start component and the end component except the invalid component set, so as to determine that the invalid component set does not affect the connectivity of the logic flow chart of the behavior rule.
2. The method according to claim 1, characterized in that The method further comprises: According to the reconstructed execution path of the behavior rule, program code corresponding to the behavior rule is automatically generated.
3. The method according to claim 1, characterized in that The method further comprises: If the invalid component set affects the connectivity of the initial execution path of the behavior rule, a prompt signal is output to prompt that the invalid components are missing from the basic component set.
4. The method according to claim 1, characterized in that: Taking the invalid component existing in the initial execution path as a starting point, traversing the initial execution path to obtain at least one target component having data dependency with the invalid component, further comprising: respectively comparing the output of the invalid component with the input of the basic component in the initial execution path; If the output of the invalid component is the input of the basic component, the basic component is used as the target component.
5. The method according to claim 1, characterized in that The method further comprises: If there is no other connected path between the start component and the end component except the invalid component set, it is determined that the invalid component set affects the connectivity of the logic flow diagram of the behavior rule.
6. The method according to claim 5, characterized in that If the successor component of the current component is a component in the invalid component set, it is determined that there is no other connected path between the start component and the end component except the invalid component set.
7. The method according to claim 1, characterized in that The method further comprises: After adding the successor component of the current component to the connected component set, the current component is deleted from the connected component set.
8. The method according to any one of claims 1 to 7, characterized in that: The initial execution path and the reconstructed execution path each include at least one basic component, and the at least one basic component is sequentially connected according to a certain logical order.
