A method and system for generating robot swarm behavior logic based on a genetic algorithm
By constructing a condition library and an action library based on a genetic algorithm, and using a matrix genetic algorithm to optimize the behavior tree, the target behavior tree with the highest fitness value is generated. This solves the problem of generating robot group behavior logic in multi-objective task scenarios and enables efficient and interpretable completion of complex tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-11
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies struggle to generate suitable robot swarm behavior logic in multi-objective task scenarios, especially in complex conditions and action matching relationships. Traditional methods suffer from design complexity, difficulty in modification, and difficulty in interpretation.
A genetic algorithm-based approach is used to construct a condition library and an action library. The behavior tree is optimized through a matrix genetic algorithm to generate the target behavior tree with the highest fitness value. It includes a variety of genetic operations and condition filtering mechanisms to automatically generate the behavior logic of the robot group.
It enables the automatic generation of behavior trees in multi-objective task scenarios, improves evolutionary efficiency, enhances the interpretability and adaptability of robot swarms, and enables them to complete complex tasks.
Smart Images

Figure CN115186792B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of robot colony, and particularly relates to a robot colony behavior logic generation method and system based on a genetic algorithm. BACKGROUND
[0002] Inspired by biological colonies, swarm intelligence enables a colony of individuals with the same simple function to accomplish complex tasks. Such a colony has important features, such as decentralization, local communication capability, environmental adaptability and scalability, which enable swarm intelligence to be applied in battlefields, large farmlands, disaster-stricken areas and other environments to protect people from harsh environments or reduce their workload. Therefore, a large number of studies are devoted to the design of colony motion rules or colony behavior logic. Typical colony motion rules, such as artificial potential field, shape generation and gene regulatory network, are designed to determine the motion direction of individuals in the colony or form a functional mode. Unlike the above-mentioned colony motion rules, the upper control structure can be regarded as a pattern of motion rules, such as the logical combination of different motion rules, and this logic is defined as colony behavior logic.
[0003] There are many methods for representing behavior logic at present, including finite state machine (FSM), hierarchical FSM (H-FSM) and behavior tree. FSM uses nodes to represent various states and uses directed line segments to represent actions performed in state transactions, but if there are many states in a FSM, it will have many complex connections, although H-FSM can solve this problem to some extent, but it is still not easy to understand, design and modify. The behavior tree uses control nodes with execution logic to connect the conditions or actions represented by leaf nodes, which has a similar logical structure to computer programming languages. Therefore, the behavior tree has the significant advantage of being easy to interpret, design and modify, and the behavior tree is usually superior to FSM and H-FSM in representing complex behavior logic.
[0004] Although the group behavior logic can be described by a large number of methods, it can be summarized as the most basic condition and action matching relationship, which means selecting and executing the corresponding action according to the current condition. Although Antoine Ligot et al. proposed to use behavior trees to represent the condition and action matching relationship of the robot group in the paper of Behavior Trees as a Control Architecture in the Automatic Design of Robot Swarms, it limits the number of branches under the root node of the behavior tree to at most 4, and only sets 6 or 7 judgment conditions. This limits the ability of the group and the complexity and number of targets in the task scene. Secondly, the conditions and actions of the robot individuals can also be matched manually, but when there are a large number of perceivable conditions and executable actions, the manual matching process is prone to errors.
[0005] There is a lot of work in the automatic design of robot groups at present, and neural network-based algorithms and other intelligent optimization algorithms are widely used to solve optimization problems. Neural network-based algorithms achieve analytical learning by simulating the human brain, showing high performance, but the optimization process and results are difficult to explain. Other intelligent optimization algorithms such as ant colony algorithm, evolutionary algorithm, particle swarm optimization algorithm all have good interpretability. Aadesh Neupane et al. proposed to use a modified grammatical evolution method to evolve effective behavior trees in the paper of Designing Emergent Swarm Behaviors using Behavior Trees and Grammatical Evolution, but only for solving single-source foraging tasks. It can be seen that most researches only consider the automatic design method of robot group behavior logic in single-target task environment, or do not consider the characteristics of group robots.
[0006] Therefore, for group robots facing multi-target task scenarios, how to generate appropriate group behavior logic is a technical problem to be solved at present. SUMMARY
[0007] Based on this, it is necessary to provide a robot group behavior logic generation method and system based on genetic algorithm in view of the above technical problems.
[0008] Based on the above purpose, the present application provides a robot group behavior logic generation method based on genetic algorithm, comprising:
[0009] Obtaining the condition information perceived by each robot in the robot group, and constructing a condition library;
[0010] obtaining all actions performed by each robot in the robot group in the multi-target task scenario, and constructing an action library;
[0011] constructing a behavior tree according to the condition library and the action library;
[0012] constructing a matrix genetic algorithm, the matrix genetic algorithm including multiple genetic operations and a condition filtering mechanism, and taking a matrix corresponding to the behavior tree as an evolution object, and taking a target behavior tree with the highest fitness value as a target to optimize the robot group behavior logic;
[0013] obtaining multiple matrices generated by conversion of multiple behavior trees associated with the robot group by the matrix genetic algorithm, deleting useless conditions in the condition library and useless condition action rows in the matrices by the condition filtering mechanism after genetic operations on the multiple matrices, and outputting the target behavior tree with the highest fitness value when an evolution termination condition is met;
[0014] obtaining the behavior logic of the robot group in the multi-target task scenario according to the target behavior tree.
[0015] Preferably, the condition information perceived by each robot in the robot group is obtained, and a condition library is constructed, including:
[0016] determining a multi-target task scenario and a robot group including multiple robots, obtaining condition information perceived by each robot in the multi-target task scenario, the condition information including self information and environment information;
[0017] obtaining a condition set corresponding to each type of information according to the self information and the environment information;
[0018] arranging and combining elements in each condition set to obtain all condition combinations;
[0019] constructing a condition library according to all the condition combinations.
[0020] Preferably, the behavior tree is constructed according to the condition library and the action library, including:
[0021] determining the number of each type of node in the behavior tree to be constructed according to the size of the condition library;
[0022] taking the condition library and the action library as abstract libraries, and obtaining a mapping relationship between each type of element in the abstract library and each type of node in the behavior tree to be constructed;
[0023] constructing a behavior tree according to the number of each type of node and the mapping relationship between each type of element and each type of node, so as to represent the robot group behavior logic by using the behavior tree.
[0024] Preferably, the specific process of the matrix genetic algorithm comprises:
[0025] Obtaining initial parameters of the matrix genetic algorithm, the initial parameters comprising an initial size number and an iteration threshold value;
[0026] Obtaining a behavior tree associated with the robot population and having the same size as the initial evolution size, and converting to generate a matrix corresponding to the behavior tree;
[0027] Detecting whether the current evolution iteration number is greater than the evolution iteration threshold value;
[0028] If not, performing mutation, insertion, one-point recombination and two-point recombination on each of the matrices in turn to obtain new matrices;
[0029] Calling a fitness function to evaluate the fitness values of all the matrices, selecting the matrices having the same size as the initial evolution size in descending order of the fitness values, and associating the selected matrices with the robot population;
[0030] Through a conditional filtering mechanism, obtaining conditions that have not been used for genetic operation in continuous multiple iteration evolutions, marking the conditions as useless conditions, deleting combination conditions corresponding to the useless conditions in the condition library, and marking condition action rows corresponding to the useless conditions in each matrix associated with the robot population;
[0031] Updating the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold value or there is a matrix having a fitness value greater than a fitness threshold value in the matrices associated with the robot population, obtaining a matrix having the highest fitness value, converting the matrix into a target behavior tree, and outputting the target behavior tree.
[0032] Preferably, the converting to generate a matrix corresponding to each behavior tree comprises:
[0033] For each behavior tree associated with the robot population, obtaining the number of sequence nodes in the behavior tree, and determining the number of rows of the matrix according to the number of sequence nodes;
[0034] Obtaining the number of condition information contained in the condition nodes in the behavior tree, and determining the number of columns of the matrix according to the number of condition information and a preset auxiliary information number;
[0035] Taking the condition nodes and action nodes associated with the sequence nodes in the behavior tree as row elements of the matrix, filling the matrix, and obtaining a matrix corresponding to the behavior tree.
[0036] Preferably, before the matrix genetic algorithm is constructed, the method further comprises:
[0037] By programming the input data of the multi-target task scene, a simulation scene containing targets and base stations is constructed;
[0038] Obtain the task requirements corresponding to the simulation scene, and construct a fitness function according to the task requirements.
[0039] Preferably, the fitness function is:
[0040]
[0041] Wherein, F is the fitness value; N represents the time step set in the task requirements; i represents the current time step; t si represents the total number of state changes of all targets in the simulation scene at the current time step i; t s represents the total number of state changes of all targets in the simulation scene from the initial position to the base station.
[0042] In addition, the present application also provides a robot colony behavior logic generation system based on genetic algorithm, comprising:
[0043] A condition library construction module is configured to obtain the condition information perceived by each robot in the robot colony and construct a condition library.
[0044] An action library construction module is configured to obtain all actions performed by each robot in the robot colony in the multi-target task scene and construct an action library.
[0045] A behavior tree construction module is configured to construct a behavior tree according to the condition library and the action library.
[0046] An algorithm construction module is configured to construct a matrix-type genetic algorithm, which contains multiple genetic operations and a condition filtering mechanism, and takes the matrix corresponding to the behavior tree as the evolution object, and optimizes the robot colony behavior logic with the target behavior tree with the highest fitness value.
[0047] A behavior tree optimization module is configured to obtain multiple matrices converted and generated by multiple behavior trees associated with the robot colony through the matrix-type genetic algorithm, delete the useless conditions in the condition library and the useless condition action rows in the matrices through the condition filtering mechanism after genetic operations on the multiple matrices, and output the target behavior tree with the highest fitness value when the evolution termination condition is met.
[0048] A behavior logic generation module is configured to obtain the behavior logic of the robot colony facing the multi-target task scene according to the target behavior tree.
[0049] Preferably, the condition library construction module comprises:
[0050] An information perception sub-module is configured to determine a multi-target task scene and a robot group comprising a plurality of robots, and acquire condition information perceived by each robot in the multi-target task scene, wherein the condition information comprises self information and environment information;
[0051] An information processing sub-module is configured to acquire a condition set corresponding to each type of information according to the self information and the environment information;
[0052] An element combination sub-module is configured to arrange and combine elements in each condition set to obtain all condition combinations;
[0053] A library construction sub-module is configured to construct a condition library according to all condition combinations.
[0054] Preferably, the behavior tree optimization module comprises:
[0055] A parameter acquisition sub-module is configured to acquire initial parameters of the matrix-type genetic algorithm, wherein the initial parameters comprise an initial scale number and an iteration threshold;
[0056] A conversion sub-module is configured to acquire a behavior tree associated with the robot group and having the same initial evolution scale size as the initial evolution scale, and convert the behavior tree into a matrix corresponding to the behavior tree;
[0057] A detection sub-module is configured to detect whether a current evolution iteration number is greater than the evolution iteration threshold;
[0058] A genetic operation sub-module is configured to, if not, sequentially perform mutation, insertion, one-point recombination and two-point recombination on each matrix to obtain a new matrix, call a fitness function to evaluate fitness values of all matrices, select the matrix having the same initial evolution scale size from high to low according to the fitness values, and associate the selected matrix with the robot group;
[0059] A condition filtering sub-module is configured to acquire conditions that are not used for genetic operation in continuous multiple iteration evolutions through a condition filtering mechanism, mark the conditions as useless conditions, delete combined conditions corresponding to the useless conditions in the condition library, and delete condition action rows corresponding to the useless conditions in each matrix associated with the robot group;
[0060] An evolution result output sub-module is configured to update the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold or a matrix having a fitness value greater than a fitness threshold exists in the matrix associated with the robot group, acquire a matrix having the highest fitness value, convert the matrix into a target behavior tree, and output the target behavior tree.
[0061] The robot group behavior logic generation method and system based on the genetic algorithm have the following beneficial effects:
[0062] 1) According to the multi-target task scene and the group robot completing the task corresponding to the multi-target task scene, a behavior tree is automatically generated, so as to achieve the purpose of automatically generating the group robot behavior logic;
[0063] 2) Based on the information that can be perceived by the robot group and the actual executable program, an abstract condition library and an action library are constructed, which is different from the existing work of perceiving only a small amount of information, the condition library contains a large number of complex combined conditions, which lays a foundation for generating complex robot group behavior logic and enabling the robot group to complete the task corresponding to the multi-target task scene;
[0064] 3) The matrix converted by the behavior tree is automatically generated and optimized through the matrix genetic algorithm, and the matrix with the highest fitness is converted into the target behavior tree containing the best condition and action matching relationship for output. Compared with the traditional evolutionary algorithm, the matrix genetic algorithm not only has a variety of genetic operations that can be executed in the matrix, but also contains a condition filtering mechanism, which effectively improves the evolution efficiency;
[0065] 4) The robot group behavior logic generation method based on the genetic algorithm has the advantages of strong scalability, high interpretability and strong adaptability, and the matrix genetic algorithm has certain advantages compared with the existing genetic algorithm. BRIEF DESCRIPTION OF DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0067] Figure 1 The flow of the robot group behavior logic generation method based on the genetic algorithm in an embodiment of the present application Figure 1 ;
[0068] Figure 2 The execution process diagram of the action in an embodiment of the present application
[0069] Figure 3 The example diagram of the behavior tree in an embodiment of the present application
[0070] Figure 4 The example diagram of the behavior tree corresponding to the matrix shown in Figure 3
[0071] Figure 5 The flow of the robot group behavior logic generation method based on the genetic algorithm in an embodiment of the present application Figure 2 ;
[0072] Figure 6 A schematic diagram of a simulation scene in an embodiment of the present application;
[0073] Figure 7 A structural schematic diagram of a robot colony behavior logic generation system based on a genetic algorithm in an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to make the technical problems to be solved by the present application, the technical solutions and beneficial effects more clear and apparent, the present application will be further described in detail below in combination with the 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.
[0075] As shown in Figure 1 An embodiment of the present application provides a robot colony behavior logic generation method based on a genetic algorithm, which specifically comprises the following steps:
[0076] Step S10, obtaining the condition information perceived by each robot in the robot colony, and constructing a condition library.
[0077] In the embodiment, the robot colony and the multi-target task scene are determined, and on this basis, the environment interaction device including the sensor and the actuator of each robot can be obtained. Then, the surrounding environment information and the self information of each robot can be perceived through the sensor of each robot, and the environment information and the self information are taken as the perceivable condition information to construct the abstract condition library.
[0078] As a preferred, step S10 specifically comprises the following steps:
[0079] Step S101, determining the multi-target task scene and the robot colony including a plurality of robots, and obtaining the condition information perceived by each robot in the multi-target task scene, the condition information including self information and environment information;
[0080] Step S102, obtaining the condition set corresponding to each type of information according to the self information and the environment information;
[0081] Step S103, arranging and combining the elements in each condition set to obtain all condition combinations;
[0082] Step S104, constructing the condition library according to all condition combinations.
[0083] In the embodiment, in order to construct a condition library containing all different condition combinations, first, the condition information sensed by each robot in the robot colony is obtained, which can be divided into self information and environment information. In order to distinguish the two types of information, corresponding characters can be used to represent, for example, lowercase letters can be used to represent self information, and uppercase letters can be used to represent environment information.
[0084] For example, if there is a robot colony, the self information sensed by each robot includes power state and performance state, the power state is divided into sufficient and insufficient, and the performance state is divided into exploration and regression; and the environment information sensed by each robot includes current location type and current safety condition, the current location type is divided into unknown area or explored area, and the current safety condition is divided into safe and unsafe. According to the above information, the condition set describing self information is a={a1, a2} and b={b1, b2}, and the condition set describing environment information is A={A1, A2} and B={B1, B2}, wherein a, b, A and B represent power state, performance state, current location type and current safety condition respectively, and the elements in each condition set represent a state.
[0085] Then, different states of different condition information (i.e. different elements in different condition sets) are arranged and combined, and all possible sensed condition combinations are obtained: a1b1A1B1, a1b1A1B2, a1b1A2B1, a1b1A2B2, a1b2A1B1, a1b2A1B2, a1b2A2B1, a1b2A2B2, a2b1A1B1, a2b1A1B2, a2b1A2B1, a2b1A2B2, a2b2A1B1, a2b2A2B2, a2b2A1B2 and a2b2A2B2, and a condition library is constructed from the 16 condition combinations. It should be noted that the sensed information represented by symbols is abstract, and in fact, different condition information has corresponding executable programs.
[0086] Step S20, obtaining all actions performed by each robot in the robot colony in the multi-target task scene to construct an action library.
[0087] In the embodiment, for the multi-target task scene, each robot in the robot colony performs actions through the actuator to change self information and environment information, and then all actions performed by each robot through the actuator can be obtained to construct an action library.
[0088] In the action library, each action must be executed under the corresponding premise, and all actions will return a result after execution, based on which, the elements related to the action mainly include necessary premise, success condition and behavior content, and the execution process of the action is constructed according to the three types of elements. As shown in the execution process of the action of Figure 2 When the action is executed, the necessary premise is first judged, if one of the premises is not satisfied, the action will return failure and terminate execution, otherwise, it is judged whether the success condition is true, if the success condition is true, the return result of the action is success and terminates execution, if the success condition is false, the behavior content of the action will be executed, and the return result is running. For example, if the action is chasing, the necessary premise is that there is an object that can be chased, if an action does not require a necessary premise, the action can have no necessary premise.
[0089] It should be noted that each element in the condition library and the action library corresponds to an actual executable program, and the executable program is executed by each robot.
[0090] Step S30, constructing an initial behavior tree according to the condition library and the action library.
[0091] In this embodiment, the purpose of generating appropriate robot group behavior logic is to determine actions that meet different combined conditions, so as to represent the robot group behavior logic through the behavior tree. The behavior tree (BT) includes different types of control nodes and leaf nodes, the control nodes mainly include selection nodes, sequence nodes and parallel nodes, and the leaf nodes mainly include condition nodes and behavior nodes; each control node has a matching node corresponding to its child node.
[0092] In the behavior tree, different nodes represent different meanings and different execution logics, and the execution logic of each node is as follows:
[0093] The execution logic of the selection node is: the child nodes are executed in order, if any node returns success, the execution terminates, the return result of the selection node is success, otherwise, the return result is "failure";
[0094] The execution logic of the sequence node is: all child nodes are executed in order, if all child nodes return success, the return result of the sequence node is success, otherwise, the return result is failure;
[0095] The execution logic of the parallel node is: all child nodes are executed simultaneously, if the number of child nodes returning success is higher than the set success threshold, the return result is success, if the number of child nodes returning failure is higher than the set failure threshold, the return result is failure;
[0096] The execution logic of the condition node is as follows: determine whether the success condition represented by the node is true. If the success condition is true, the condition node returns a success result; otherwise, it returns a failure result.
[0097] The execution logic of the behavior node is as follows: execute the behavior content represented by the node. If the behavior content fails to execute, the behavior node returns a failure result; otherwise, it returns a normal operation result.
[0098] Preferably, step S30 specifically includes the following steps:
[0099] Step S301: Determine the number of each type of node in the behavior tree to be constructed based on the size of the condition library;
[0100] Step S302: Using the condition library and action library as abstract libraries, obtain the mapping relationship between various elements in the abstract library and various nodes in the behavior tree to be constructed;
[0101] Step S303: Construct a behavior tree based on the number of nodes of each type and the mapping relationship between each type of element and each type of node, so as to represent the behavior logic of the robot group using the behavior tree.
[0102] In this embodiment, based on the similarity between the execution process of actions in the action library and the execution logic of nodes in the behavior tree, it can be determined that there is a mapping relationship between elements (i.e., combined conditions) in the condition library and condition nodes in the behavior tree to be constructed, as well as between elements (actions) in the action library and action nodes in the behavior tree to be constructed. At the same time, based on the size of the condition library, i.e. the number of combined conditions in the condition library, the number of condition nodes, action nodes, and sequence nodes in the behavior tree to be constructed can be determined. Then, based on the number of these three types of nodes and these two sets of mapping relationships, a behavior tree can be constructed to represent the behavior logic of the robot group.
[0103] like Figure 3 The behavior tree shown has a first-level node that is a selection node and a second-level node that is a sequence node. Each sequence node has two child nodes, namely a condition node and a behavior node. All condition nodes in the behavior tree represent different elements in the condition library. The set formed by all condition nodes is the condition library.
[0104] The execution logic of the above behavior tree is as follows: first, for each time step of each robot in the robot group, each robot checks whether the return value of the last step is running, if yes, the operation of the last step is continued, if not, the behavior tree is executed; then, based on the execution logic of various nodes, it is judged whether the condition combination represented by C1 to Cn is satisfied, if the condition combination represented by the condition node C1 is satisfied, the behavior node A1 corresponding to the condition node C1 is executed, and the return value of the behavior tree is the same as the return value of the executed behavior node A1. Each robot only executes one step corresponding to one action at each time step.
[0105] In step S40, a matrix genetic algorithm is constructed, which contains various genetic operations and condition filtering mechanisms, and takes the matrix corresponding to the behavior tree as the evolution object, and the target behavior tree with the highest fitness value as the target to optimize the robot group behavior logic.
[0106] For traditional genetic algorithms (Genetic Algorithm, GA), such as gene editing (Gene Editing, GE) and gene expression programming (Gene Expression Programming, GEP), are tree structure-based evolutionary algorithms. Gene editing directly performs genetic operations on tree structure, and gene expression programming performs genetic operations on strings after encoding tree structure. However, due to the random structure of the behavior tree, even if the traditional genetic algorithm has diversified genetic operations such as transposition, mutation and recombination, it cannot guarantee to obtain the expected evolution result.
[0107] Based on the traditional genetic algorithm, the evolution object is converted from tree structure to matrix, the chromosome is represented by matrix, and the output result is set as the target behavior tree generated according to the matrix with the highest fitness value (the target behavior tree corresponds to the best condition and action matching scheme). Further, various genetic operations suitable for execution in the matrix are set, and a condition filtering mechanism is introduced to calculate the combined condition not used for genetic operation for multiple times in succession to update the condition corresponding row in the condition library and the filtering matrix, so as to obtain the matrix genetic algorithm. It can be understood that the matrix genetic algorithm contains various genetic operations suitable for matrix, and introduces the condition filtering mechanism, which is beneficial to improve the evolution efficiency.
[0108] More specifically, the matrix genetic algorithm contains five genetic operations, namely mutation, insertion, one-point recombination, two-point recombination and selection, and the specific process of each genetic operation is as follows:
[0109] The specific process of mutation is that the robot colony faces a multi-target task scene and can randomly generate multiple behavior trees, so that the robot colony is associated with multiple matrices, at this time, for each matrix associated with the robot colony, each row in the matrix undergoes a cycle, at this time, for each row, if the random number generated by the random function is less than the mutation probability, randomly select any one action corresponding to the condition of the row to replace the original action, after the cycle, a new matrix after mutation is obtained.
[0110] The specific process of insertion is that: first, each matrix associated with the robot colony is cycled, that is, for each matrix, if the random number is less than the insertion probability, a random fragment containing several consecutive rows of another random matrix is inserted into a random row of the matrix; second, delete the rows whose conditions outside the inserted fragment are the same as the conditions inside the inserted fragment to ensure that the new matrix after insertion is logically reasonable, after the cycle, a new matrix after insertion is obtained.
[0111] The specific process of one-point recombination is that: first, for each matrix associated with the robot colony, if the random number is less than the one-point recombination probability, randomly select another matrix associated with the robot colony and exchange the part after the random recombination position; second, after the rows in the constant fragment are exchanged in order between the two matrices with the same conditions of the exchanged fragment, a new matrix after one-point recombination is obtained.
[0112] The specific process of two-point recombination is similar to that of one-point recombination, the only difference between the specific processes is that two-point recombination has two random recombination positions, which will not be described here.
[0113] The specific process of selection is that the robot colony behavior logic represented by all matrices (including the initial matrix and the new matrix obtained by mutation, insertion, one-point recombination and two-point recombination) is applied to the multi-target task scene in turn, and the fitness function constructed according to the task requirements is called to evaluate the fitness value, after obtaining the fitness value corresponding to each matrix, the matrices with better fitness values and the same size as the initial iteration size are retained, and are associated with the initial colony robots for the next evolution iteration. It can be understood that after the genetic operations of mutation, insertion, one-point recombination and two-point recombination, the initial iteration size is expanded, and the selection operation can eliminate matrices with low fitness values.
[0114] Further, the condition filtering mechanism included in the matrix genetic algorithm has the following specific process: first, calculate the conditions not used for genetic operation in each preset iteration (preferably, every 10 times), mark the conditions not used for genetic operation as useless conditions, then delete the condition combinations corresponding to the useless conditions from the condition library, and delete the condition action rows corresponding to the useless conditions in each matrix, to complete the condition library update and matrix update. It can be understood that in the fitness evaluation stage, there may be combination conditions that have never been encountered in the condition library, and accordingly, the robot may perceive unreasonable condition information from the multi-objective task scene, thereby reducing the evolution efficiency and the storage space of operation data, and the introduction of the condition filtering mechanism in the evolution iteration process can significantly improve the evolution efficiency.
[0115] In step S50, a plurality of matrices generated by converting a plurality of behavior trees associated with the robot population are obtained by the matrix genetic algorithm, after genetic operation on the matrices, useless conditions in the condition library and useless condition action rows in the matrices are deleted by the condition filtering mechanism, and when the evolution termination condition is met, the target behavior tree with the highest fitness value is output.
[0116] In this embodiment, the evolution termination condition can be that the number of evolution iterations is greater than the iteration threshold, or there is a matrix greater than the fitness threshold in all matrices associated with the robot population.
[0117] As a preferred, when the genetic operation includes mutation, insertion, one-point recombination, two-point recombination and selection, the specific process of the matrix genetic algorithm, i.e., step S50, includes the following steps:
[0118] In step S501, the initial parameters of the matrix genetic algorithm are obtained, including the initial evolution scale and the iteration threshold;
[0119] In step S502, the behavior trees associated with the robot population and having the same size as the initial evolution scale are obtained, and the matrices corresponding to each behavior tree are converted and generated;
[0120] In step S503, it is detected whether the current number of evolution iterations reaches the evolution iteration threshold;
[0121] In step S504, if not, after mutation, insertion, one-point recombination and two-point recombination are performed on each matrix, new matrices are obtained;
[0122] In step S505, the fitness function is called to evaluate the fitness values of all matrices, matrices having the same size as the initial evolution scale are selected in descending order of the fitness values, and the selected matrices are associated with the robot population;
[0123] Step S506, through the condition filtering mechanism, obtain conditions not used for genetic operation in continuous multiple iteration evolution, mark as useless conditions, delete combined conditions corresponding to useless conditions in the condition library, and condition action rows corresponding to useless conditions in each matrix associated with the robot population;
[0124] Step S506, update the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold, or when there is a matrix greater than the fitness threshold in the matrix associated with the robot population, obtain the matrix with the highest fitness value, and convert it into the target behavior tree for output.
[0125] In step S502, for each behavior tree associated with the robot population, first obtain the number of sequence nodes in the behavior tree, and determine the number of rows of the matrix according to the number of sequence nodes, then obtain the number of condition information contained in the condition node in the behavior tree, and determine the number of columns of the matrix according to the number of condition information and the preset auxiliary information number, and finally, take the condition node and action node associated with the sequence node in the behavior tree as the row elements of the matrix, fill in the matrix, and obtain the matrix corresponding to the behavior tree, that is, the number of rows of the matrix is the same as the size of the condition library, and the number of columns of the matrix is the cumulative value of the number of condition information contained in the combined condition and the auxiliary information number. Optionally, the auxiliary information number is 1.
[0126] For example, based on the characteristics of the behavior tree shown in Figure 3 , the matrix shown in Figure 4 can be obtained as the evolution object of the matrix genetic algorithm. Figure 4 The matching relationship between conditions and actions is shown in , each row in the matrix is composed of an element in the condition library and an element in the action library, the element in the condition library is represented by a group of characters, and each character represents the state of different types of condition information. Using the example described in step S10, the string "2121" represents the element a2b1A2B1 in the condition library.
[0127] After generating the matrix corresponding to each behavior tree, refer to the specific process of each genetic operation in step S40 to sequentially mutate, insert, one-point recombine, two-point recombine, and select the matrix, obtain matrices with better fitness values and the same initial iteration size, associate these matrices with the robot population, and through the condition filtering mechanism, obtain conditions not used for genetic operation in every 10 iteration evolution, to delete the corresponding conditions in the condition library and the corresponding condition action rows in each matrix associated with the robot population.
[0128] Then, it is judged whether the evolution iteration number is greater than the iteration number threshold or whether there is a matrix meeting the fitness threshold in the matrix associated with the robot colony, if yes, the evolution is terminated, the matrix with the highest fitness value is obtained, and the target behavior tree is converted to generate the target behavior tree with the highest fitness value, which can represent the best condition and action matching scheme; if not, the next evolution iteration is performed according to all the matrices associated with the robot colony.
[0129] The conversion process of the matrix with the highest fitness value to the target behavior tree is as follows: the combined conditions in each row and the actions matched with the combined conditions are extracted from the matrix with the highest fitness value, the number of sequence nodes, condition nodes and action nodes in the behavior tree is determined according to the number of rows of the matrix, and each combined condition in each row is mapped to a condition node in the behavior tree, and the action matched with the combined condition is mapped to an action node in the behavior tree, so as to obtain the target behavior tree.
[0130] In step S60, the behavior logic of the robot colony facing the multi-target task scene is obtained according to the target behavior tree.
[0131] That is, the execution logic of the target behavior tree is determined based on the execution logic of each type of node in the target behavior tree, the behavior logic of the robot colony facing the multi-target task scene is obtained according to the execution logic of the target behavior tree, and thus the task corresponding to the multi-target task scene is completed.
[0132] In summary, the robot colony behavior logic generation method based on the genetic algorithm provided in the embodiment has the following beneficial effects:
[0133] 1) According to the multi-target task scene and the colony robot for completing the task corresponding to the multi-target task scene, the behavior tree is automatically generated, so as to achieve the purpose of automatically generating the behavior logic of the robot colony;
[0134] 2) Based on the information that can be perceived by the robot colony and the actual executable program, the abstract condition library and the action library are constructed, which is different from the existing work that only perceives a small amount of information. The condition library contains a large number of complex combined conditions, which lays a foundation for generating complex robot colony behavior logic and enabling the robot colony to complete the task corresponding to the multi-target task scene;
[0135] 3) Through the matrix genetic algorithm, the matrix converted from the behavior tree is automatically generated and optimized, and the matrix with the highest fitness value is converted into the target behavior tree containing the best condition and action matching relationship for output. Compared with the traditional evolution algorithm, the matrix genetic algorithm not only has a variety of genetic operations that can be executed in the matrix, but also contains a condition filtering mechanism, which effectively improves the evolution efficiency.
[0136] In a preferred embodiment, as Figure 5As shown, before step S40, the following steps are further included:
[0137] Step S60, a simulation scene containing targets and base stations is constructed by programming the input data of the multi-target task scene.
[0138] In the embodiment, the input data of the multi-target task scene includes target information, group size and group behavior of the group robots; the target information includes the type, number and position of the targets. As preferred, when the group behavior of the group robots includes actions such as search, attack, surround and transport, the multi-target task scene can be a scene required by the group robots to perform tasks such as terrorist search, rescue operation and disaster area monitoring.
[0139] Taking an example of the multi-target task scene containing three types of targets, i.e. targets to be attacked, targets to be captured and targets to be transported, the simulation scene constructed by programming is as shown in Figure 6 wherein, the small square area represents a base station, the black small circle represents a robot in the group, all the robots form a robot group, the center cross circle represents a type 1 target, the center circle represents a type 2 target, and the center triangle circle represents a type 3 target; the type 3 target is a target to be attacked, which has a certain blood volume, when the type 3 target is attacked, the blood volume will decrease, if the blood volume is less than or equal to 0, the type 3 target becomes a type 2 target; the type 2 target is a target to be captured, which has a trap threshold, if the type 2 target is surrounded by multiple robots at the same time, and the surrounding strength is equal to or greater than the trap threshold, the type 2 target becomes a type 1 target; the type 1 target is a target to be transported, which can be transported by any robot, if the type 1 target is transported to the base station, it will be hidden. It should be noted that the type, position and number of the targets in the simulation scene can be adjusted according to the actual task scene.
[0140] In the simulation scene as shown in Figure 6 all the robots are the same, the radius of the robot is 1 meter, has the same sensors and actuators, and the sensors can only sense objects within 6.5 meters.
[0141] Table 1 Condition information that each robot in the robot group can sense
[0142]
[0143] In Table 1, the robot's perceived self-information includes its own state and position, while the perceived environmental information includes the states of targets and neighbors. In the simulation scenario, a robot can only perform one operation on one target at a time step. However, multiple different types of targets may exist around a robot simultaneously. Considering that the robot's currently perceived target information can only correspond to one conditional state, the priorities of the targets can be set, arranged in the order of A1→A2→A3. That is, type 3 target A1 represents the target type that needs to be judged first, and type 1 target A3 represents the target type that needs to be judged last. Priorities can also be set for the robot's perceived neighbor states (including attack state, encirclement state, transportation state, and search state).
[0144] For the above simulation scenario, the robot can perform actions including searching, attacking, surrounding, and transporting. The execution process of each action is as follows:
[0145] The search process is as follows: In the simulation scenario, the robot searches based on a fixed concentration field. Within this field, the closer to the center, the lower the concentration value. Assuming the center of the concentration field is (x0, y0), the specified position (x...)... i ,y i The concentration C(x) i ,y j The calculation formula is:
[0146]
[0147] Where, x i y j They represent the specified positions (x) i ,y i The x and y coordinates of r(x) i ,y j ) represents the distance from the center position (x0, y0) of the concentration field to the specified position (x0, y0). i ,y j The distance to ) is calculated using the following formula:
[0148] r(i,j)=[(x i -x0 / 2) 2 +(y j -y0 / 2) 2 ] 1 / 2 ,
[0149] Where x0 and y0 represent the abscissa and ordinate of the center position of the concentration field, respectively.
[0150] More specifically, in the search process, the robot first moves from the base station to the area with the highest concentration around the base station, when the robot reaches the area with the highest concentration, moves to the area with the lowest concentration, and returns to the base station to continue the next search.
[0151] The execution process of the attack action is: if a robot finds a type 3 target or a neighbor that is attacking, it will approach the type 3 target and attack the target, and the blood volume of the type 3 target will decrease by 1 for each hit.
[0152] The execution process of the hunting action is: if a robot finds a type 2 target or a neighbor that is hunting, it will approach the type 2 target and stay near the target, and when the number of robots hunting the target exceeds the trap threshold of the target to be hunted, the type 2 target is converted to a type 1 target.
[0153] The execution process of the transport action is: if a robot finds a type 1 target, it will move with the type 1 target to the area with the lowest concentration until the robot returns to the base station.
[0154] In step S70, the task requirements corresponding to the simulation scene are obtained, and a fitness function is constructed according to the task requirements.
[0155] In this embodiment, the task requirement is to transport all targets back to the base station in a preset time step. At this time, the fitness function constructed can be expressed as:
[0156]
[0157] Where F is the fitness value, the higher the fitness value F, the better the effect of the group robot in completing the task; N represents the time step set in the task requirement; i represents the current time step; t si represents the total number of state changes of all targets in the simulation scene at the current time step i; t s represents the total number of state changes of all targets in the simulation scene from the initial position to the base station. Optionally, the preset time step is 100 time steps, i.e. N = 100.
[0158] t s The calculation formula of t
[0159]
[0160] Where K represents the number of types of targets in the simulation scene; w k represents the total number of state transitions of the kth type of target transported to the base station; num k represents the total number of the kth type of target.
[0161] t si The calculation formula of t
[0162]
[0163] wherein, t si (k) represents the total number of the i-th time step of the k-th type of target.
[0164] In this embodiment, t si / t s To some extent, it can represent the task completion percentage of the i-th time step, that is, the task completion rate of the i-th time step can be represented as:
[0165] T i =t si / t s *100%.
[0166] It can be understood that the embodiment constructs a simulation scene with an actual scene and constructs a fitness function representing the task requirements to support genetic operations in the matrix genetic algorithm.
[0167] In an optional embodiment, the simulation scene shown in Figure 6 is used as a control group, only the type of target in the simulation scene is changed, different complexity simulation scenes are constructed, and the scalability of the robot swarm behavior logic generation method based on genetic algorithm is verified based on different complexity simulation scenes. Experiments show that although the complexity of the scene increases, the complexity of the scene has little effect on the evolution efficiency, and under different complexity scenes, the growth trend of the fitness value of the robot swarm is consistent and stable, in addition, all generated robot swarm behavior logic can be applied to different complexity scenes to complete the corresponding tasks. That is, the robot swarm behavior logic generation method based on genetic algorithm is suitable for multi-target task scenes of different complexity, and can automatically generate appropriate robot swarm behavior logic, thereby showing strong optimization ability and good scalability. It should be noted that when verifying scalability, the position, number of targets in the simulation scene and the group size of the robot swarm remain unchanged.
[0168] In an optional embodiment, the simulation scene shown in Figure 6 is used as a control group, only the number of targets in the simulation scene is changed, different task simulation scenes are constructed, and the adaptability of the robot swarm behavior logic generation method based on genetic algorithm is verified based on different task simulation scenes. Experiments show that under the condition that the limited time step is 100, the task completion rate of the above different task scenes reaches 100%, which shows that the group robot uses the evolved behavior tree to represent this group behavior logic, which can successfully complete all tasks in all scenes with different target numbers, types and positions, that is, the robot swarm behavior logic generation method based on genetic algorithm has adaptability to different task scenes.
[0169] Secondly, only change the group size of the swarm robots in the simulation scene, construct the simulation scenes with different group sizes, and verify the adaptability of the robot swarm behavior logic generation method based on genetic algorithm based on the simulation scenes with different group sizes. Experiments show that when the group size is large, that is, the swarm robots are composed of more than 6 robots, all the targets in all scenes can be successfully transmitted to the base station at 100 time steps, that is, the robot swarm behavior logic generation method based on genetic algorithm has adaptability to scenes with different group sizes.
[0170] In an optional embodiment, a matrix-type genetic algorithm with a conditional filtering mechanism is used as a control group, the conditional filtering mechanism is removed to construct a genetic algorithm without the conditional filtering mechanism, and the superiority of the matrix-type genetic algorithm is verified based on Figure 6 The simulation scene shown in the figure verifies the superiority of the matrix-type genetic algorithm. Experiments show that the matrix evolved by the matrix-type genetic algorithm is better, and the fitness value is better, that is, the matrix-type genetic algorithm has higher advantages.
[0171] In other embodiments, the behavior tree representing the robot swarm behavior logic, the matrix-type genetic algorithm, and the output results of the robot swarm behavior logic generation method based on genetic algorithm can also be subjected to explainability analysis.
[0172] In summary, experiments show that the robot swarm behavior logic generation method based on genetic algorithm provided in the embodiment has the advantages of strong scalability, high explainability, and strong adaptability, and the matrix-type genetic algorithm has certain superiority compared with existing genetic algorithms.
[0173] In addition, as Figure 7 An embodiment of the present application also provides a robot swarm behavior logic generation system based on genetic algorithm, which comprises a condition library construction module 110, an action library construction module 120, a behavior tree construction module 130, an algorithm construction module 140, a behavior tree optimization module 150, and a behavior logic generation module 160. The detailed description of each functional module is as follows:
[0174] The condition library construction module 110 is used to acquire the condition information perceived by each robot in the robot swarm, and construct a condition library.
[0175] The action library construction module 120 is used to acquire all actions performed by each robot in the robot swarm in a multi-target task scene, and construct an action library.
[0176] The behavior tree construction module 130 is used to construct a behavior tree according to the condition library and the action library.
[0177] The algorithm construction module 140 is configured to construct a matrix genetic algorithm, the matrix genetic algorithm comprises a plurality of genetic operations and a condition filtering mechanism, and the matrix genetic algorithm takes a behavior tree corresponding matrix as an evolution object, and a target behavior tree with a highest fitness value as a target to optimize a robot colony behavior logic.
[0178] The behavior tree optimization module 150 is configured to obtain a plurality of matrices generated by converting a plurality of behavior trees associated with the robot colony by the matrix genetic algorithm, delete useless conditions in a condition library and useless condition action rows in the matrices by the genetic operation and the condition filtering mechanism, and output the target behavior tree with the highest fitness value when an evolution termination condition is met.
[0179] The behavior logic generation module 160 is configured to obtain a behavior logic of the robot colony facing a multi-target task scene according to the target behavior tree.
[0180] In an optional embodiment, the robot colony behavior logic generation system based on the genetic algorithm further comprises a simulation scene construction module and a fitness function construction module, and the detailed descriptions of the functional modules are as follows.
[0181] The simulation scene construction module is configured to construct a simulation scene comprising targets and base stations by programming input data of the multi-target task scene.
[0182] The fitness function construction module is configured to obtain task requirements corresponding to the simulation scene, and construct a fitness function according to the task requirements.
[0183] In an optional embodiment, the condition library construction module 110 comprises the following sub-modules, and the detailed descriptions of the functional sub-modules are as follows.
[0184] The information perception sub-module is configured to determine a multi-target task scene and a robot colony comprising a plurality of robots, and obtain condition information perceived by each robot in the multi-target task scene, the condition information comprising self information and environment information.
[0185] The information processing sub-module is configured to obtain a condition set corresponding to each type of information according to the self information and the environment information.
[0186] The element combination sub-module is configured to arrange and combine elements in each condition set to obtain all condition combinations.
[0187] The library construction sub-module is configured to construct the condition library according to all the condition combinations.
[0188] In an optional embodiment, the behavior tree construction module 130 comprises the following sub-modules, and the detailed descriptions of the functional sub-modules are as follows.
[0189] The node quantity determination submodule is configured to determine the number of each type of node in the behavior tree to be constructed according to the size of the condition library.
[0190] The mapping relationship acquisition submodule is configured to acquire the mapping relationship between each type of element in the abstract library and each type of node in the behavior tree to be constructed, with the condition library and the action library as the abstract library.
[0191] The behavior tree construction submodule is configured to construct the behavior tree according to the number of each type of node and the mapping relationship between each type of element and each type of node, so as to represent the robot group behavior logic by using the behavior tree.
[0192] In an optional embodiment, the behavior tree optimization module 150 comprises the following submodules, and the detailed description of each functional submodule is as follows.
[0193] The parameter acquisition submodule is configured to acquire the initial parameters of the matrix type genetic algorithm, and the initial parameters include the initial scale quantity and the iteration threshold.
[0194] The conversion submodule is configured to acquire the behavior tree associated with the robot group and having the same initial evolution scale size as the initial evolution scale, and convert the behavior tree to generate a matrix corresponding to each behavior tree.
[0195] The detection submodule is configured to detect whether the current evolution iteration number is greater than the evolution iteration threshold.
[0196] The genetic operation submodule is configured to, if not, sequentially perform mutation, insertion, one-point recombination and two-point recombination on each matrix to obtain a new matrix, call the fitness function to evaluate the fitness values of all matrices, select the matrix having the same initial evolution scale size according to the fitness values from high to low, and associate the selected matrix with the robot group.
[0197] The condition filtering submodule is configured to acquire the conditions that are not used for genetic operation in continuous multiple iteration evolutions by using a condition filtering mechanism, mark the conditions as useless conditions, delete the combined conditions corresponding to the useless conditions in the condition library, and delete the condition action rows corresponding to the useless conditions in each matrix associated with the robot group.
[0198] The evolution result output submodule is configured to update the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold or when there is a matrix having a fitness value greater than the fitness threshold in the matrix associated with the robot group, acquire the matrix having the highest fitness value, convert the matrix into a target behavior tree, and output the target behavior tree.
[0199] In an optional embodiment, the conversion submodule comprises the following units, and the detailed description of each functional unit is as follows.
[0200] The matrix row determination unit is configured to obtain the number of sequence nodes in each behavior tree associated with the robot colony, and determine the number of rows of the matrix according to the number of sequence nodes.
[0201] The matrix column determination unit is configured to obtain the number of condition information contained in the condition nodes in the behavior tree, and determine the number of columns of the matrix according to the number of condition information and the preset auxiliary information number.
[0202] The matrix acquisition unit is configured to take the condition nodes and action nodes associated with the sequence nodes in the behavior tree as the row elements of the matrix, fill in the matrix, and obtain the matrix corresponding to the behavior tree.
[0203] The system of the above embodiments is used to implement the corresponding method in the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described here.
[0204] Those skilled in the art should understand that the discussion of any of the above embodiments is only exemplary, and is not intended to imply that the scope of the present application is limited to these examples; under the idea of the present application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes of different aspects of the embodiments of the present application as described above, which are not provided in details for the sake of brevity.
[0205] The embodiments of the present application are intended to cover all such alternatives, modifications and variations as fall within the broad scope of the present application. Therefore, any omission, modification, equivalent replacement, improvement, etc. made in the spirit and principle of the embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A method for generating robot swarm behavior logic based on genetic algorithms, characterized in that, The method comprises the following steps: acquiring condition information perceived by each robot in a robot group, and constructing a condition library; the condition information is acquired by each robot through sensors to perceive surrounding environment information and self information, and the environment information and the self information are taken as the perceivable condition information; acquiring all actions performed by each robot in the robot group in a multi-target task scenario, and constructing an action library; constructing a behavior tree according to the condition library and the action library; constructing a matrix genetic algorithm, which contains multiple genetic operations and a condition filtering mechanism, and taking a matrix corresponding to the behavior tree as an evolution object, and taking a target behavior tree with the highest fitness value as a target to optimize the robot group behavior logic; through the matrix genetic algorithm, a plurality of matrices generated by conversion of a plurality of behavior trees associated with the robot group are acquired, after genetic operations are performed on the plurality of matrices, the condition filtering mechanism is used to delete useless conditions in the condition library and useless condition action rows in the matrices, and when an evolution termination condition is met, a target behavior tree with the highest fitness value is output; acquiring the behavior logic of the robot group facing the multi-target task scenario according to the target behavior tree; generating a matrix corresponding to each behavior tree through conversion, which comprises the following steps: for each behavior tree associated with the robot group, acquiring the number of sequence nodes in the behavior tree, and determining the number of rows of the matrix according to the number of sequence nodes; acquiring the number of condition information contained in the condition nodes in the behavior tree, and determining the number of columns of the matrix according to the number of condition information and a preset auxiliary information number; taking the condition nodes and action nodes associated with the sequence nodes in the behavior tree as row elements of the matrix, and filling the matrix to obtain a matrix corresponding to the behavior tree.
2. The method of claim 1, wherein, The method comprises the following steps: determining a multi-target task scenario and a robot group comprising a plurality of robots, acquiring condition information perceived by each robot in the multi-target task scenario, the condition information comprising self information and environment information; acquiring a condition set corresponding to each type of information according to the self information and the environment information; arranging and combining elements in each condition set to obtain all condition combinations; constructing a condition library according to all condition combinations.
3. The method of claim 1, wherein, The method comprises the following steps: determining the number of nodes of each type in a behavior tree to be constructed according to the size of the condition library; taking the condition library and the action library as abstract libraries, and acquiring a mapping relationship between elements of each type in the abstract libraries and nodes of each type in the behavior tree to be constructed; constructing a behavior tree according to the number of nodes of each type and the mapping relationship between elements of each type and nodes of each type, so as to represent the robot group behavior logic by using the behavior tree.
4. The method of claim 1, wherein, The specific process of the matrix genetic algorithm comprises the following steps: acquiring initial parameters of the matrix genetic algorithm, the initial parameters comprising an initial size number and an iteration number threshold value; acquire a behavior tree associated with the robot group and having the same size as the initial evolution scale, and convert the behavior tree into a matrix corresponding to the behavior tree; detect whether the current evolution iteration number is greater than the evolution iteration threshold value; if not, perform mutation, insertion, one-point recombination and two-point recombination on each of the matrices in turn to obtain new matrices; call a fitness function to evaluate the fitness values of all the matrices, select the matrices having the same size as the initial evolution scale from high to low according to the fitness values, and associate the selected matrices with the robot group; obtain conditions that are not used for genetic operation in continuous iteration evolution through a conditional filtering mechanism, mark the conditions as useless conditions, delete the combined conditions corresponding to the useless conditions in the condition library, and the condition action rows corresponding to the useless conditions in each matrix associated with the robot group; update the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold value or there is a matrix having a fitness value greater than a fitness threshold value in the matrices associated with the robot group, acquire the matrix having the highest fitness value, convert the matrix into a target behavior tree, and output the target behavior tree.
5. The method of claim 1, wherein, Before the matrix-type genetic algorithm is constructed, the method further includes: construct a simulation scene including targets and base stations by programming input data of a multi-target task scene; acquire task requirements corresponding to the simulation scene, and construct a fitness function according to the task requirements.
6. The method of claim 5, wherein, The fitness function is: , in, This is the fitness value; This indicates the time step set in the task requirements; Indicates the current time step; This indicates that all targets in the simulation scenario are at the current time step. The total number of state changes over time; This represents the total number of state changes of all targets in the simulation scenario as they are transmitted from their initial positions to the base station.
7. A genetic algorithm-based robot swarm behavior logic generation system, characterized by, includes: a condition library construction module configured to acquire condition information perceived by each robot in the robot group, and construct a condition library; an action library construction module configured to acquire all actions performed by each robot in the robot group in the multi-target task scene, and construct an action library; a behavior tree construction module configured to construct a behavior tree according to the condition library and the action library; an algorithm construction module configured to construct a matrix-type genetic algorithm, the matrix-type genetic algorithm including a plurality of genetic operations and a conditional filtering mechanism, and taking a matrix corresponding to the behavior tree as an evolution object, and a target behavior tree having the highest fitness value as a target to optimize the behavior logic of the robot group; a behavior tree optimization module configured to acquire a plurality of matrices converted from a plurality of behavior trees associated with the robot group by the matrix-type genetic algorithm, delete useless conditions in the condition library and useless condition action rows in the matrices by the conditional filtering mechanism after genetic operations are performed on the plurality of matrices, and output a target behavior tree having the highest fitness value when an evolution termination condition is met; the conversion of the matrix corresponding to each behavior tree includes: for each behavior tree associated with the robot group, acquire the number of sequence nodes in the behavior tree, and determine the number of rows of the matrix according to the number of sequence nodes; acquire the number of condition information included in the condition nodes in the behavior tree, and determine the number of columns of the matrix according to the number of condition information and a preset auxiliary information number; take the condition nodes and action nodes associated with the sequence nodes in the behavior tree as row elements of the matrix, fill the matrix, and obtain the matrix corresponding to the behavior tree. A behavior logic generation module is configured to obtain behavior logic of the robot group facing the multi-target task scene according to the target behavior tree.
8. The genetic algorithm based robot swarm behavior logic generation system of claim 7, wherein, The condition library construction module comprises: An information perception sub-module is configured to determine a multi-target task scene and a robot group comprising a plurality of robots, and obtain condition information perceived by each robot in the multi-target task scene, the condition information comprising self information and environment information; An information processing sub-module is configured to obtain a condition set corresponding to each type of information according to the self information and the environment information; An element combination sub-module is configured to arrange and combine elements in each condition set to obtain all condition combinations; A library construction sub-module is configured to construct a condition library according to all condition combinations.
9. The genetic algorithm based robot swarm behavior logic generation system of claim 7, wherein, The behavior tree optimization module comprises: A parameter acquisition sub-module is configured to obtain initial parameters of the matrix-type genetic algorithm, the initial parameters comprising an initial scale number and an iteration threshold; A conversion sub-module is configured to obtain a behavior tree associated with the robot group and having the same initial evolution scale size as the initial evolution scale size, and convert the behavior tree into a matrix corresponding to the behavior tree; A detection sub-module is configured to detect whether a current evolution iteration number is greater than the evolution iteration threshold; A genetic operation sub-module is configured to, if not, sequentially perform mutation, insertion, one-point recombination and two-point recombination on each matrix to obtain a new matrix, call a fitness function to evaluate fitness values of all matrices, select the matrices having the same initial evolution scale size in descending order of the fitness values, and associate the selected matrices with the robot group; A condition filtering sub-module is configured to, through a condition filtering mechanism, obtain conditions that are not used for genetic operation in continuous multiple iteration evolutions, mark the conditions as useless conditions, delete combined conditions corresponding to the useless conditions in the condition library, and condition action rows corresponding to the useless conditions in each matrix associated with the robot group; An evolution result output sub-module is configured to update the evolution iteration number, and when the evolution iteration number is greater than the evolution iteration threshold or there is a matrix having a fitness value greater than a fitness threshold in the matrices associated with the robot group, obtain a matrix having the highest fitness value, convert the matrix into a target behavior tree, and output the target behavior tree.