## 3 Mathematical Modeling Formulation
### Formulation of the Objective Function  
The optimization model proposed in this study is tailored to tackle a complex challenge with multiple competing goals. In contrast to conventional optimization problems, it does not have a singular solution, but rather, any feasible solution that meets the specified constraints can be deemed optimal. The primary objective is to balance safety and efficiency in the deployment of BSSs and the dynamic configuration of switches, considering factors such as unit commitment, controllable distributed generation capacities, and power interactions with the main network for each hour ahead. The overarching goal of this comprehensive planning is to ensure both optimal and secure operations by considering all technical network parameters while accommodating the charging and discharging activities of BSSs and dynamic switches over time. To achieve this, a novel multiobjective optimization strategy is devised based on the gray wolf optimization technique. The planning challenge is framed as a multiobjective function, as depicted in Equation (29), aiming to strike a balance between conflicting objectives and constraints effectively.  
\[\min\text{OBJ}_{\text{total}}=\min\bigl{\{}\text{Obj}_{k}(N_{\text{BSS}},L_{ \text{BSS}},C_{\text{BSS}},S_{0},1)\bigr{\}}_{k=1,\ldots,7} \tag{29}\]  
In the equation provided, the variables \(N_{BSS}\) and \(L_{BSS}\) denote the quantity and location of battery storage systems (BSSs), while the parameters \(C_{BSS}\) and \(S_{0,1}\) represent the capacity of the BSSs and the statuses of dynamic switches in the objective functions of the planning problem under consideration. Consequently, the objective functions sought in this research can be articulated as a set of seven interconnected objectives to address the complexities of the planning scenario at hand as a follows:  
\[\min\text{OBJ}_{\text{total}}=\min\left\{\begin{bmatrix}\gamma_{1}\ \gamma_{2}\...\ \gamma_{k}\end{bmatrix} \begin{bmatrix}\text{Obj}_{1}(N_{\text{BSS}},L_{\text{BSS}},C_{\text{BSS}}, S_{0},1)\\ \text{Obj}_{2}(N_{\text{BSS}},L_{\text{BSS}},C_{\text{BSS}},S_{0},1)\\ \vdots\\ \text{Obj}_{k}(N_{\text{BSS}},L_{\text{BSS}},C_{\text{BSS}},S_{0},1)\end{bmatrix} \right\}_{k=1,\ldots,7} \tag{30}\]  
In Equation (30), the variable \(\gamma_{k}\) symbolizes the weight coefficient associated with the objective functions. When adjusting these weights for each objective function, it is crucial to consider specific events and system characteristics, such as varying system states during maintenance, replacement schedules, the probability of component failures, and diverse error occurrences within the system, each resulting in unique system performance conditions. These weights are fine-tuned to accurately reflect the importance of these events and characteristics within the overarching optimization framework. By assigning higher weights to certain objective functions, their impact on the optimization process is amplified, indicating their relative significance in achieving the desired system performance levels. The process of adjusting these weights involves a thorough assessment of each event and system attribute to ensure an optimal and well-rounded solution for the multiobjective optimization task.