## 2 System Architecture and Problem Formulation
### Design of MOBA-CV-SARSA
```
1: Initial bats' solutions/locations \(X_{\text{l}_{\text{bus}}}=(x_{1},x_{2},\dots,x_{\text{N}})\), velocities \((\text{v}_{i})\), frequencies \((\text{f}_{i})\), loudness \((\text{A}_{i})\), pulse rates \((\text{r}_{i})\);
2:\(\text{i}=\{1,2,\ \dots,\text{\ npop}\ (\text{number of bat's population})\}\), N is dimension of \(X_{\text{l}_{\text{bus}}}\), rand \(\in[0,1]\)
3: Calculate the multi-objective functions value f = \((\text{f}_{1},\text{f}_{2},\dots,\text{f}_{\text{M}})\) for \(X_{\text{l}_{\text{bus}}}\), M is number of multi-objective functions
4: Process non-dominated sorting (based on ranking and crowding distance) for \(X_{\text{l}_{\text{bus}}}\)
5: for t = 1 to T (number of iterations)
6: Update \(A_{\text{f}}\)(\(t+1\)) and \(r_{\text{f}}\)(\(t+1\)) with SARSA
7: for i = 1 to npop
8: Select the best solution/location (\(X_{\text{l}_{\text{bus}}}\))
9: Adjust frequencies \((\text{f}_{i})\) and update velocities \((\text{v}_{i})\), and generate solutions/locations (\(X_{\text{l}_{\text{l}_{\text{bus}}}}\))
10: if rand \(>\) pulse rate \((\text{r}_{i})\) then
11: Generate a local solution/location around the local best solution/location
12: end
13: Calculate the multi-objective functions value f = \((\text{f}_{1},\text{f}_{2},\dots,\text{f}_{\text{M}})\) for \(X_{\text{l}_{\text{bus}},\text{l}_{\text{bus}}}\)
14: if rand \(<\) loudness \((\text{A}_{i})\) then
15: Process multi-objective decision to decide whether \(X_{\text{l}_{\text{new,bus}}}\) replaces \(X_{\text{l}_{\text{bus}}}\)
16: end
17: end
18: Concatenate \(X_{\text{l}_{\text{bus}}}\) and \(X_{\text{l}_{\text{new,bus}}}\)
19: Process non-dominated sorting of \(X_{\text{l}_{\text{bus}}}\) and \(X_{\text{l}_{\text{new,bus}}}\)
20: Select bats' solutions/locations (\(X_{\text{l}_{\text{bus}}}\)) for next iteration
21: end
22: if bats' solutions/locations (\(X_{\text{l}_{\text{bus}}}\)) have the same rank and crowding distance then
23: Sort in ascending order according to energy consumption
24: end
25: Display the final results
```  
**Algorithm 1**Pseudo-code of MOBA-CV-SARSA algorithm. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & \multicolumn{4}{c}{**Q-Table**} \\ \hline \multirow{2}{*}{**State**} & \multicolumn{4}{c}{**Action**} \\ \cline{2-6}  & \((\mathbf{\kappa_{1}}\mathbf{\gamma_{1}})\) & \((\mathbf{\kappa_{2}}\mathbf{\gamma_{2}})\) & \(\cdots\) & \((\mathbf{\kappa_{k-1}}\mathbf{\gamma_{k-1}})\) & \((\mathbf{\kappa_{k}}\mathbf{\gamma_{k}})\) \\ \hline \(X_{\text{l}_{\text{bus}}}=\{x_{1},x_{2},\cdots,x_{\text{N}},\text{r}\}\) & Q\({}_{1,1}\) & Q\({}  
The proposed SARSA reinforcement learning algorithm optimizes hyperparameters \(\alpha\) and \(\gamma\) in a range between 0 and 1. However, to accelerate the convergence, we firstly find the optimal \(\alpha^{*}\) and \(\gamma^{*}\) obtained from MOBA-CV-SARSA with a broad search step. Then, we refine the best solutions using Formulas (17) and (18), creating narrower search intervals with finer steps. \[\alpha\text{ range }(\text{narrow search})=[\lfloor\alpha^{*}\rfloor,\lfloor\alpha^{* }\rfloor+0.1], \tag{17}\]  
\[\gamma\text{ range }(\text{narrow search})=[\lfloor\gamma^{*}\rfloor,\lfloor\gamma^{* }\rfloor+0.1], \tag{18}\]  
Once the identified \(\alpha^{*}\) and \(\gamma^{*}\) values converge to the specific values which are most frequently found, the search range for \(\alpha\) and \(\gamma\) values contracts, triggering automatic switching, as depicted in Figure 7. By executing a fresh search and update within this narrowed range, the method not only hastens convergence but also determines more precise \(\alpha\) and \(\gamma\) values. It balances network latency and energy consumption by optimizing task-offloading decisions. This research employs a multi-objective bat algorithm to negotiate solutions in multi-objective functions. It employs SARSA reinforcement learning to adjust hyperparameters dynamically, eliminating the necessity for intricate hyperparameter experiments. The enhanced MOBA-CV-SARSA-DA can accurately identify suitable parameter ranges.