A method and apparatus for scheduling multi-branch simulation tasks
By processing the planned task queue and branch pair set of simulated entities, the simulated entities can determine their actions based on their own and other entities' states. This solves the flexibility and speed issues of simulation entity modeling methods when complexity changes, and improves simulation speed and decision-making flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING HUARU TECH
- Filing Date
- 2025-08-19
- Publication Date
- 2026-04-21
AI Technical Summary
Existing simulation entity modeling methods cannot adapt to new application modes when the complexity of simulation applications and the style of entity tasks change, and they cannot execute tasks normally at branch decision points, resulting in a decrease in simulation speed.
By obtaining the planned task queue and optional branch pair set of each execution entity, the entity task group and branch task queue are obtained, and task scheduling is performed based on this information, so that the simulation entity can determine its actions according to its own state and the state of other entities.
It improves the flexibility of simulated entity behavior decision-making, reduces waiting time, increases simulation speed, and enables parallel execution of tasks at branch decision points.
Smart Images

Figure CN121092283B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of simulation task scheduling technology, specifically a multi-branch simulation task scheduling method and apparatus. Background Technology
[0002] To reflect the actual occurrence of events in the real world, in simulation applications, the simulated entities in the scenario need to select a suitable action from multiple possible actions at a certain moment based on changes in the environmental situation and the state of external entities, and execute the corresponding action. Currently, there are two main methods for modeling simulated entities: one is coupled modeling of the entity's basic capabilities and task capabilities, and the other is decoupled modeling of the entity's basic capabilities and task capabilities.
[0003] Traditional modeling methods for simulated entities couple basic capabilities with task capabilities, suitable for situations where the basic and task capabilities are relatively simple, and the application styles and task rules are clear and fixed. However, because the task capabilities of the entity model are fixed in this way, as the complexity of the simulation application and the entity's task style change, the entity model's capabilities may become inapplicable to new application modes and task styles, and it also cannot meet the need to pre-build task branches according to specific scenarios.
[0004] To address the aforementioned issues, a simulation entity modeling method has emerged that decouples the basic capabilities and task capabilities of the simulation entity model and models them separately. This allows for flexible setting and construction of task models, meeting the need for diverse task capabilities to be flexibly constructed on demand. While this decoupled modeling method can construct entity tasks and decision-branch tasks based on different simulation scenarios, it still has the following drawbacks: First, the simulation entity task capability model selects the next action based on the entity's current state, lacking the ability to determine its next action based on the state conditions of other entity objects within a specific simulation scenario. Second, in the pre-set sequence of planned tasks (including multi-branch task sequences) of entity object models during scenario editing, even if the branch task conditions are met when the simulation reaches a branch decision point, the decision-branch task cannot execute normally if the entity's previous task has not been executed, thus reducing simulation speed. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a multi-branch simulation task scheduling method and apparatus, which can improve the flexibility of simulation entity behavior decision-making and speed up the simulation.
[0006] To address the aforementioned technical problems, this invention discloses a multi-branch simulation task scheduling method, the method comprising:
[0007] S1. Obtain the planned task queue and optional branch pair set for each execution entity;
[0008] The planned task queue includes several planned tasks; each planned task includes a task number, a task type, a set of trigger conditions, and a task action; the set of trigger conditions includes several trigger conditions.
[0009] The set of optional branch pairs includes several optional branch pairs; each optional branch pair includes a first number and a second number.
[0010] S2. Process the planned task queue of each execution entity to obtain the entity task group of each execution entity;
[0011] The entity task group includes several entity task queues; the entity task queue includes several planned tasks.
[0012] S3. Process the set of optional branches for each execution entity to obtain the branch task queue for each execution entity;
[0013] The branch task queue includes several branch sets; the branch set includes several task numbers.
[0014] S4. Based on the entity task group, the branch task queue and the planned task queue of each execution entity, perform task scheduling on the corresponding execution entity to obtain the simulation end flag.
[0015] As an optional implementation, in the first aspect of the present invention, processing the planned task queue of each execution entity to obtain an entity task group for each execution entity includes:
[0016] S21. Combine all the task types in the planned task queue of the execution entity into a task type set;
[0017] S22. Initialize the entity task queue corresponding to each task type in the task type set to an empty queue;
[0018] S23. Set the current task as the planned task located at the head of the planned task queue;
[0019] Set the current type to the task type of the current task;
[0020] S24. Insert the current task into the entity task queue of the same type as the current task; delete the current task from the planned task queue to obtain the deleted planned task queue;
[0021] S25. Repeat S23 to S24 until the planned task queue is empty.
[0022] S26. Combine the entity task queues corresponding to all the task types in the task type set to obtain the entity task group of the execution entity.
[0023] As an optional implementation, in the first aspect of the present invention, processing the set of optional branch pairs for each execution entity to obtain a branch task queue for each execution entity includes:
[0024] S31. Initialize the initial branch queue to an empty queue;
[0025] S32. Set the current number to the first number of any of the optional branch pairs in the set of optional branch pairs;
[0026] S33. Combine all the optional branch pairs in the optional branch pair set that have the same first number and the current number to obtain the current branch pair set;
[0027] S34. Set the branch set as the union of all the second numbers in the current branch pair set; insert the branch set at the end of the initial branch queue of the execution entity;
[0028] S35. Based on the current set of branch pairs, update the set of optional branch pairs to obtain the updated set of optional branch pairs;
[0029] S36. Repeat S32 to S35 until the set of optional branch pairs after the update process is empty;
[0030] S37, determine the branch task queue of the execution entity as the initial branch queue.
[0031] As an optional implementation, in the first aspect of the present invention, the step of scheduling tasks for the corresponding execution entities based on the entity task group, the branch task queue, and the planned task queue of each execution entity to obtain a simulation end flag includes:
[0032] S41. Perform a first update process on the entity task group to obtain N trigger numbers and the entity task group after the first update; N is the number of entity task queues in the entity task group;
[0033] S42. Based on the N trigger numbers, query the corresponding branch task queues to obtain N branch query information; the branch query information includes query results and query numbers;
[0034] S43. Based on the N branch query information and the corresponding planned task queue, perform a second update process on the corresponding branch task queue to obtain the corresponding branch task queue after the second update.
[0035] S44. Repeat S41 to S43 until all entity task queues of the first updated entity task group and the corresponding second updated branch task queues are empty queues; return to the simulation end flag.
[0036] As an optional implementation, in the first aspect of the present invention, the step of performing a first update process on the entity task group to obtain N trigger numbers and the first updated entity task group includes:
[0037] S411. Obtain the execution state sequence of the corresponding execution entity; the execution state sequence includes N execution states; the value of the execution state is 0 or 1;
[0038] S412. Initialize the first loop count n to 1, and initialize N trigger numbers;
[0039] S413. Determine whether the nth entity task queue in the entity task group is an empty queue, and obtain a first determination result;
[0040] When the first determination result is yes, the entity task group remains unchanged; execute S418;
[0041] If the first judgment result is negative, execute S414;
[0042] S414. Determine whether the value of the nth execution state in the execution state sequence is 1, and obtain a second determination result;
[0043] When the second determination result is yes, the entity task group remains unchanged; execute S418;
[0044] If the second judgment result is negative, execute S415;
[0045] S415. Trigger judgment is performed on the planned task at the head of the nth entity task queue to obtain a third judgment result;
[0046] If the third determination result is negative, the entity task group remains unchanged; execute S418;
[0047] If the third judgment result is yes, execute S416;
[0048] S416. Set the nth trigger number as the task number of the planned task at the head of the nth entity task queue in the entity task group;
[0049] S417. Perform dequeue processing on the nth entity task queue of the entity task group to obtain the nth entity task queue of the entity task group after the first update.
[0050] S418. Increment the value of n by 1;
[0051] S419. Repeat S413 to S418 until n is greater than N, to obtain the first updated entity task group.
[0052] As an optional implementation, in the first aspect of the present invention, the step of querying the corresponding branch task queues based on N trigger numbers to obtain N branch query information includes:
[0053] S421. For each of the N trigger numbers, execute S422 to S429 respectively to obtain the N branch query information;
[0054] S422. Initialize the query number j corresponding to the trigger number to 1;
[0055] S423. Set the current branch set as the j-th branch set in the corresponding branch task queue;
[0056] S424. Determine whether the current branch set contains the task number that is the same as the trigger number, and obtain the branch determination result;
[0057] If the result of the branch judgment is negative, execute S425;
[0058] If the branch determination result is yes, execute S428;
[0059] S425. Increment the value of the query number j corresponding to the trigger number by 1;
[0060] S426. Repeat S423 to S425 until j is greater than the number of branches in the corresponding branch task queue;
[0061] S427. Set the query result corresponding to the trigger number to 0; execute S438;
[0062] S428. Set the query result corresponding to the trigger number to 1;
[0063] S429. Combine the query result corresponding to the trigger number with the query number to obtain the branch query information corresponding to the trigger number.
[0064] As an optional implementation, in the first aspect of the present invention, the step of performing a second update process on the corresponding branch task queue based on N branch query information and the corresponding planned task queue to obtain the corresponding branch task queue after the second update includes:
[0065] S431. Initialize the second loop count k to 1;
[0066] S432. Determine whether the query result of the kth branch query information is 1 to obtain a fourth determination result;
[0067] If the fourth judgment result is yes, execute S433;
[0068] If the result of the fourth judgment is negative, execute S436;
[0069] S433. Set the set of branches to be judged as the m-th branch in the corresponding branch task queue. k The set of branches; the m-th branch k Each of the aforementioned branch sets is deleted from the corresponding branch task queue;
[0070] m k The query number is the query number for the k-th branch query information;
[0071] S434. The set of branches to be judged and the queue of planned tasks are filtered by triggering conditions to obtain a set of triggered branch tasks; the set of triggered branch tasks includes several of the planned tasks.
[0072] S435. Perform branch filtering on the set of triggered branch tasks to obtain branch tasks;
[0073] S436. Obtain the execution state sequence of the corresponding execution entity;
[0074] S437. Determine whether the branch task and the execution state sequence meet the executable conditions to obtain the fifth determination result;
[0075] When the fifth determination result is yes, the branch task is sent to the corresponding execution entity;
[0076] If the result of the fifth judgment is negative, execute S436;
[0077] S438. Increment the value of k by 1;
[0078] S439. Repeat S432 to S438 until k is greater than N, to obtain the corresponding branch task queue after the second update.
[0079] A second aspect of this invention discloses a multi-branch simulation task scheduling device, the device comprising a task acquisition module, an entity task group generation module, a branch task queue generation module, and a task scheduling module;
[0080] The task acquisition module is used to acquire the planned task queue and the set of optional branch pairs for each execution entity;
[0081] The entity task group generation module is used to process the planned task queue of each execution entity to obtain the entity task group of each execution entity.
[0082] The branch task queue generation module is used to process the set of optional branch pairs for each execution entity to obtain the branch task queue for each execution entity.
[0083] The task scheduling module is used to schedule tasks for the corresponding execution entity based on the entity task group, the branch task queue, and the planned task queue of each execution entity, and obtain the simulation end flag.
[0084] A third aspect of this invention discloses another multi-branch simulation task scheduling device, the device comprising:
[0085] Memory containing executable program code;
[0086] A processor coupled to the memory;
[0087] The processor calls the executable program code stored in the memory to execute some or all of the steps in the multi-branch simulation task scheduling method disclosed in the first aspect of the present invention.
[0088] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute some or all of the steps in the multi-branch simulation task scheduling method disclosed in the first aspect of the present invention.
[0089] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0090] This invention processes the planned task queue and optional branch pair set of each execution entity separately to obtain the corresponding entity task group and branch task queue. It then performs task scheduling on the corresponding execution entities to obtain a simulation end flag. This invention enables each execution entity to comprehensively determine its next task action based on its own state and the states of other related execution entities during the simulation, improving the flexibility of the simulation entity's behavioral decisions. Furthermore, it can break through the order of planned tasks, executing different types of planned tasks in parallel at non-branch decision points, and executing selected planned tasks and other planned tasks of different types in parallel at branch decision points, thereby reducing waiting time and accelerating the simulation speed. Attached Figure Description
[0091] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0092] Figure 1 This is a flowchart illustrating a multi-branch simulation task scheduling method disclosed in an embodiment of the present invention.
[0093] Figure 2 This is a schematic diagram of the structure of a multi-branch simulation task scheduling device disclosed in an embodiment of the present invention.
[0094] Figure 3 This is a schematic diagram of another multi-branch simulation task scheduling device disclosed in an embodiment of the present invention. Detailed Implementation
[0095] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0096] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0097] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0098] Example 1
[0099] Please see Figure 1 . Figure 1 This is a flowchart illustrating a multi-branch simulation task scheduling method disclosed in an embodiment of the present invention. Figure 1 The described multi-branch simulation task scheduling method is applied to simulation task scheduling, such as multi-branch simulation task scheduling in hypothetical simulation scenarios like tactical simulations or competitive simulations. This invention does not limit the scope of the application. Figure 1 As shown, the method includes:
[0100] S1. Obtain the scheduled task queue and the set of optional branch pairs for each execution entity.
[0101] It should be noted that the aforementioned execution entity refers to a virtual subject or functional module that, after being assigned a planned task during the scenario simulation, autonomously or under drive performs specific operations, responds to environmental changes, and promotes the simulation process according to specific behavioral rules or state parameters. Multiple execution entities are preset in the scenario simulation. These execution entities can be aircraft, ground vehicles, or communication stations, etc., and are not limited in this embodiment of the invention.
[0102] The aforementioned planned task queue includes several planned tasks; the aforementioned planned tasks include a task number, a task type, a set of triggering conditions, and a task action; the aforementioned set of triggering conditions includes several triggering conditions.
[0103] It should be noted that the task number mentioned above is used to uniquely identify the planned task in the planned task queue. The task number can be set to 1, 2, ... according to the order of the planned tasks in the planned task queue, and this embodiment of the invention does not impose any limitation.
[0104] It should be noted that the above-mentioned mission types can be mobile, reconnaissance, or support types, and the embodiments of the present invention do not limit them.
[0105] It should be noted that the above triggering conditions are used to represent the dependency conditions required for the execution of the task action in the corresponding planned task. These conditions can be the execution entity that executes the corresponding task action, the state of another execution entity (such as an execution entity that has not executed any task action for 5 minutes), or the state of the simulation environment (such as the number of execution entities in the specified simulation area being greater than 5).
[0106] It should be noted that the aforementioned task actions are simulation actions performed by the corresponding execution entity after all trigger conditions in the trigger condition set of the corresponding planned task are met. For example, for a planned task of the maneuver type, its task action could be maneuvering to the left or to the right; for a planned task of the reconnaissance type, its task action could be collecting data from a designated area or transmitting data back to the command terminal; for a planned task of the support type, its task action could be transporting supplies to a designated location or treating wounded personnel in a designated location. This embodiment of the invention does not impose any limitations.
[0107] The aforementioned set of optional branch pairs includes several optional branch pairs; the aforementioned optional branch pairs include a first number and a second number.
[0108] It should be noted that the above-mentioned scheduled task queue describes the execution order of scheduled tasks for the corresponding execution entity without considering branch tasks. Specifically, after the scheduled task with task number i1 is executed by the corresponding execution entity, if there is no first optional branch pair with number i1 in the set of optional branch pairs, then after the triggering condition set of the next scheduled task of the scheduled task with task number i1 is satisfied, the corresponding execution entity continues to execute the next scheduled task of the scheduled task with task number i1. If there is an optional branch pair with number i1 in the set of optional branch pairs, further branch selection is required based on all optional branch pairs with number i1 to determine the next scheduled task to be executed by the corresponding execution entity. The branch selection criteria are as follows:
[0109] ①① For optional branch pairs with first and second numbers i1 and i2 respectively, it means that in the corresponding scheduled task queue, after the scheduled task with task number i1 is executed, if the trigger condition set of the scheduled task with task number i2 is satisfied before the trigger condition set of the next scheduled task with task number i1, the corresponding execution entity will execute the scheduled task with task number i2 and will not execute the next scheduled task with task number i1. ② When any two optional branch pairs (ia, ib) and (ic, id) have the same first number (i.e., ia = ic) but different second numbers (i.e., ib ≠ id), if the trigger condition set of the scheduled task with task number ic is satisfied before the trigger condition set of the scheduled task with task number id, the corresponding execution entity will execute the scheduled task with task number ic and will not execute the scheduled task with task number id; otherwise, the corresponding execution entity will execute the scheduled task with task number id and will not execute the scheduled task with task number ic.
[0110] It should be noted that the above set of triggering conditions for the planned task is satisfied, meaning that all triggering conditions in the planned task are satisfied simultaneously.
[0111] It should be noted that the above-mentioned execution entity can execute several planned tasks of different types simultaneously, and in response to receiving a new planned task, it performs the following operations:
[0112] Detect whether you are currently performing a task of type T n The same planned task yields the execution detection results, where T n For the new planned task received;
[0113] If the test result is yes, stop executing the above task type and T. n The same planned task is replaced with a newly received planned task;
[0114] If the test result is negative, execute the new planned task received directly.
[0115] S2. Process the planned task queue of each of the above-mentioned execution entities to obtain the entity task group of each of the above-mentioned execution entities.
[0116] The aforementioned entity task group includes several entity task queues; the aforementioned entity task queues include several of the aforementioned planned tasks.
[0117] S3. Process the set of optional branches for each of the above execution entities to obtain the branch task queue for each of the above execution entities.
[0118] The aforementioned branch task queue includes several branch sets; the aforementioned branch sets include several of the aforementioned task numbers.
[0119] S4. Based on the above-mentioned entity task group, the above-mentioned branch task queue and the above-mentioned planned task queue of each above-mentioned execution entity, perform task scheduling on the corresponding above-mentioned execution entity to obtain the simulation end flag.
[0120] In an optional embodiment, the above-described processing of the planned task queue for each execution entity to obtain an entity task group for each execution entity includes:
[0121] S21. Combine all the above-mentioned task types in the above-mentioned planned task queue of the above-mentioned execution entity into a task type set.
[0122] It should be noted that the task types in the above task type set are all different.
[0123] S22. Initialize the above-mentioned entity task queues corresponding to each of the above-mentioned task types in the above task type set to empty queues.
[0124] S23. Set the current task as the scheduled task at the head of the scheduled task queue.
[0125] Set the current type to the task type of the current task.
[0126] S24. Insert the current task into the corresponding task type of the entity task queue that is the same as the current task type; delete the current task from the planned task queue to obtain the deleted planned task queue.
[0127] S25. Repeat S23 to S24 until the above-mentioned planned task queue is empty.
[0128] S26. Combine the above-mentioned entity task queues corresponding to all the above-mentioned task types in the above-mentioned task type set to obtain the above-mentioned entity task group of the above-mentioned execution entity.
[0129] It should be noted that by creating corresponding entity task groups for each execution entity, planned tasks of different task types in the planned task queue are assigned to different entity task queues. Planned tasks of the same task type are arranged in sequence to form corresponding entity task queues. This improves scheduling parallelism while preventing action conflicts caused by simultaneous execution of planned tasks of the same task type during subsequent scheduling. For example, if an execution entity's planned task queue includes two planned tasks of the maneuver type, with actions of maneuvering left and right respectively, assigning these two maneuver tasks to the same entity task queue creates a sequence, effectively avoiding action conflicts caused by simultaneous left and right maneuvers. Furthermore, if the execution entity's planned task queue also includes one planned task of the reconnaissance type, this task does not conflict with any of the maneuver tasks of the same execution entity and is assigned to a different entity task queue, thus allowing it to be scheduled for execution simultaneously.
[0130] In another optional embodiment, the above-described processing of the optional branch pairs for each execution entity to obtain a branch task queue for each execution entity includes:
[0131] S31. Initialize the initial branch queue to an empty queue.
[0132] S32. Set the current number to the first number of any of the optional branch pairs in the set of optional branch pairs.
[0133] S33. Combine all the optional branch pairs in the above optional branch pair set that have the same first number as the current number to obtain the current branch pair set.
[0134] S34. Set the above branch set as the union of all the above second numbers in the above current branch pair set; insert the above branch set at the end of the above initial branch queue of the above execution entity.
[0135] S35. Based on the current branch pair set, update the optional branch pair set to obtain the updated optional branch pair set.
[0136] It should be noted that the above update process for the optional branch pair set based on the current branch pair set involves deleting each optional branch pair in the current branch pair set from the optional branch pair set.
[0137] S36. Repeat S32 to S35 until the set of the above optional branches after the update process is empty.
[0138] S37, determine the aforementioned branch task queue of the aforementioned execution entity as the aforementioned initial branch queue.
[0139] In another optional embodiment, the above-mentioned task scheduling for the corresponding execution entity based on the entity task group, the branch task queue, and the planned task queue of each execution entity to obtain the simulation end flag includes:
[0140] S41. Perform the first update process on the above entity task group to obtain N trigger numbers and the above entity task group after the first update; N is the number of the above entity task queues in the above entity task group.
[0141] S42. Based on the N trigger numbers mentioned above, perform query processing on the corresponding branch task queues to obtain N branch query information; the branch query information includes query results and query numbers.
[0142] S43. Based on the N branch query information and the corresponding planned task queue, perform a second update process on the corresponding branch task queue to obtain the corresponding branch task queue after the second update.
[0143] S44. Repeat S41 to S43 until all the above-mentioned entity task queues of the above-mentioned entity task group after the first update, as well as the corresponding above-mentioned branch task queues after the second update, are empty queues; return to the simulation end flag.
[0144] It should be noted that the above simulation end flag is used to indicate the end of the entire simulation task.
[0145] In another optional embodiment, the first update process performed on the aforementioned entity task group to obtain N trigger numbers and the first updated entity task group includes:
[0146] S411. Obtain the execution state sequence of the corresponding execution entity; the execution state sequence includes N execution states; the value of the execution state is 0 or 1.
[0147] It should be noted that the N execution states in the above execution state sequence correspond to N entity task queues. Furthermore, when the ii-th execution state in the above execution state sequence is 1, it indicates that the corresponding execution entity is executing a task of type T. ii The same planned task; when the ii-th execution state in the above execution state sequence is 0, it indicates that the corresponding execution entity is not performing a task of the same type as T. ii The same planned task. The above T ii Let be the task type of any planned task in the ii-th entity task queue of the entity task group, where ii is an integer from 1 to N.
[0148] S412. Initialize the first loop count n to 1, and initialize N of the above trigger numbers.
[0149] It should be noted that the trigger number mentioned above is initialized to an arbitrary value that is different from all task numbers in the scheduled task queue.
[0150] S413. Determine whether the nth queue of the above-mentioned entity task group is an empty queue, and obtain the first judgment result.
[0151] If the first judgment result is yes, the above entity task group remains unchanged; execute S418;
[0152] If the result of the first judgment above is negative, execute S414.
[0153] S414. Determine whether the value of the nth execution state in the above execution state sequence is 1, and obtain the second determination result;
[0154] When the second judgment result is yes, the above entity task group remains unchanged; execute S418;
[0155] If the result of the second judgment above is negative, execute S415.
[0156] S415. Trigger judgment is performed on the planned task at the head of the nth entity task queue to obtain the third judgment result.
[0157] If the result of the third judgment above is negative, the above entity task group remains unchanged; execute S418;
[0158] If the result of the third judgment above is yes, execute S416.
[0159] It should be noted that the above-mentioned triggering judgment for the planned task at the head of the nth entity task queue is to determine whether the triggering condition set for the planned task at the head of the nth entity task queue is satisfied.
[0160] S416. Set the nth trigger number to the task number of the planned task at the head of the nth entity task queue in the entity task group.
[0161] S417. Perform dequeue processing on the nth entity task queue of the above entity task group to obtain the nth entity task queue of the above entity task group after the first update.
[0162] It should be noted that the above-mentioned dequeueing process for the nth entity task queue in the entity task group involves sending the planned task at the head of the nth entity task queue in the entity task group to the corresponding execution entity, and deleting the planned task at the head of the nth entity task queue in the entity task group from the nth entity task queue in the entity task group.
[0163] S418. Increment the value of n by 1.
[0164] S419. Repeat S413 to S418 until n is greater than N, to obtain the first updated entity task group.
[0165] In another optional embodiment, the above-mentioned branch task queues are queried based on N trigger numbers to obtain N branch query information, including:
[0166] S421. For the N trigger numbers mentioned above, execute S422 to S429 respectively to obtain the N branch query information mentioned above.
[0167] S422. Initialize the query number j corresponding to the trigger number to 1.
[0168] S423. Set the current branch set to the j-th branch set in the corresponding branch task queue.
[0169] S424. Determine whether the current branch set contains the same task number as the trigger number, and obtain the branch determination result.
[0170] If the result of the above branch judgment is negative, execute S425;
[0171] If the result of the above branch judgment is yes, execute S428.
[0172] S425. Increment the value of the query number j corresponding to the trigger number by 1.
[0173] S426. Repeat S423 to S425 until j is greater than the number of branches in the corresponding branch task queue.
[0174] S427. Set the query result corresponding to the above trigger number to 0; execute S438.
[0175] S428. Set the query result corresponding to the above trigger number to 1.
[0176] S429. Combine the query result corresponding to the above trigger number with the above query number to obtain the branch query information corresponding to the above trigger number.
[0177] In another optional embodiment, based on the N branch query information and the corresponding planned task queue, the corresponding branch task queue is subjected to a second update process to obtain the corresponding branch task queue after the second update, including:
[0178] S431. Initialize the second loop count k to 1.
[0179] S432. Determine whether the query result of the kth branch query information is 1 to obtain the fourth judgment result;
[0180] If the result of the fourth judgment above is yes, execute S433;
[0181] If the result of the fourth judgment above is negative, execute S436.
[0182] S433. Set the set of branches to be judged to the m-th branch in the corresponding branch task queue. k The above branch set; the m-th branch set; k The above-mentioned branch set is deleted from the corresponding above-mentioned branch task queue;
[0183] m k The query number is the query number for the kth branch above.
[0184] S434. The above-mentioned set of branches to be judged and the above-mentioned planned task queue are filtered by trigger conditions to obtain the set of triggered branch tasks; the above-mentioned set of triggered branch tasks includes several of the above-mentioned planned tasks.
[0185] S435. Perform branch filtering on the above set of triggered branch tasks to obtain branch tasks.
[0186] S436. Obtain the execution state sequence of the corresponding execution entity.
[0187] S437. Determine whether the above branch tasks and the above execution state sequence meet the executable conditions, and obtain the fifth judgment result;
[0188] When the result of the fifth judgment above is yes, the above branch task will be sent to the corresponding execution entity above;
[0189] If the result of the fifth judgment above is negative, execute S436.
[0190] It should be noted that the fifth judgment result mentioned above is used to indicate whether the corresponding execution entity is executing a planned task with the same task type as the branch task.
[0191] S438. Increment the value of k by 1.
[0192] S439. Repeat S432 to S438 until k is greater than N, to obtain the corresponding branch task queue after the second update.
[0193] In another optional embodiment, the determination of whether the above-mentioned branch task and the above-mentioned execution state sequence meet the executable conditions to obtain a fifth determination result includes:
[0194] S4371, Target type T o Set the task type to the above branch task.
[0195] S4372. Set the current state to task type T. o The entity task queue, and the corresponding execution state in the execution state sequence.
[0196] S4373. Determine the value of the current state;
[0197] If the current state value is 1, set the result of the fifth judgment to no;
[0198] If the current state value is 0, set the result of the fifth judgment to yes.
[0199] In another optional embodiment, the above-mentioned filtering of the set of branches to be judged and the above-mentioned planned task queue to obtain the set of triggered branch tasks includes:
[0200] S4341. Initialize the third loop count p to 1, and initialize the above set of trigger branch tasks to an empty set.
[0201] S4342. Set the tasks to be filtered to the task number in the above-mentioned planned task queue and s. p The same planned tasks as above; s p Let p be the number of the aforementioned task in the set of branches to be judged.
[0202] S4343. Determine whether the above set of triggering conditions for the above-mentioned tasks to be screened is satisfied, and obtain the screening judgment result;
[0203] When the above filtering judgment result is yes, the above task to be filtered is added to the above trigger branch task set;
[0204] When the above screening result is negative, the above set of trigger branch tasks remains unchanged.
[0205] S4344, Increment the value of p by 1.
[0206] S4345. Repeat S4342 to S4344 until p is greater than the number of the above task numbers in the above set of branches to be judged.
[0207] In yet another optional embodiment, the branch filtering of the aforementioned set of triggering branch tasks to obtain branch tasks includes:
[0208] S4351. Determine whether the above set of triggering branch tasks includes more than one of the above planned tasks to obtain the sixth determination result;
[0209] When the result of the sixth judgment above is yes, set the above branch task as the above planned task in the above set of triggering branch tasks; execute S436;
[0210] If the result of the sixth judgment above is negative, execute S4452.
[0211] S4352. Using the priority calculation model, process the above set of triggering branch tasks to obtain a priority set.
[0212] The aforementioned priority set includes the priority value corresponding to each planned task in the aforementioned set of triggering branch tasks.
[0213] The expression for the above priority calculation model is:
[0214]
[0215] In the formula, P l The priority value is the l-th planned task in the set of triggering branch tasks; l is an integer from 1 to M; M is the number of planned tasks in the set of triggering branch tasks; I l C is the sequence number of the l-th planned task in the set of triggered branch tasks, within the planned task queue of the corresponding execution entity; l The number of planned tasks that have been executed by the corresponding execution entity and whose task type is the same as the l-th planned task in the set of triggered branch tasks; σ is a preset attenuation coefficient.
[0216] As can be seen from the above priority calculation model, in the set of triggering branch tasks, the higher the priority value of the planned task that is at the front of the planned task queue of the corresponding execution entity and has been executed less times by the corresponding execution entity of the same type.
[0217] S4353. Set the above branch task as the planned task corresponding to the highest priority value in the above priority set.
[0218] As can be seen, implementing the multi-branch simulation task scheduling method described in the embodiments of the present invention enables each execution entity to comprehensively determine the next task action to be executed during the simulation process based on its own state and the states of other related execution entities, thereby improving the flexibility of the simulation entity's behavioral decision-making. In addition, it can break through the order of arrangement in the planned tasks, execute different types of planned tasks in parallel at non-branch decision points, and execute the selected planned tasks and other planned tasks of different types in parallel at branch decision points, thereby reducing waiting time and speeding up the simulation.
[0219] Example 2
[0220] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of a multi-branch simulation task scheduling device disclosed in an embodiment of the present invention. Figure 2 The described multi-branch simulation task scheduling device can be applied to simulation task scheduling, such as multi-branch simulation task scheduling in hypothetical simulation scenarios like tactical simulations or competitive simulations. This invention does not limit the scope of the application. Figure 2 As shown, the device may include a task acquisition module 201, an entity task group generation module 202, a branch task queue generation module 203, and a task scheduling module 204.
[0221] The task acquisition module 201 mentioned above is used to acquire the planned task queue and the set of optional branch pairs for each execution entity.
[0222] The entity task group generation module 202 is used to process the planned task queue of each of the above-mentioned execution entities to obtain the entity task group of each of the above-mentioned execution entities.
[0223] The aforementioned branch task queue generation module 203 is used to process the aforementioned optional branch pair set of each of the aforementioned execution entities to obtain the branch task queue of each of the aforementioned execution entities.
[0224] The task scheduling module 204 is used to schedule tasks for the corresponding execution entities based on the entity task group, branch task queue and planned task queue of each execution entity, and obtain the simulation end flag.
[0225] As can be seen, implementing the multi-branch simulation task scheduling device described in the embodiments of the present invention enables each execution entity to comprehensively determine the next task action to be executed during the simulation process based on its own state and the states of other related execution entities, thereby improving the flexibility of the simulation entity's behavioral decision-making. In addition, it can break through the order of arrangement in the planned tasks, execute different types of planned tasks in parallel at non-branch decision points, and execute the selected planned tasks and other planned tasks of different types in parallel at branch decision points, thereby reducing waiting time and speeding up the simulation.
[0226] Example 3
[0227] Please see Figure 3 , Figure 3 This is a schematic diagram of another multi-branch simulation task scheduling device disclosed in an embodiment of the present invention. Figure 3 The described multi-branch simulation task scheduling device can be applied to simulation task scheduling, such as multi-branch simulation task scheduling in hypothetical simulation scenarios like tactical simulations or competitive simulations. This invention does not limit the scope of the application. Figure 3 As shown, the multi-branch simulation task scheduling device may include the following parts:
[0228] Memory 301 storing executable program code;
[0229] Processor 302 coupled to memory 301;
[0230] The processor 302 calls the executable program code stored in the memory 301 to execute the steps in the multi-branch simulation task scheduling method described in Embodiment 1.
[0231] Example 4
[0232] This invention discloses a computer read storage medium that stores a computer program for electronic data interchange, wherein the computer program causes a computer to execute the steps in the multi-branch simulation task scheduling method described in Embodiment 1.
[0233] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0234] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0235] Finally, it should be noted that the multi-branch simulation task scheduling method and apparatus disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-branch simulation task scheduling method, characterized in that, include: S1. Obtain the planned task queue and optional branch pair set for each execution entity; The planned task queue includes several planned tasks; each planned task includes a task number, a task type, a set of trigger conditions, and a task action; the set of trigger conditions includes several trigger conditions. The set of optional branch pairs includes several optional branch pairs; each optional branch pair includes a first number and a second number; the values of the first number and the second number are the task number; S2. Process the planned task queue of each execution entity to obtain the entity task group of each execution entity; The entity task group includes several entity task queues; the entity task queue includes several planned tasks. S3. Process the set of optional branches for each execution entity to obtain the branch task queue for each execution entity; The branch task queue includes several branch sets; the branch set includes several task numbers. S4. Based on the entity task group, the branch task queue, and the planned task queue of each execution entity, perform task scheduling on the corresponding execution entity to obtain the simulation end flag; S4 includes: S41. Perform a first update process on the entity task group to obtain N trigger numbers and the entity task group after the first update; N is the number of entity task queues in the entity task group; S42. Based on the N trigger numbers, query the corresponding branch task queues to obtain N branch query information; the branch query information includes query results and query numbers; S43. Based on the N branch query information and the corresponding planned task queue, perform a second update process on the corresponding branch task queue to obtain the corresponding branch task queue after the second update. S44. Repeat S41~S43 until all the entity task queues of the first updated entity task group and the corresponding second updated branch task queues are empty queues; return to the simulation end flag.
2. The multi-branch simulation task scheduling method according to claim 1, characterized in that, The process of processing the planned task queue of each execution entity to obtain the entity task group for each execution entity includes: S21. Combine all the task types in the planned task queue of the execution entity into a task type set; S22. Initialize the entity task queue corresponding to each task type in the task type set to an empty queue; S23. Set the current task as the planned task located at the head of the planned task queue; Set the current type to the task type of the current task; S24. Insert the current task into the entity task queue of the same type as the current task; delete the current task from the planned task queue to obtain the deleted planned task queue; S25. Repeat S23~S24 until the planned task queue is empty; S26. Combine the entity task queues corresponding to all the task types in the task type set to obtain the entity task group of the execution entity.
3. The multi-branch simulation task scheduling method according to claim 1, characterized in that, The process of processing the set of optional branches for each execution entity to obtain the branch task queue for each execution entity includes: S31. Initialize the initial branch queue to an empty queue; S32. Set the current number to the first number of any of the optional branch pairs in the set of optional branch pairs; S33. Combine all the optional branch pairs in the optional branch pair set that have the same first number and the current number to obtain the current branch pair set; S34. Set the branch set as the union of all the second numbers in the current branch pair set; insert the branch set at the end of the initial branch queue of the execution entity; S35. Based on the current set of branch pairs, update the set of optional branch pairs to obtain the updated set of optional branch pairs; S36. Repeat S32~S35 until the set of optional branch pairs after the update process is an empty set; S37, determine the branch task queue of the execution entity as the initial branch queue.
4. The multi-branch simulation task scheduling method according to claim 1, characterized in that, The first update process for the entity task group, resulting in N trigger numbers and the first updated entity task group, includes: S411. Obtain the execution state sequence of the corresponding execution entity; the execution state sequence includes N execution states; the value of the execution state is 0 or 1; S412. Initialize the first loop count n to 1, and initialize N trigger numbers; S413. Determine whether the nth entity task queue in the entity task group is an empty queue, and obtain a first determination result; When the first determination result is yes, the entity task group remains unchanged; execute S418; If the first judgment result is negative, execute S414; S414. Determine whether the value of the nth execution state in the execution state sequence is 1, and obtain a second determination result; When the second determination result is yes, the entity task group remains unchanged; execute S418; If the second judgment result is negative, execute S415; S415. Trigger judgment is performed on the planned task at the head of the nth entity task queue to obtain a third judgment result; If the third determination result is negative, the entity task group remains unchanged; execute S418; If the third judgment result is yes, execute S416; S416. Set the nth trigger number as the task number of the planned task at the head of the nth entity task queue in the entity task group; S417. Perform dequeue processing on the nth entity task queue of the entity task group to obtain the nth entity task queue of the entity task group after the first update. S418. Increment the value of n by 1; S419. Repeat S413~S418 until n is greater than N, to obtain the first updated entity task group.
5. The multi-branch simulation task scheduling method according to claim 1, characterized in that, The process involves querying the corresponding branch task queues based on the N trigger numbers to obtain N branch query information, including: S421. For each of the N trigger numbers, execute S422~S429 respectively to obtain N branch query information; S422. Initialize the query number j corresponding to the trigger number to 1; S423. Set the current branch set as the j-th branch set in the corresponding branch task queue; S424. Determine whether the current branch set contains the task number that is the same as the trigger number, and obtain the branch determination result; If the result of the branch judgment is negative, execute S425; If the branch determination result is yes, execute S428; S425. Increment the value of the query number j corresponding to the trigger number by 1; S426. Repeat S423~S425 until j is greater than the number of branches in the corresponding branch task queue; S427. Set the query result corresponding to the trigger number to 0; execute S438; S428. Set the query result corresponding to the trigger number to 1; S429. Combine the query result corresponding to the trigger number with the query number to obtain the branch query information corresponding to the trigger number.
6. The multi-branch simulation task scheduling method according to claim 1, characterized in that, The step of performing a second update process on the corresponding branch task queue based on the N branch query information and the corresponding planned task queue to obtain the second-updated corresponding branch task queue includes: S431. Initialize the second loop count k to 1; S432. Determine whether the query result of the kth branch query information is 1 to obtain a fourth determination result; If the fourth judgment result is yes, execute S433; If the result of the fourth judgment is negative, execute S436; S433. Set the set of branches to be judged as the first branch in the corresponding task queue. The set of branches; the first Each of the aforementioned branch sets is deleted from the corresponding branch task queue; The query number is the query number for the k-th branch query information; S434. The set of branches to be judged and the queue of planned tasks are filtered by triggering conditions to obtain a set of triggered branch tasks; the set of triggered branch tasks includes several of the planned tasks. S435. Perform branch filtering on the set of triggered branch tasks to obtain branch tasks; S436. Obtain the execution state sequence of the corresponding execution entity; S437. Determine whether the branch task and the execution state sequence meet the executable conditions to obtain the fifth determination result; When the fifth determination result is yes, the branch task is sent to the corresponding execution entity; If the result of the fifth judgment is negative, execute S436; S438. Increment the value of k by 1; S439. Repeat S432~S438 until k is greater than N, to obtain the corresponding branch task queue after the second update.
7. A multi-branch simulation task scheduling device, characterized in that, The device includes a task acquisition module, an entity task group generation module, a branch task queue generation module, and a task scheduling module; The task acquisition module is used to implement step S1 of the multi-branch simulation task scheduling method as described in claim 1; The entity task group generation module is used to implement step S2 of the multi-branch simulation task scheduling method as described in claim 1. The branch task queue generation module is used to implement step S3 of the multi-branch simulation task scheduling method as described in claim 1; The task scheduling module is used to implement step S4 of the multi-branch simulation task scheduling method as described in claim 1.
8. A multi-branch simulation task scheduling device, characterized in that, The device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the multi-branch simulation task scheduling method as described in any one of claims 1-6.
9. A computer-storable medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the multi-branch simulation task scheduling method as described in any one of claims 1-6.
Citation Information
Patent Citations
Combat simulation scheme design and operation method based on decision point and branch simulation
CN110210115A
Analog simulation task processing method and device, equipment and readable storage medium
CN116595773A