# -- Select and Attempt task -- ```
## 4 Enhancing Performance by Avoiding Unwarranted Task Executions
### A Semi-Formal Analysis of the CA Algorithm to Identify and Avoid Unwarranted Task Executions
So, consider a scenario where the performance of \(BP_{1}\) on \(task_{3}\) on its first trial is 0. After it succeeds, it will increase the weight of \(co_{1}\) to the value \(w^{\prime}=0.55\) by using equation \(w^{\prime}=w+a\cdot(1-w)\), where \(\alpha=0.1\) in our experiments. Now, let \(C_{2}\) request the execution of \(task_{3}\) broadcasting the message \(m_{2}=(request,C_{2},task_{3})\). When \(BP_{1}\) receives message \(m_{2}\) and because it already has the connection \(co_{1}\), it will calculate the average weight of existing connections as \(average=\frac{w_{co_{1}}}{1}=0.55\). Then, it will create the connection \(co_{2}=(BP_{1},C_{2},0.55,task_{3})\), initializing its weight to the average just calculated. Since the condition \(w\geq Threshold\) is satisfied, \(BP_{1}\) will execute \(task_{3}\) for \(C_{2}\). Suppose that \(BP_{1}\) fails this time and decreases the weight of \(co_{2}\) to the value \(w^{\prime}=0.505\). The scenario continues with two consecutive failed executions of \(task_{3}\) for consumers \(C_{3}\) and \(C_{4}\). In Table 4, we can see the average weights of the connections after each task execution. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Consumer** & **Result** & **Final Weight of the New Connection** & **Average Weight** \\ \hline \(C_{1}\) & success & \(w_{co_{1}}=0.55\) & 0.55 \\ \(C_{2}\) & failure & \(w_{co_{2}}=0.505\) & 0.5275 \\ \(C_{3}\) & failure & \(w_{co_{3}}=0.48025\) & 0.51175 \\ \(C_{4}\) & failure & \(w_{co_{4}}=0.462925\) & 0.499544 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Evolution of average connection weights after each execution of \(task_{3}\) for consumer \(C_{1}\) to \(C_{4}\). In the scenario above, \(BP_{1}\) needed three consecutive failed executions after the successful first execution of \(task_{3}\) to learn (according to Definition 1) that it is not capable of always performing this task in a successful way, because the average weight of its connections for \(task_{3}\) is now less than the threshold value. This leads us to the following more general conclusion. The successful execution of \(task_{3}\) on the first trial of a bad provider requires a number of consecutive failed executions to learn that it cannot always execute this task successfully. Phase D: Provider \(BP_{1}\) learns its incapability in performing \(task_{4}\). Since \(BP_{1}\) has a performance range in \([-10,\ 0]\) and \(task_{4}\) requires a \(performance\geq-5\) to be successful, \(BP_{1}\) has a good probability of being successful in its first trial of \(task_{4}\). If we repeat the analysis of phase C, we will be led to the following conclusion. The successful execution of \(task_{4}\) on the first trial of a bad provider requires a number of consecutive failed executions to learn that it cannot always execute this task successfully. Phase E: Provider \(BP_{1}\) learns its capability in performing \(task_{5}\). Since \(BP_{1}\) has a performance range in \([-10,\ 0]\) and \(task_{5}\) is successfully executed if \(performance\geq-10\), \(BP_{1}\) will always execute this task successfully. A bad provider will always execute \(task_{5}\)  
Ideally, we would prefer that a bad provider not provide the service at all, because its poor performance harms the consumer, but providing the service at least once is required to assess the provider's capabilities. However, the previous analysis demonstrates that the CA algorithm allows the bad provider to provide the service multiple times. Despite its negative performance on \(task_{1}\), BP\({}_{1}\) performed poorly with a negative performance in phase B as well. A more intelligent agent could consider its negative performance from the first time and decide not to execute \(task_{2}\). Furthermore, in both phase C and phase D, the successful first execution of the task requires a series of consecutive failed executions, which we would like to avoid.