# Bee Swarm Metropolis-Hastings Sampling for Bayesian Inference in the Ginzburg-Landau Equation
## 3 The Proposed BeeSwarm-MH Algorithm
### Hybrid Sampling Framework Integrating Bee Swarm Intelligence with MH
#### 3.1.2 Global Exploration by Scout Bees  
The global exploration module for scout bees is a critical component of the BeeSwarm-MH sampling algorithm, which is designed to ensure comprehensive coverage of the parameter space by applying staged random perturbations. This mechanism prevents the algorithm from getting trapped in local modes and maintains both sampling diversity and global search capability. Specifically, the algorithm adaptively adjusts the perturbation intensity factor \(s\in\{\gamma_{1},\gamma_{2},\gamma_{3}\}\) based on the current iteration number \(t\) and the predefined stage thresholds \(T_{1}\) and \(T_{2}\). This phased strategy enables the algorithm to use larger step sizes in early iterations for broad exploration, gradually reducing the step size in later stages to focus on the fine-grained exploitation of promising regions, thus balancing exploration and convergence. For all individuals labeled as scout bees (scout), the algorithm implements an MH sampling step using a multivariate normal proposal distribution. Each scout bee uses its current position \(\theta_{i}\) as the mean and generates a new candidate parameter \(\hat{\theta}_{i}\) from a scaled covariance matrix \(s\cdot\Sigma^{\prime}\), where \(\Sigma^{\prime}=\eta\cdot\Sigma\). The log-posterior of the candidate point is then evaluated as  
\[f_{\text{prop}}=\mathcal{F}(\hat{\theta}_{i}).\]The acceptance probability is computed according to the MH criterion:  
\[\alpha=\min\bigl{\{}1,\exp\bigl{(}f_{\text{prop}}-f_{\text{curr}}\bigr{)}\bigr{\}},\]  
where \(f_{\text{curr}}\) is the current log-posterior value. A uniform random variable \(u\sim\mathcal{U}(0,1)\) is sampled, and if \(u<\alpha\), the candidate point is accepted, updating the scout's position and posterior; otherwise, the current position remains unchanged. This procedure guarantees the detailed balance condition and preserves the correctness of the target posterior distribution. Through this parallel execution of randomized perturbations and acceptance steps, the scout bee module effectively maintains the diversity and stochasticity of the swarm sampling process, providing rich and promising starting points for the subsequent local exploitation phase driven by worker bees. The worker bees capitalize on the prior information identified by scouts to perform high-density local sampling and refined search, achieving a coordinated evolution from global coarse positioning to local fine optimization that significantly improves the efficiency and accuracy of inference in complex Bayesian posteriors. The complete procedure is detailed in Algorithm 2. ```
0: Swarm state \(\mathcal{B}\), current iteration \(t\), stage thresholds \(T_{1},T_{2}\), covariance matrix \(\Sigma\), scaling factor \(\eta\)
0: Updated scout bee positions and corresponding posterior values
1:if\(t<T_{1}\)then
2:\(s\leftarrow\gamma_{1}\) (Large-step perturbations in early phase)
3:elseif\(t<T_{2}\)then
4:\(s\leftarrow\gamma_{2}\) [Moderate-step perturbations in middle phase]
5:else
6:\(s\leftarrow\gamma_{3}\) [Small-step, fine-grained perturbations in late phase]
7:endif
8:for each \(a\in\mathcal{B}\) with \(\textit{a.r}\mathsf{ole}=\texttt{scout}\)do
9:\(\theta_{i}\gets\textit{a.pos},f_{\text{curr}}\gets\textit{a.posterior}\)
10:\(\Sigma^{\prime}\leftarrow\eta\cdot\Sigma\)
11: Sample proposal \(\hat{\theta}_{i}\sim\mathcal{N}(\theta_{i},s\cdot\Sigma^{\prime})\)
12: Compute log-posterior \(f_{\text{prop}}\leftarrow\mathcal{F}(\hat{\theta}_{i})\)
13: Compute acceptance rate \(\alpha\leftarrow\min\bigl{\{}1,\exp\bigl{(}f_{\text{prop}}-f_{\text{curr}} \bigr{)}\bigr{\}}\)
14: Sample \(u\sim\mathcal{U}(0,1)\)
15:if\(u<\alpha\)then
16: Accept proposal: \(\textit{a.pos}\leftarrow\hat{\theta}_{i},\textit{a.posterior}\gets f_{ \text{prop}}\)
17:endif
18:endfor
```  
**Algorithm 2** Global Exploration by Scouts  
After scout bees identify high-potential regions in the parameter space, the algorithm transitions to the local exploitation phase led by worker bees.