## 3 Materials and Methods
### Finding the Distribution of Input Variables  
Here, we have to assign values to three different input variables: _UPLOAD_LATENCY_, _PROC_TIME_ALG_1_, _PROC_TIME_ALG_2_. _UPLOAD_LATENCY_ stands for the time needed to transfer the raw ECG data between the client and the server. Since the upload time can be represented as a Transmission Control Protocol (TCP) traffic flow, we can use a probability distribution that is commonly used for latencies in network traffic. In computer networks, taking into account the capabilities of TCP, it is obvious that small packets are more likely to occur in a TCP session than large packets, due to the Maximum Transmission Unit (MTU) [28]. This concept can significantly improve the latency in a network. Since there are more small packets in the session, the packet size follows a long-tailed distribution. [PERSON] et al. [29] highlighted the role of the Weibull distribution in Internet traffic modeling. Based on all observations [30], we applied the Weibull probability distribution to provide an accurate approximation of the upload time value. A basic upload time is the ratio of the payload of the packet to the guaranteed bandwidth of the upload. _PROC_TIME_ALG_1_ and _PROC_TIME_ALG_2_ variables denote the execution time of the aggregation algorithms. Since the execution time of a third-party algorithm depends heavily on the applied programming techniques, the input data and the amount of resources \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Examined Time**} & \multirow{2}{*}{**Maximum Number**} & **Number of Possible** & \multirow{2}{*}{**Number of**} \\  & & **Outcomes after** & \\  & & & **One Step** & \\ \hline
10 s & 1 & 2 & 1 \\
30 s & 3 & 2 & 4 \\
1 min & 6 & 2 & 32 \\
5 min & 30 & 2 & \(536,870,912\) \\
10 min & 60 & 2 & \(5.7646\times 10^{17}\) \\
30 min & 180 & 2 & \(7.6625\times 10^{53}\) \\
1 h & 360 & 2 & \(1.1743\times 10^{108}\) \\
3 h & 1080 & 2 & \(2^{109}\) \\
6 h & 2160 & 2 & \(2^{2159}\) \\
12 h & 4320 & 2 & \(2^{4319}\) \\
24 h & 8640 & 2 & \(2^{8639}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Size of state space considering the length of the observed measurement period. allocated to the execution, determining the probability distribution is a more complicated task. Here, we gathered samples from the algorithm execution. We started with the AF detection algorithm that processes the raw ECG data window and returns back if, and how often, it detects AF. In order to obtain homogeneous execution times, we need to make sure that the following two conditions are met. * Since execution times can vary greatly between systems, it is important to evaluate the algorithm on the same system. * A significant number and a variety of input data is used during evaluation. Considering the use case, the algorithms are running in the cloud, so we wanted to have a simulation environment that can be easily used in different environments. We use a portable environment in the form of a Docker image [31], so we can start container instances, running the algorithm with pre-configured resource limits. This is also reasonable because different computing instance configurations can be started with different costs. In order to fulfill the second requirement and have a representative data set, we used the training and validation set of CinC Challenge 2017 [20; 21]. We created a histogram of the execution times and tried to find the best matching PDF using the Python package Scipy [32]. The best matching function must have the lowest Sum of Squares for Error (SSE) that is calculated with the formula presented in Equation (6) [33]. \[SSE=\sum_{i=1}^{n}{(Y_{i}-Y_{i})^{2}} \tag{6}\]  
Although the best-fit PDF produces the lowest SSE, this value can be further reduced by fine-tuning the parameters of the function. Our goal is to find the distribution that best describes reality. This is the point when we turn to a global optimization problem. There are several methods for finding the global optimum.