## 2 Materials and Methods
Mathematically, the velocity and position of each particle are updated using the following equations [22]:  
\[\mathrm{V}_{\mathrm{P,q}}^{\mathrm{k+1}}=\omega.\mathrm{V}_{\mathrm{P,}}^{ \mathrm{k}}+\mathrm{c}_{1}\mathrm{r}_{1}\Big{(}\mathrm{Pbest}_{\mathrm{P,q}}^{ \mathrm{k}}-\chi_{\mathrm{P,q}}^{\mathrm{k}}\Big{)}+\mathrm{c}_{2}\mathrm{r}_{2 }\Big{(}\mathrm{Gbest}_{\mathrm{P}}^{\mathrm{k}}-\chi_{\mathrm{P,q}}^{\mathrm{ k}}\Big{)}\]  
\[\mathrm{X}_{\mathrm{P,q}}^{\mathrm{k+1}}=\mathrm{X}_{\mathrm{P,q}}^{\mathrm{k}}+ \mathrm{V}_{\mathrm{P,q}}^{\mathrm{k+1}}\]  
where  
* \(\mathrm{V}_{\mathrm{P,q}}^{\mathrm{k+1}}\) represents the velocity update of a particle in the search space;
* \(\mathrm{X}_{\mathrm{P,q}}^{\mathrm{k+1}}\) represents the updated position (ANN weight/bias);
* \(\omega\) is the inertia factor controlling exploration vs. exploitation;
* \(\mathrm{c}_{1},\mathrm{c}_{2}\) are acceleration coefficients influencing cognitive (Pbest) and social (Gbest) learning;
* \(\mathrm{r}_{1},\mathrm{r}_{2}\) are the random values between 0 and 1 ensuring stochastic behavior. As such, by iteratively updating ANN weights and biases using PSO, the model converges to an optimal configuration that minimizes queue-related prediction errors in telemedicine systems [4; 23; 24]. The process involves the following steps:  
1. **Data Collection**: The dataset is collected and pre-processed to ensure it is properly structured for effective model training. Input and output parameters are carefully prepared, ensuring that relevant data is available for accurate predictions. Data for this study was generated using the Revoledu online queuing calculator, a web-based tool designed to simulate and evaluate queuing system performance [20]. This tool enables users to input key parameters--including arrival rate (\(\lambda\)), service rate (\(\mu\)), system capacity (N), and number of servers (s)--to compute queuing metrics such as queue length, utilization, and delays for different queuing models. For this study, the M/M/s/N model was selected to simulate a telemedicine queuing system using a scenario-based approach. To ensure variability and robustness in training the predictive models, input values were randomly generated within the following predefined ranges supported by the Revoledu simulator:  
* Arrival rate (\(\lambda\)): 600 to 1000;
* Service rate (\(\mu\)): 100 to 200;
* System capacity (N): 35 to 75;
* Number of servers (s): 11 to 19. A total of 100 unique simulation scenarios were produced using a uniform random sampling strategy across these ranges (as detailed in Appendix A). To ensure reproducibility, a fixed random seed (rng default) was applied during data processing in MATLAB. These datasets were subsequently used for training and optimizing the ANN-PSO models. The data generated was organized in Microsoft Excel, detailing both input parameters and output performance metrics, including queue intensity, system utilization, queue length, delays, and the probability of an idled server. This data was then imported into MATLAB for models' development. To assess the relationships between input and output variables in the 100 generated telemedicine queuing scenarios, a Spearman correlation analysis was performed. The Spearman correlation between inputs and outputs are summarized in Table 1.  
This non-parametric test reveals monotonic relationships. The arrival rate is positively correlated with queue intensity (0.55) and queue length in the system (0.22). However, it is negatively correlated with delay in the queue/system and idle probability, suggesting that the presence of more arrivals reduces the idle time and increases congestion. The service rate has a strong negative correlation with delay in the system (\(-\)0.47) and delay in the queue (\(-\)0.37), indicating that faster service reduces the wait time. But it has a slight positive effect on the idle probability (0.13). The capacity positively affects the queue length and system size, possibly due to the accommodation of more patients.