Method and system for dynamically configuring and triggering event strategy
Through dynamic configuration and trigger event policy methods, the event descriptor and state machine model are used to optimize event processing, which solves the problem of inflexible event policy configuration in the existing technology, realizes the flexibility and scalability of event processing, and ensures intelligence The robot's status update accuracy and system security.
Patent Information
- Application Number
- CN202411482401.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-23
AI Technical Summary
The configuration and update of event policies in the existing event handling methods are inflexible, resulting in high maintenance costs, low scalability, and security risks, which may lead to abnormal or crash of the software system, affecting the accuracy of robot status updates.
Using dynamic configuration and trigger event strategy methods, by setting the agent's preset events and native events, using static dictionary descriptors to build an event processing system, matching similarity based on event descriptors, matching successful preset events as the target Events are triggered, the system state of the agent is updated, and the strategy method is optimized through the state machine model and control flowchart to reduce complexity.
It realizes the flexibility and scalability of event processing, ensures the control accuracy of intelligent robots and the timeliness of state updates, reduces the complexity of event policies, and improves the security and maintainability of the system.
Smart Images

Figure CN119312106A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robotics technology, and in particular to a method and system for dynamically configuring and triggering event strategies. Background Art
[0002] With the development of information technology, event processing has become an indispensable part of software systems. Event processing refers to the process of responding to and processing events (such as user operations, system state changes, and exceptions) triggered by external or internal means. The purpose of event processing is to implement the functions and logic of the software system and improve the availability and reliability of the software system. Event processing usually requires the design of different event strategies based on different event types and triggering conditions, that is, the rules and methods for classifying, abstracting, triggering, and responding to events. The design of event strategies needs to consider factors such as the effectiveness, complexity, and flexibility of events to ensure the correctness and efficiency of event processing.
[0003] However, existing event processing methods have the following problems: Inflexible event strategy configuration and update: Traditional processing methods usually hard-code event strategies in the software system. This method has the following disadvantages: Increased maintenance costs of the software system. Each modification or addition of event strategies requires recompilation and deployment of the software system. Reduced scalability of the software system and unable to adapt to event processing in different scenarios and requirements. Affected the security of the software system. If there are loopholes or errors in the event strategy, it may cause the software system to malfunction or crash, thereby affecting the accuracy of the robot's status update.
[0004] Therefore, it is necessary to provide a method and system for dynamically configuring and triggering event strategies to solve the above problems. Summary of the invention
[0005] The present invention provides a method and system for dynamically configuring and triggering event strategies, so as to solve the problems that the existing methods increase the maintenance cost of the software system, and each modification or addition of the event strategy requires recompiling and deploying the software system; reduce the scalability of the software system and cannot adapt to event processing under different scenarios and requirements; affect the security of the software system. If there are loopholes or errors in the event strategy, it may cause the software system to be abnormal or crash, further affecting the accuracy of the robot's status update.
[0006] A method for dynamically configuring and triggering event strategies of the present invention adopts the following technical solution, including: Set multiple preset events for the agent, and use the descriptor in the form of a static dictionary to describe each preset event to obtain an event descriptor, which represents the current system state of the agent; the event descriptor includes: event type, event attribute, event priority, and event attribute weight; among them, the preset event includes: event triggering conditions and the action performed by the agent after the event is triggered; the native event includes: the object recognized by the agent and the recognition result; An event processing system is constructed based on the event descriptor. The event processing system is used to perform similarity matching between native events and preset events according to event attributes and event types of the native events and event attributes and event types in the event descriptors of preset events when native events occur. The preset event corresponding to the maximum priority among the preset priorities corresponding to all successfully matched preset events is taken as the target preset event, and the target preset event is triggered by the native event. After the target preset event is triggered according to the native event, the system state of the intelligent body is updated.
[0007] Preferably, the steps of using a descriptor in the form of a static dictionary to describe each preset event to obtain an event descriptor are: Get the event type, event attributes, agent's current system status, event priority, and event attribute weight of each preset event; The event type, event attribute, current system state of the agent, event priority, and event attribute weight of the preset event are expressed in a structured format, and the expression result is used as an event descriptor; The structured format is XML or JSON.
[0008] Preferably, the steps of constructing the event processing system are: Using the state machine model, the event processing system is abstracted into a set of states, a set of inputs, a set of outputs, and a set of state transition functions; Among them, a set of states are the specific characteristics of the agent in the event descriptor at different times, places and conditions; a set of inputs are native events; a set of outputs are the operating steps or methods from the input native events to the processing results, which are used to respond to native events; a set of state transfer functions are: similarity matching logic between the event descriptors of native events and preset events.
[0009] Preferably, the step of performing similarity matching between the event descriptors of the native event and the preset event is: According to the event type and event attribute of the native event, the corresponding event type and event attribute in the event descriptor of each preset event, and the weight of the event attribute, the similarity between the native event and each preset event is obtained; The native events with similarity greater than the preset similarity threshold are regarded as preset events with successful matching.
[0010] Preferably, the expression of the similarity between the native event and the preset event is:
[0011] In the formula, Indicates the similarity between native events and preset events; represents the weight of the i-th event attribute in the event descriptor of the preset event; The i-th event attribute in the event descriptor representing the preset event; Represents the i-th event attribute of the native event, Indicates the distance value between the ith event attribute in the event descriptor of the preset event and the ith event attribute of the native event; Represents the total number of event attributes in the event descriptor for the preset event.
[0012] Preferably, it also includes: Construct a control flow graph of the event processing system based on the event descriptor. Each node in the control flow graph represents the state or operation of the event processing system, and each path represents the transition from one state of an intelligent agent to another state. Obtain the complexity of the control flow graph based on the number of paths, nodes, and connected components in the control flow graph; The complexity of the control flow chart is taken as the optimization target, and the strategy method of the present invention is optimized by using a heuristic algorithm until the complexity of the optimized strategy method is minimized. The optimized strategy method corresponding to the minimum complexity is taken as the final dynamic configuration and trigger event strategy method.
[0013] Preferably, the expression of the complexity of the control flow graph is:
[0014] In the formula, Represents a control flow graph complexity; Represents a control flow graph The total number of paths in ; Represents a control flow graph The number of nodes in the control flow graph; P represents the control flow graph The number of connected components.
[0015] A system for dynamically configuring and triggering event strategies, comprising: The parameter setting module is used to set multiple preset events of the agent. Each preset event is described by a descriptor in the form of a static dictionary to obtain an event descriptor, which represents the current system state of the agent. The event descriptor includes: event type, event attribute, event priority, and event attribute weight. Among them, the preset event includes: event triggering conditions and the action performed by the agent after the event is triggered; the native event includes: the object recognized by the agent and the recognition result; An event matching module is used to build an event processing system based on the event descriptor. The event processing system is used to perform similarity matching between the native event and the preset event according to the event attributes and event type of the native event and the event attributes and event type in the event descriptor of the preset event when the native event occurs. And a state update module, which is used to take the preset event corresponding to the maximum priority among the preset priorities corresponding to all successfully matched preset events as the target preset event, use the native event to trigger the target preset event, and update the system state of the intelligent agent according to the action performed by the intelligent agent after the native event triggers the target preset event.
[0016] The beneficial effects of the present invention are: The preset events are classified and abstracted through the event processing system, and the event strategies are dynamically configured and updated based on the preset events to achieve flexibility and scalability of event processing, and native events are used as trigger conditions for state transfer; the event strategies are optimized based on complexity to ensure that the preset events can be effectively triggered and the trigger logic is not too complicated, to ensure accurate and clear control of the intelligent robot, and to ensure accurate and timely status updates of the intelligent robot. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 The present invention is a flowchart of a method for dynamically configuring and triggering event strategies. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] An embodiment of a method for dynamically configuring and triggering event strategies of the present invention is as follows: Figure 1 As shown, including: S1. Set multiple preset events of the agent and obtain event descriptors of the preset events; Specifically, multiple preset events of the agent are set, and each preset event is described separately using a descriptor in the form of a static dictionary to obtain an event descriptor, which represents the current system state of the agent; the event descriptor includes: event type, event attributes, event priority, and weight of event attributes; wherein, the preset events include: event triggering conditions and the actions performed by the agent after the event is triggered; native events include: the agent recognizes the object and the recognition result.
[0021] Among them, the steps of using a descriptor in the form of a static dictionary to describe each preset event separately to obtain an event descriptor are: obtaining the event type, event attribute, event trigger condition, event priority, and event attribute weight of each preset event; representing the event type, event attribute, event trigger condition, event priority, and event attribute weight of the preset event in a structured format, and using the representation result as an event descriptor; wherein the structured format is XML or JSON. In this embodiment, the event type, event attribute, event trigger condition, event priority, and event attribute weight of the preset event are represented in a structured format (such as XML, JSON), and the representation result is used as the event descriptor and stored in an external file for dynamic modification and updating. An event descriptor can be represented as:
[0022] in, The event type, i.e., the category of the event, such as "system event" or "user event", indicates the overall classification of the event; It is the event attribute, which includes features, time, and location information. The event attribute is expressed in the form of a vector: , is the attribute of the i-th event; Indicates the event priority, usually expressed by an integer or floating point number. The larger the value, the higher the event priority. This is used to determine the priority of each preset event. Represents the weights of different event attributes, the weight of the i-th event attribute , and satisfies For intelligent robots, an abstract event uses different fields to specify the triggering conditions of the event (such as the confidence level of the visual sensor seeing the flower is greater than 95%) and the post-triggering behavior (such as waving the hand).
[0023] S2. Build an event processing system and perform similarity matching between native events and event descriptors of preset events; Specifically, an event processing system is constructed based on the event descriptor. The event processing system is used to perform similarity matching between native events and preset events according to the event attributes and event types of the native events and the event attributes and event types in the event descriptors of the preset events when the native events occur.
[0024] Step 21, constructing an event processing system includes: using a state machine model to abstract the event processing system into a set of states, a set of inputs, a set of outputs and a set of state transition functions; wherein a set of states are specific characteristics of the agent at different times, places and conditions reflected by the event descriptors; a set of inputs are native events; a set of outputs are processes or methods, that is, the specific operating steps or methods of the system for processing the results of the input events, which are used to respond to native events; a set of state transition functions are: similarity matching logic between the event descriptors of native events and preset events.
[0025] Step 22: The steps of performing similarity matching between the event descriptors of the native event and the preset event are as follows: Since, in the process of similarity matching, it mainly depends on the event type and event attributes. When it occurs, based on native events Event types and event attributes , the original event With the preset event descriptor Event types and event attributes in Perform similarity matching. Specifically, in this embodiment, based on the event type and event attributes of the native event, the corresponding event type, event attributes and event attribute weights in the event descriptor of each preset event, the similarity between the native event and each preset event is obtained; the native event with a similarity greater than a preset similarity threshold is regarded as a preset event that has been successfully matched. In this embodiment, the similarity threshold is set to 0.8. Among them, the expression of the similarity between the native event and the preset event is:
[0026] In the formula, Indicates the similarity between native events and preset events; represents the weight of the i-th event attribute in the event descriptor of the preset event; The i-th event attribute in the event descriptor representing the preset event; Represents the i-th event attribute of the native event, Indicates the distance value between the ith event attribute in the event descriptor of the preset event and the ith event attribute of the native event; The total number of event attributes in the event descriptor representing the preset event; Indicates the distance value between the event type in the event descriptor of the preset event and the event type of the native event.
[0027] For intelligent robots, "visual sensor recognizes object" is a native event, and the event type of native event is flower; the event attributes of native event are: confidence that the object is a flower = 99%, flower color and location information; and the preset event is "wave when seeing a flower", the trigger condition is that the confidence of the flower is higher than 95%, and the waving action is executed after the trigger.
[0028] S3, update the system status of the agent; Specifically, the preset event corresponding to the maximum priority among the preset priorities corresponding to all successfully matched preset events is used as the target preset event, the target preset event is triggered by the native event, and the system state of the intelligent agent is updated according to the action performed by the intelligent agent after the native event triggers the target preset event.
[0029] In this embodiment, when an event is successfully matched, the priority of the preset event that is successfully matched is used. The preset event is triggered, that is, the triggering logic of the preset event in this embodiment depends on the similarity and priority . Similarity measures the degree of match between native events and preset events, while priority reflects the importance of the native event among multiple candidate preset events. In order to enhance the flexibility and accuracy of the system, the basis for event triggering does not rely solely on the success or failure of the match, but requires a comprehensive calculation of similarity and priority to select the best event for response. That is, according to the event priority defined in the event descriptor of the preset event To indicate the priority of the preset event, sort and filter the preset events that match successfully. According to the target parameters defined in the descriptor of the triggering event, execute the corresponding process or method and update the current state.
[0030] It should be noted that the preset events are decoupled from the response logic to improve the effectiveness of the event processing system. Taking the intelligent robot as an example, when there are multiple preset events, such as "wave when seeing a flower" and "shake head left and right when idle", they both meet the conditions and are matched by similarity results, that is, they are all preset events that have been matched successfully. The priority of "wave when seeing a flower" is set. Higher priority than idle shake ,Right now Although both preset events are successfully matched, the preset event "wave when seeing a flower" is preset with a higher priority, so the preset event "wave when seeing a flower" is triggered at this time. After completing the waving action, the state of the intelligent robot is updated to "just waved", and the priority of "wave when seeing a flower" is lowered to avoid repeated triggering, thereby ensuring the diversity and dynamic adjustment capabilities of the event processing system.
[0031] It also includes: optimization steps for a method of dynamically configuring and triggering event strategies: constructing a control flow chart of the event processing system based on the event descriptor, each node in the control flow chart represents the state or operation of the event processing system, and each path represents the transition from one state of an intelligent agent to another; obtaining the complexity of the control flow chart according to the number of paths, the number of nodes and the number of connected components in the control flow chart; taking the complexity of the control flow chart as the optimization target, and using a heuristic algorithm to optimize the strategy method of steps S1 to S3 of the present invention until the complexity of the optimized strategy method is minimized, and taking the optimized strategy method corresponding to the minimum complexity as the final dynamic configuration and triggering event strategy method.
[0032] Among them, the expression of the complexity of the control flow graph is:
[0033] In the formula, Represents a control flow graph complexity; Represents a control flow graph The total number of paths in ; Represents a control flow graph The number of nodes in the control flow graph; P represents the control flow graph The number of connected components, usually 1. When reading the configuration file for dynamic configuration and triggering event strategies, analyze the possible trigger paths in the event strategy. That is, the McCabe complexity algorithm is used to analyze the total number of paths contained in the control flow graph corresponding to the event strategy, and the control flow graph (CFG) of the event processing system is constructed based on the event descriptor. Each node in the control flow graph represents the state or operation of the event processing system, and each edge in the control flow graph represents the path from one state to another, reflecting the control structure complexity of the event strategy. The advantage of this step is that it can quickly evaluate the complexity of the event strategy without executing the event strategy, thereby improving the maintainability and optimizability of the event processing system.
[0034] Because if the complexity of an event strategy If it is higher, it means that the control logic of the event strategy is too complex and needs to be simplified, so the complexity of the event strategy with high complexity is reduced. That is, with complexity as the goal, a heuristic algorithm is used to optimize the dynamic configuration and triggering event strategy, and the dynamic configuration and triggering event strategy scheme with the minimum complexity is used as the final dynamic configuration and triggering event strategy method, thereby simplifying the complexity of the event strategy and improving the maintainability of the system.
[0035] The complexity of the final dynamic configuration and trigger event strategy after optimization And the complexity before optimization The difference quantification formula is: -
[0036] pass Measures the reduction in complexity brought about by optimization. The larger the The better the optimization effect, that is, the smaller the complexity, the better the solution optimization, so this embodiment selects the lowest complexity as the optimization target.
[0037] A system for dynamically configuring and triggering event strategies comprises: a parameter setting module, an event matching module and a state updating module, wherein the parameter setting module is used to set a plurality of preset events of an intelligent agent, and each preset event is described by a descriptor in the form of a static dictionary to obtain an event descriptor, which can represent the current system state of the intelligent agent; the event descriptor comprises: event type, event attribute, event priority and weight of event attribute; wherein the preset event comprises: event triggering condition and the action performed by the intelligent agent after the event is triggered; the native event comprises: the object recognized by the intelligent agent and the recognition result; the event matching module is used to construct an event processing system based on the event descriptor, and the event processing system is used to perform similarity matching between the native event and the preset event according to the event attribute and event type of the native event and the event attribute and event type in the event descriptor of the preset event when the native event occurs; the state updating module is used to take the preset event corresponding to the maximum priority among the preset priorities corresponding to all preset events that are successfully matched as the target preset event, and use the native event to trigger the target preset event, and update the system state of the intelligent agent according to the action performed by the intelligent agent after the native event triggers the target preset event.
[0038] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for dynamically configuring and triggering event strategies, characterized in that: include: Set multiple preset events for the agent, and use the descriptor in the form of a static dictionary to describe each preset event to obtain an event descriptor, which can represent the current system state of the agent; The event descriptor includes: event type, event attributes, event priority and event attribute weight; among them, the preset events include: event triggering conditions and the actions performed by the agent after the event is triggered; the native events include: the object recognized by the agent and the recognition result; An event processing system is constructed based on the event descriptor. The event processing system is used to perform similarity matching between native events and preset events according to event attributes and event types of the native events and event attributes and event types in the event descriptors of preset events when native events occur. The preset event corresponding to the maximum priority among the preset priorities corresponding to all successfully matched preset events is taken as the target preset event, and the target preset event is triggered by the native event. After the target preset event is triggered according to the native event, the system state of the intelligent body is updated.
2. A method for dynamically configuring and triggering event strategies according to claim 1, characterized in that: The steps of using the descriptor in the form of a static dictionary to describe each preset event and obtain the event descriptor are as follows: Get the event type, event attribute, event priority, and event attribute weight of each preset event; The event type, event attribute, event priority, and event attribute weight of the preset event are expressed in a structured format, and the expressed result is used as an event descriptor; The structured format is XML or JSON.
3. A method for dynamically configuring and triggering event strategies according to claim 1, characterized in that: The steps to build an event processing system are: Using the state machine model, the event processing system is abstracted into a set of states, a set of inputs, a set of outputs, and a set of state transition functions; Among them, a set of states are the specific characteristics of the agent in the event descriptor at different times, places and conditions; a set of inputs are native events; a set of outputs are the operating steps or methods from the input native events to the processing results, which are used to respond to native events; a set of state transfer functions are: similarity matching logic between the event descriptors of native events and preset events.
4. A method and system for dynamically configuring and triggering event strategies according to claim 1, characterized in that: The steps for similarity matching between native events and event descriptors of preset events are: According to the event type and event attribute of the native event, the corresponding event type and event attribute in the event descriptor of each preset event, and the weight of the event attribute, the similarity between the native event and each preset event is obtained; The native events with similarity greater than the preset similarity threshold are regarded as preset events with successful matching.
5. A method for dynamically configuring and triggering event strategies according to claim 4, characterized in that: The similarity expression between native events and preset events is: In the formula, Indicates the similarity between native events and preset events; represents the weight of the i-th event attribute in the event descriptor of the preset event; The i-th event attribute in the event descriptor representing the preset event; Represents the i-th event attribute of the native event, Indicates the distance value between the ith event attribute in the event descriptor of the preset event and the ith event attribute of the native event; Represents the total number of event attributes in the event descriptor for the preset event.
6. A method for dynamically configuring and triggering event strategies according to claim 1, characterized in that: Also includes: Construct a control flow graph of the event processing system based on the event descriptor. Each node in the control flow graph represents the state or operation of the event processing system, and each path represents the transition from one state of an intelligent agent to another state. Obtain the complexity of the control flow graph based on the number of paths, nodes, and connected components in the control flow graph; Taking the complexity of the control flow chart as the optimization target, a heuristic algorithm is used to optimize the strategy method described in any one of claims 1-5 until the complexity of the optimized strategy method is minimized, and the optimized strategy method corresponding to the minimum complexity is used as the final dynamic configuration and trigger event strategy method.
7. A method for dynamically configuring and triggering event strategies according to claim 6, characterized in that: The expression of the complexity of the control flow graph is: In the formula, Represents a control flow graph complexity; Represents a control flow graph The total number of paths in ; Represents a control flow graph The number of nodes in the control flow graph; P represents the control flow graph The number of connected components.
8. A system for dynamically configuring and triggering event strategies, characterized in that: include: The parameter setting module is used to set multiple preset events of the intelligent agent, and use the descriptor in the form of a static dictionary to describe each preset event to obtain an event descriptor, which represents the current system state of the intelligent agent; The event descriptor includes: event type, event attributes, event priority and event attribute weight; among them, the preset events include: event triggering conditions and the actions performed by the agent after the event is triggered; the native events include: the object recognized by the agent and the recognition result; An event matching module is used to build an event processing system based on the event descriptor. The event processing system is used to perform similarity matching between the native event and the preset event according to the event attributes and event type of the native event and the event attributes and event type in the event descriptor of the preset event when the native event occurs. And a state update module, which is used to take the preset event corresponding to the maximum priority among the preset priorities corresponding to all successfully matched preset events as the target preset event, use the native event to trigger the target preset event, and update the system state of the intelligent agent according to the action performed by the intelligent agent after the native event triggers the target preset event.
Citation Information
Patent Citations
Method and apparatus for the automatic analysis of computer software
CA2162020A1
Dynamic event trigger control method for nonlinear multi-agent system
CN113515066A
Multi-agent continuous space-level path segment search and cooperation strategy method
CN117555243A
Diary management method and system
GB0321213D0
Method and apparatus for efficient implementation and evaluation of state machines and programmable finite state automata
US20040059443A1