Asynchronous conservative time management method and device based on adaptive task unlocking
By adopting an asynchronous conservative time management method based on adaptive task unlocking in parallel distribution simulation, the calculation tasks are dynamically unlocked and scheduling based on interference index and dependency index priority scheduling, the problems of time window update overhead and rollback in the asynchronous time management method are solved, and the effect of efficient utilization of computing resources and improving the operation efficiency of simulation is achieved.
Patent Information
- Application Number
- CN202510103201.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-01-22
AI Technical Summary
In parallel distribution simulation, asynchronous time management methods will lead to large time window update overhead and large rollbacks, seriously wasting computing resources.
Adopting an asynchronous conservative time management method based on adaptive task unlocking, the calculation task is dynamically unlocked by grouping multiple agents and initializing the ready queue and waiting queue, and the task execution of the agent grouping is scheduled according to the interference index and the dependency index priority.
This method can dynamically unlock computing tasks according to changes in constraints during operation, efficiently utilize computing resources, improve simulation operation efficiency, reduce scheduling overhead and optimize cache access efficiency.
Smart Images

Figure CN119537039B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of simulation technology, and in particular to an asynchronous conservative time management method and device based on adaptive task unlocking. Background Art
[0002] In parallel distributed simulation research, the target system to be studied is represented as a set of simulation entities. The entities influence each other by transmitting simulation events (or messages) with timestamps, thereby driving the evolution of the simulation system over time. Simulation entities are assigned to different groups, called logical processes. Assigning logical processes to multiple computing units for simultaneous execution can effectively reduce the simulation running time. However, since the event processing rates of different logical processes may be inconsistent, it is necessary to schedule and coordinate the execution of logical processes through a time management mechanism to ensure global logical consistency, which is also the core problem to be solved in parallel distributed simulation.
[0003] Generally speaking, time management algorithms can be divided into two categories: conservative and optimistic. Conservative time management algorithms can only execute events when it is ensured that the logical process will not violate the timestamp order; optimistic time management algorithms relax the restriction of "not violating the timestamp order at all", and the logical process executes events in the current "visible" timestamp order. Only after the timestamp disorder actually occurs, the error is repaired by methods such as rollback. For simulation applications with good foresight, conservative algorithms can work well. Depending on whether global synchronization is required, conservative time management algorithms can be further divided into synchronous conservative algorithms and asynchronous conservative algorithms. Synchronous conservative time management is based on a unified time window. Only after all logical processes complete the simulation tasks of the current window can the next stage of tasks be started; asynchronous conservative time management algorithms update the time constraints of each logical process through the "empty message" mechanism, and the logical process can advance independently according to its own time window.
[0004] However, due to the small-world characteristics of social networks, the distance between agents is short, resulting in strong dependencies between individuals. The use of asynchronous time management methods will have a large time window update overhead, while the use of optimistic time management to control the public opinion dynamics model will produce a large number of rollbacks, seriously wasting computing resources. Therefore, it is urgent to propose a time management method that dynamically unlocks computing tasks according to changes in constraints during operation, and efficiently utilizes computing resources to improve simulation operation efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide an asynchronous conservative time management method and device based on adaptive task unlocking to address the above technical problems.
[0006] An asynchronous conservative time management method based on adaptive task unlocking, the method comprising:
[0007] Group the multiple agents participating in the simulation to obtain N agent groups;
[0008] Initialize the pre-set ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set.
[0009] When When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue;
[0010] If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0011] An asynchronous conservative time management device based on adaptive task unlocking, the device comprising:
[0012] A grouping module is used to group multiple agents participating in the simulation to obtain N agent groups;
[0013] An initialization module is used to initialize the preset ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set.
[0014] Ready to operate module, used when the When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue;
[0015] The waiting operation module is used to take out the agent groups from the waiting queue in order according to the dependency index priority if the ready queue is empty. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0016] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0017] Group the multiple agents participating in the simulation to obtain N agent groups;
[0018] Initialize the pre-set ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set.
[0019] When When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue;
[0020] If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0021] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0022] Group the multiple agents participating in the simulation to obtain N agent groups;
[0023] Initialize the pre-set ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set.
[0024] When When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue;
[0025] If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0026] The above-mentioned asynchronous conservative time management method and device based on adaptive task unlocking divides the intelligent agents into several groups and performs task scheduling in groups, thereby reducing scheduling overhead and optimizing cache access efficiency, initializing the pre-set ready queue and waiting queue, and when the first When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue. If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the step is generated, and a new message dependency of the subsequent time step is generated. The waiting queue is updated according to the new message dependency, and the computing task can be dynamically unlocked according to the change of the constraint condition during the operation. The embodiment of the present invention can efficiently utilize computing resources and improve the efficiency of simulation operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1It is an application scenario diagram of an asynchronous conservative time management method based on adaptive task unlocking in one embodiment;
[0028] Figure 2 A schematic diagram of simulation tasks and dependency analysis of an intelligent agent in one embodiment;
[0029] Figure 3 A schematic diagram of execution dependency based on grouping in one embodiment;
[0030] Figure 4 It is a flowchart of an asynchronous conservative time management method based on adaptive task unlocking in a specific embodiment;
[0031] Figure 5 It is a structural block diagram of an asynchronous conservative time management device based on adaptive task unlocking in one embodiment;
[0032] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0034] In one embodiment, Figure 1 As shown, an asynchronous conservative time management method based on adaptive task unlocking is provided, comprising the following steps:
[0035] Step 102, grouping the multiple agents participating in the simulation to obtain N agent groups.
[0036] In the multi-agent-based public opinion dynamics simulation, individuals need to perform a series of tasks at each time step, including determining the source of messages (according to probability), reading messages from friends and random push messages, updating their own opinion values, making decisions and expressing opinions, etc. Figure 2 The figure shows the dependency analysis of the agent’s simulation tasks, which shows the dependencies of these tasks and distinguishes them according to internal dependencies (control flow) and external dependencies (data flow). The simulation task mainly relies on friends and random push. Whether the moment view message exists, that is, the relevant individual has completed The first step of the simulation task is to determine the source of the message. Therefore, the simulation tasks of different agents are interdependent and the dependencies are constantly changing. The asynchronous conservative time management algorithm of the present invention needs to unlock the computing tasks with less management overhead according to the dynamic dependencies to achieve full utilization of computing resources.
[0037] The purpose of this invention is to analyze the multi-agent parallel mode of simulation tasks and dynamically unlock computing tasks according to changes in constraints during operation. Comprehensively consider the impact on future tasks and the dependence on past tasks to perform two-stage collaborative scheduling, and efficiently use computing resources to improve simulation operation efficiency. First, the agents are divided into several groups (denoted as AgentGroup) and scheduled based on the group as the basic unit. It can reduce scheduling overhead and optimize cache access efficiency. Time step grouping The execution task is recorded as , perform the task The sufficient condition is Completed and its dependent groups have completed the tasks of the previous step. Figure 3 In the group-based execution dependency diagram shown, even if Not yet completed, You can still execute Then, this feature is used to unlock local tasks to avoid global synchronization waiting. Finally, based on the above grouping and local task unlocking, an asynchronous conservative time management method is implemented.
[0038] Step 104, initialize the preset ready queue and waiting queue, the initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set.
[0039] The asynchronous conservative time management method of the present invention realizes scheduling and synchronization through a ready queue and a multi-level waiting queue. In the waiting queue, AgentGroup is divided into different levels according to the time step, and the same level is arranged from small to large according to the dependency index. The groups in the waiting queue need to dynamically check whether the execution dependency is satisfied before they can be executed; in the ready queue, AgentGroup is arranged from small to large according to the interference index, and the groups in the ready queue can be executed as long as they obtain computing resources. At initialization, the time step If set to 0, all AgentGroups are stored in the ready queue.
[0040] Step 106, when When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue.
[0041] The interference index is used to measure the grouping of agents The influence of The smaller the interference index, the more The smaller the influence of the opinions, or the fewer groups it depends on, the easier it is to be unlocked and executed. The interference index priority refers to the group of agents with small interference index. Priority. By giving priority to scheduling groups with smaller interference indexes, delays caused by unsatisfied dependencies are reduced, and the probability of successful dependency unlocking is increased.
[0042] In a multi-agent simulation system, the tasks of various agents (or groups of agents) are often interdependent. The opinions, decisions or states of each agent will affect the tasks of other agents. When executing their own tasks, some groups need to read the output messages of other groups as input to make their own decisions or calculations. In the The message dependency grouping in the first step refers to The execution of the simulation task of the step needs to rely on the current agent A group of other agents that share a view, state, or decision.
[0043] Since the simulation is performed in time steps, the execution of tasks in each time step may generate new message dependencies. The output message of the current agent will affect the input of other agents in future time steps, so the message dependency may change after each time step.
[0044] Step 108: If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0045] The smaller the dependency index, the more agents are grouped. The fewer dependencies a message source has, the easier it is to satisfy its execution dependencies and the higher the probability of executing the task. Dependency index priority refers to the grouping of agents with small dependency indexes. priority.
[0046] In the above asynchronous conservative time management method based on adaptive task unlocking, the agents are divided into several groups and task scheduling is performed in groups to reduce scheduling overhead and optimize cache access efficiency. The pre-set ready queue and waiting queue are initialized. When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue. If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the step is generated, and a new message dependency of the subsequent time step is generated. The waiting queue is updated according to the new message dependency, and the computing task can be dynamically unlocked according to the change of the constraint condition during the operation. The embodiment of the present invention can efficiently utilize computing resources and improve the efficiency of simulation operation.
[0047] In one embodiment, the ready queue includes agent groups arranged from small to large according to the interference index; the waiting queue includes different simulation time step levels, and each level includes agent groups arranged from small to large according to the dependency index at the corresponding time step.
[0048] In one embodiment, the dependency index is calculated by grouping each agent in The time is obtained as the number of packets of the message output target.
[0049] Due to the dynamic interaction rules between individuals, individuals cannot know in advance the target individuals who need their opinion messages, so they can only read the messages after the target individuals determine the source of the messages. Therefore, the message interaction between groups is realized by reading and writing shared variables.
[0050] For any group , define the dependency index for Time The number of groups as the message output target. The smaller the dependency index, the less likely the group is to fail to meet the execution dependency. Updates need to be computed at each step.
[0051] In one embodiment, the step of obtaining the interference index includes: if the agent groups have friendship relationships, the interference index is the minimum dependency index of the agent group among all friends; if the agent groups do not have friendship relationships, the interference index is the total number of groups.
[0052] definition Indicates The number of dependent groups based on friend relationships can be further defined express Interference index:
[0053] ;
[0054] in, Indicates that based on friendship The set of groups affected by opinions, i.e. any Existence concerns The individual among individuals. and Although they are different, they are highly correlated. By giving priority to scheduling groups with smaller interference indexes, it can be ensured that when groups with smaller dependency indexes are given priority, there is a higher probability of successful dependency unlocking.
[0055] The dependency index and interference index are used to measure the dependency and influence between groups, and to arrange task scheduling reasonably. Prioritizing the scheduling of groups with smaller interference indexes and fewer dependencies can unlock subsequent tasks more efficiently, reduce unnecessary dependency checks, and thus improve the execution efficiency of simulation tasks. In social networks, groups influenced by friend relationships It has strong correlation and dependence, and the interference index reflects the strength of this influence.
[0056] In one embodiment, the method further includes: if the current agent group Satisfied in The execution dependency condition of the step is executed, then the current agent group is executed in the For each simulation task of the next step, the number of group task completions increases by 1.
[0057] In one embodiment, the method further comprises: if all agent groups in the ready queue have completed the first The simulation task of the step will wait in the queue The agent groups corresponding to the level are moved into the ready queue.
[0058] In one embodiment, the method further includes: if the current agent group The message dependency grouping is not completed If the simulation task of step 1 is not completed, The message dependencies of the simulation tasks are grouped in the The message dependency group of the step is added to the waiting queue.
[0059] In a specific embodiment, Figure 4 The flowchart of the asynchronous conservative time management method based on adaptive task unlocking is shown in the figure. During initialization, the time step Set to 0, all AgentGroups are saved in the ready queue. During execution, when the thread is idle, first check whether the ready queue is not empty. If it is not empty, the groups are taken out in order of interference index priority, recorded as Execute the group After completing the simulation task, the group will complete the number of Add 1. If all groups have completed the The simulation tasks of the first step mean that The execution dependency condition of the step has been met. At this time, you can directly put the waiting queue without checking. All packets in the first level are moved to the ready queue and continue to execute according to the above process. For a simulation task of step 1, you need to generate In the The message dependency of the next step is added to the waiting queue. If the ready queue is empty, the packets are taken out from the waiting queue in order of dependency index priority, recorded as At this time, you need to check Whether the dependent group has completed the For the group that has completed the task, you can read its corresponding viewpoint message. If all dependencies are met, you can execute No. After completing the simulation task, a new message dependency can be generated and added to Because dependency check operation is not essential for simulation business, the unlock success rate should be improved as much as possible to reduce management overhead. In this algorithm, for groups with smaller dependency index, For example, the groups it depends on have a smaller interference index, and these groups will be scheduled first. This collaborative scheduling mechanism can greatly improve the unlocking success rate and avoid invalid checking operations. The present invention makes comprehensive use of the unified time advancement and local dependency unlocking methods, which can dynamically generate new tasks when there are insufficient parallel tasks to avoid idle computing resources, and can also use unified state updates to avoid excessive dependency checks. Moreover, when scheduling and selecting groups, the impact on future tasks and the dependency on past tasks will be comprehensively considered to improve the unlocking success rate.
[0060] It should be understood that although Figure 1The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0061] In one embodiment, Figure 5 As shown, an asynchronous conservative time management device based on adaptive task unlocking is provided, comprising:
[0062] A grouping module 502 is used to group multiple agents participating in the simulation to obtain N agent groups;
[0063] Initialization module 504, used to initialize the preset ready queue and waiting queue, the initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set;
[0064] Ready operation module 506, used when the When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the priority of the interference index. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue;
[0065] Waiting operation module 508 is used to take out the agent groups from the waiting queue in order according to the dependency index priority if the ready queue is empty. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
[0066] In one embodiment, the ready queue includes groups of agents arranged from small to large according to interference index; the waiting queue includes different simulation time step levels, and each level includes groups of agents arranged from small to large according to dependency index at the corresponding time step.
[0067] In one embodiment, the dependency index is obtained by grouping each agent in The time is obtained as the number of packets of the message output target.
[0068] In one of the embodiments, if there is a friendship among the agent groups, the interference index is the minimum dependency index of the agent group among all friends; if there is no friendship among the agent groups, the interference index is the total number of groups.
[0069] In one embodiment, it is also used if the current agent group Satisfied in The execution dependency condition of the step is executed, then the current agent group is executed in the For each simulation task of the next step, the number of group task completions increases by 1.
[0070] In one embodiment, if all agent groups in the ready queue have completed the first The simulation task of the step will wait in the queue The agent groups corresponding to the level are moved into the ready queue.
[0071] In one embodiment, it is also used if the current agent group If the message-dependent group of has not completed the simulation task of step t, then the unfinished step The message dependencies of the simulation tasks are grouped in the The message dependency group of the step is added to the waiting queue.
[0072] For the specific limitations of the asynchronous conservative time management device based on adaptive task unlocking, please refer to the limitations of the asynchronous conservative time management method based on adaptive task unlocking in the above text, which will not be repeated here. Each module in the above-mentioned asynchronous conservative time management device based on adaptive task unlocking can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0073] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an asynchronous conservative time management method based on adaptive task unlocking is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0074] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0075] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.
[0076] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0077] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0078] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0079] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An asynchronous conservative time management method based on adaptive task unlocking, characterized in that: The method comprises: Group the multiple agents participating in the simulation to obtain N agent groups; Initialize the pre-set ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set. When When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the interference index priority. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue; If the ready queue is empty, the agent groups are taken out from the waiting queue in order according to the dependency index priority. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
2. The method according to claim 1, characterized in that The ready queue includes agent groups arranged from small to large according to interference index; the waiting queue includes different simulation time step levels, and each level includes agent groups arranged from small to large according to dependency index at the corresponding time step.
3. The method according to claim 2, characterized in that The dependency index is obtained by grouping each agent in The time is obtained as the number of packets of the message output target.
4. The method according to claim 2, characterized in that: The steps of obtaining the interference index include: If there is a friendship among the agent groups, the interference index is the minimum dependency index of the agent group among all friends. If there is no friendship among the agent groups, the interference index is the total number of groups.
5. The method according to claim 1, characterized in that The method further comprises: If the current agent group Satisfied in The execution dependency condition of the step is executed, then the current agent group is executed in the For each simulation task of the next step, the number of group task completions increases by 1.
6. The method according to claim 5, characterized in that The method further comprises: If all agent groups in the ready queue have completed the The simulation task of the step will wait in the queue The agent groups corresponding to the level are moved into the ready queue.
7. The method according to claim 1, characterized in that The method further comprises: If the current agent group The message dependency grouping is not completed If the simulation task of step 1 is not completed, The message dependencies of the simulation tasks are grouped in the The message dependency group of the step is added to the waiting queue.
8. An asynchronous conservative time management device based on adaptive task unlocking, characterized in that: The device comprises: A grouping module is used to group multiple agents participating in the simulation to obtain N agent groups; An initialization module is used to initialize the preset ready queue and waiting queue. The initialized ready queue includes N agent groups, and the initialized waiting queue is an empty set; Ready to operate module, used when the When there is an idle thread, if the ready queue is not empty, the agent groups are taken out from the ready queue in order according to the interference index priority. And execute, if the current agent group Not satisfied with The execution dependency condition of the step, then the current agent In the The message dependency group of the step is added to the waiting queue; The waiting operation module is used to take out the agent groups from the waiting queue in order according to the dependency index priority if the ready queue is empty. , if the current agent group The message dependency groups are completed The simulation task of the current agent group is executed In the The simulation task of the N-step is executed, and new message dependencies are generated for the subsequent time steps. The waiting queue is updated according to the new message dependencies, and the initialization steps are iterated until the tasks of the N-agent groups are completed.
Citation Information
Patent Citations
Asynchronous task processing method and device, computer equipment and storage medium
CN110990132A
Intelligent agent dynamic scheduling method and device based on deadlock prediction
CN119130307A