# 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.3 Local Exploitation by Worker Bees  
The local exploitation module for worker bees in the BeeSwarm-MH sampling framework is responsible for the fine-grained exploration of high-potential regions, mimicking the collective foraging behavior of bees around a food source to achieve efficient sampling of local modes in the posterior distribution. This module adaptively selects the local perturbation intensity factor \(s\in\{\delta_{1},\delta_{2},\delta_{3}\}\) based on the current iteration \(t\) and the stage thresholds \(T_{1}\) and \(T_{2}\). This phased approach ensures that early iterations maintain larger perturbations to avoid premature convergence, while later stages focus on the precise local exploitation of promising regions.  
The core mechanism is based on information sharing and probabilistic leadership. The algorithm constructs an exponential-weighted distribution over all individuals' log-posterior values:  
\[P(i)\propto\exp(f_{i}),\]  
and samples a leader index \(\ell\) from this distribution. This strategy is analogous to a pheromone mechanism, preferentially selecting high-posterior individuals as leaders to strengthen the exploitation of high-fitness regions.  
For each worker bee, a multivariate normal proposal distribution is defined around the leader's position \(\theta_{\ell}\) with covariance \(s\cdot\Sigma\), from which a candidate solution \(\hat{\theta}_{i}\) is drawn. The log-posterior at the proposal is evaluated as \(f_{\text{prop}}\) and compared with the current value \(f_{\text{curr}}\) using the MH acceptance probability:  
\[\alpha=\min\{1,\exp(f_{\text{prop}}-f_{\text{curr}})\}.\]  
A uniform random variable \(u\sim\mathcal{U}(0,1)\) is then sampled, and the proposal is accepted if \(u<\alpha\), updating the bee's position and posterior value.  
This collaborative exploitation mechanism significantly increases the sampling density and statistical efficiency in local optimum regions. Combined with the staged perturbation adjustment, the module adapts to different phases of sampling convergence, achieving balanced and efficient local sampling in multimodal, complex posterior distributions. The detailed procedure is presented in Algorithm 3.  
```
0: Swarm state \(\mathcal{B}\), current iteration \(t\), stage thresholds \(T_{1}\), \(T_{2}\), covariance matrix \(\Sigma\)
0: Updated worker bee positions and corresponding posterior values
1:if\(t<T_{1}\)then
2:\(s\leftarrow\delta_{1}\)
3:elseif\(t<T_{2}\)then
4:\(s\leftarrow\delta_{2}\)
5:else
6:\(s\leftarrow\delta_{3}\)
7:endif
8: Construct probability distribution \(P(i)\propto\exp(f_{i})\) and sample leader index \(\ell\sim P\)
9:for each \(a\in\mathcal{B}\) with \(a.\texttt{role}=\texttt{worker}\)do
10: Leader position \(\theta_{\ell}\leftarrow\mathcal{B}[\ell].\texttt{pos}\)
11: Sample proposal \(\hat{\theta}_{i}\sim\mathcal{N}(\theta_{\ell},s\cdot\Sigma)\)
12: Compute log-posterior \(f_{\text{prop}}\leftarrow\mathcal{F}(\hat{\theta}_{i})\)
13: Current log-posterior \(f_{\text{curr}}\gets a.\texttt{posterior}\), compute acceptance rate \(\alpha\leftarrow\min\{1,\exp(f_{\text{prop}}-f_{\text{curr}})\}\)
14: Sample \(u\sim\mathcal{U}(0,1)\)
15:if\(u<\alpha\)then
16: Accept proposal: \(a.\texttt{pos}\leftarrow\hat{\theta}_{i}\), \(a.\texttt{posterior}\gets f_{\text{prop}}\)
17:endif
18:endfor
```  
**Algorithm 3** Local Exploitation by Workers  
The worker bee local exploitation strategy enables a fine-grained search around high-potential regions, substantially improving the algorithm's ability to approximate optimal solutions. Given the dynamic nature of the search landscape, fixed step sizes struggle to balance exploration and exploitation; therefore, an adaptive step-size adjustment mechanism is introduced to dynamically optimize the search scale, further enhancing the convergence efficiency and optimization performance.