# Research and Application of a Multi-Agent-Based Intelligent Mine Gas State Decision-Making System
## 3 Hybrid Multi-Agent Orchestration Algorithm
### Algorithm Design  
This section provides a detailed explanation of the design principles and implementation steps for the hybrid multi-agent orchestration algorithm. The algorithm integrates centralized and distributed strategies through a layered architecture, aiming to achieve an organic combination of global optimization and local flexibility. The overall process of the algorithm is shown in Algorithm 1. ```
Input: Task set T, Agent set A, System objective function \(\Omega\), Local objective functions { \(A_{i}\)},  Information exchange function f  Output: Global task allocation matrix \(A_{i}\), Local task allocation matrices {\(A_{i}\)[i]}  Initialize \(A_{i}\) and {\(A_{i}\)[i]}  while not termination condition do \(A_{i}\leftarrow\) GlobalTaskPlanning(T, \(\Lambda\), \(\Omega\)) for each Agent \(i\) in \(A\) do \(A_{i}\)(i) = LocalTaskAllocation(T, \(A_{i}\), \(A_{i}\),Inf\(\rho_{i}\) ) for each Agent \(i\) in \(A\) do \(I_{ij}\leftarrow\) {\(Inf\{In\rho_{i},Inf\rho_{i}\}\)} \(A_{i}\)(i) and \(A_{i}\)[i] based on \(I_{ij}\) end for Update \(A_{i}\) based
```  
**Algorithm 1**Pseudocode of the hybrid multi-agent orchestration algorithm (Hybrid Task Scheduling Algorithm). The algorithm primarily consists of four stages: global-level planning, local-level allocation, task execution, and information interaction. During each stage, information is exchanged and processed among the agents to ensure the successful completion of tasks. Global Level Planning: The central control unit \(C_{U}\) performs global task planning, resource allocation, and coordinated control based on the system's overall objective function \(\Omega\). This process results in the formation of a global task allocation matrix, \(A_{G}\), which is represented by the following formula:  
\[\underset{A_{G}}{\text{min}}\Omega=\alpha T(A_{G})+\beta C(A_{G})-\gamma P(A_ {G}), \tag{5}\]  
Here, \(T(A_{G})\), \(C(A_{G})\), and \(P(A_{G})\) represent the task execution time, the amount of Token consumption, and the system stability, respectively. Local-Level Allocation: Each agent, based on the global-level task allocation matrix \(A_{G}\) and its own perceived information performs local task allocation to generate the local-level task allocation matrix \(A_{L}[i]\). This is expressed using the following formula:  
\[A_{L}[i]=\textit{arg}\underset{A_{L}}{\text{min}}\Lambda_{i}(A_{L}[i],Info_{ i})\, \tag{6}\]  
Here, \(\Lambda_{i}\) represents the local objective function for Agent \(i\), and \(Info_{i}\) denotes the perceived information of Agent \(i\). Task Execution: Each agent executes tasks based on the local-level task allocation matrix \(A_{L}[i]\) while simultaneously exchanging information and collaborating with other agents. The content of the information exchange includes the following:  
* Task Execution Progress: Agents periodically exchange information on task execution progress to keep track of each other's work status. * Local Environmental Status: Agents share information about the local environmental conditions, such as sensor readings, equipment status, and so on. * Resource Utilization: Agents exchange information regarding resource usage, such as the amount of tokens used. Iterative Optimization: Based on the task execution results and information exchange outcomes, the task allocation strategies at both the global and local levels are iteratively optimized until the termination condition is met. This can be expressed with the following formula:  
\[A_{G}^{(t+1)}=Update\Big{(}A_{G}^{(t)},Feedback\Big{)}, \tag{7}\]  
This collaborative approach can enhance task execution efficiency. Firstly, information exchange helps agents understand each other's work status and resource utilization, allowing for better coordination in task execution and avoiding resource wastage and conflicts. Secondly, collaboration enables each agent to leverage its strengths to collectively complete complex tasks, thereby improving overall task execution efficiency.