## 5 Dynamic Optimization of the Crowdsourcing Platform
### Dynamic Optimization Engine Based on Metric Indices
In this case, we build the current state vector of the platform using the current values of the arrival rate (\(\lambda\)) and the number of volunteer peers in the network (non-controllable parameters); the current values of the controllable parameters \(H_{1}\), \(\text{ALG}_{1}\), \(TTL_{1}\), and \(C_{1}\); and the performance metrics reported by the platform. The subscript 1 is used to indicate that these values were observed at time \(T_{1}\)

Figure 5: Steps involved in the building phase of the dynamic optimization engine. Afterwards, the dynamic optimization engine detects that the ISP is overloaded, and sets the 10 th element of the vector of Figure 4_IPS Net Utilization_ = 20%. In addition, we set the consensus percentage = 100%, because we want to maximize this metric in all cases. Other metrics (peer utilization, server utilization, P2P Net Utilization) are set according to the values of the current state vector, because these resources are not saturated. Given that the platform is in a stress situation, we use the constant \(R_{1}>R_{3}>R_{2}\). In other words, we give more priority to searching for configuration vectors that have the expected values of the metrics ISP Net Utilization = 20% and consensus = 100%. In this way, the dynamic optimization engine searches in the stress metric index for similar vectors, and returns the top-\(k\) configuration vectors at time \(T_{1}^{\prime}\). Then, the engine selects the configuration vector from the top-\(k\) list that best matches the non-controllable parameters (arrival rate and number of peers). Finally, the engine applies the constants \(1/R_{1},1/R_{3}\), and \(1/R_{2}\) to the selected configuration vector before sending the updated parameter configuration to the platform. In this example, the new configuration vector has controllable parameter values (\(H_{1}^{\prime}\), \(\text{ALG}_{1}^{\prime}\), \(TTL_{1}^{\prime}\) y \(C_{1}^{\prime}\)). At time \(T_{2}\), the average ISP utilization is below 40%, so the platform is in a stress-free situation. In this case, the dynamic optimization engine applies the constant values \(R_{1}>R_{2}>R_{3}\), to give priority to the controllable parameters, so that the platform can recover configurations similar to those assigned at the beginning of the crowdsourcing campaign. At time \(T_{2}^{\prime}\), the dynamic optimization engine returns a configuration vector obtained from the non-stress index, with a configuration of controllable parameters \(H_{2}^{\prime}\), \(\text{ALG}_{2}^{\prime}\), \(TTL_{2}^{\prime}\), and \(C_{2}^{\prime}\) that will be similar to the initial configuration of the platform. Notice that the engine applies the constants \(1/R_{1},1/R_{3}\), and \(1/R_{2}\) to the selected configuration vector before sending the updated parameter configuration to the platform. Search Phase

The dynamic optimization engine periodically receives the state of the platform and suggests new controllable parameter values using the metric space indices. Algorithm 3 describes this process. The engine receives the state of the platform (stress or non-stress), the current configuration vector of the platform, the number \(k\) of similar vectors to retrieve from the indices, the number of pivots, and both indices created with Algorithm 1 (stress_index and Nstress index). In line 2, we check if the platform is overloaded (stress). If so, we set the values of the constants \(R_{1}\), \(R_{2}\), and \(R_{3}\) to give more priority to the non-controllable parameters and then to the metrics (line 3). We then multiply the values of the current state vector of the platform by these constants (line 4). That is, we multiply the first two elements of the _vector_ by \(R_{1}\), the following four elements by \(R_{2}\), and the last five elements by \(R_{3}\). In line 5, we search for the top-\(k\) most similar vectors in the _stress_index_ using the SEARCH_NN function described in Algorithm 4. Figure 6: ISP utilization: At time \(T_{1}\), the network utilization exceeds 40%, indicating a state of stress.