# -- Select and Attempt task -- ```
## 4 Enhancing Performance by Avoiding Unwarranted Task Executions
### The Proposed CA Algorithm for the Early Detection of Bad Providers
We know that \(BP_{1}\) has initialized its second connection for \(co_{2}\) to the value 0.45. Induction hypothesis: Assume that Proposition 1 is correct for the \(k\)-th connection that \(BP_{1}\) will create for \(\text{task}_{1}\). Induction step: We will show that Proposition 1 holds for the (\(k\)+1)th connection that \(BP_{1}\) will create for \(\text{task}_{1}\). \begin{table}
\begin{tabular}{c c c} \hline \hline

\(BP_{1}\) will calculate the average of its \(k\) connections for \(task_{1}\) as follows:

Table 7.6

where \(w_{co_{n}}\) denotes the weight of the \(n\)-th connection of \(BP_{1}\) for \(task_{1}\). From the induction hypothesis, we have the following:

Table 7.7

The average of the weights of the \(k\)-1 connections is equal to 0.45:

Table 7.8

From (11)-(13), we have the following: \(\textit{average}=\frac{(k-1)\cdot 0.45+0.45}{k}=0.45\). \(\square\)

**Sketch of Computational Complexity Analysis of Algorithm 2. ** This sketch highlights the dominant cost contributors. A full formal proof would require additional assumptions and details regarding data structures and implementation models. **Time Complexity Analysis. ** We analyze the time complexity per iteration of the main loop of Algorithm 2, focusing on dominant, input-dependent operations. Constant time steps and scalar updates are noted but not emphasized in the final complexity. **Notation:**

* \(t\): Number of distinct known tasks \((c,r)\) stored or processed by the agent, where
* \(c\) is a task category. * \(r\) is a set of requirements. * \(n\): Number of agents in the system. * \(q\): Number of incoming messages in the agent's message list. * \(m\): Number of connections currently held by the agent. In the worst case, \(m=O(n\cdot t)\). **Step-by-Step Breakdown**

* \(1\). Initialization (line 1):
* Creating an empty structure: \(O(1)\). * \(2\). Message Handling and Connection Setup (lines 3-19):
* Broadcast to all agents (line 4): \(O(n)\). * Append message (line 6): \(O(1)\). * Connection handling (lines 7-14 or 15-19):
* Worst case (lines 7-14):
* Linear search in connections: \(O(m)\). * Find similar connections and average weights: \(O(m)\). Total: \(O(m)\). * Alternative case (lines 15-19): \(O(1)\). Overall block cost: \(O(n+m)\). * Select and Attempt Task (lines 20-33):
* For each message (\(q\) in total), find the corresponding connection (worst-case linear search): \(O(q\cdot m)\). * Other steps (task status, threshold check, performance evaluation): Each is \(O(1)\)
* Message deletion (search + shift in list): \(O(q)\). Total for this block: \(O(q\cdot m+q)=O(q\cdot m)\). * Update Connection Weight (lines 34-38): Direct updates and conditionals: \(O(1)\). * Dynamic Profile Update (lines 39-43):
* Iterate and filter all connections: \(O(m)\). * Search through task list: \(O(t)\). Total: \(O(m+t)\). * Total Time Complexity: \(O(n+m+q\cdot m+m+t)=O(n+q\cdot m+t)=O(q\cdot n\cdot t)\), since, as stated, in the worst case, it is \(m=O(n\cdot t)\). **Space Complexity. ** We estimate the memory requirements per agent, focusing on the key data structures and how they scale with input parameters:

* _i.bad_tasks_: Map from tasks to Boolean: \(O(t)\). * Message list \(M\): Up to \(q\) messages: \(O(q)\). * Connection list: At most one per known task per agent: \(O(n\cdot t)\). * Local scalars and flags: \(O(1)\). Total Space Complexity: \(O(q+n\cdot t)\). ## References

* [1] [PERSON]; [PERSON] A psychology-inspired trust model for emergency message transmission on the Internet of Vehicles (IoV). _Int. J. Comput. Appl._**2020**, _44_, 480-490. [CrossRef]
* [2] [PERSON]; [PERSON]; [PERSON]; [PERSON] Adaptive and survivable trust management for Internet of Things systems. _IET Inf. Secur._**2021**, _15_, 375-394. [CrossRef]
* [3] [PERSON]; [PERSON] A generic model for representing openness in multi-agent systems. _Knowl. Eng. Rev._**2021**, _36_, e3. [CrossRef]
* [4] [PERSON]; [PERSON] Improving trust and reputation assessment with dynamic behaviour. _Knowl. Eng. Rev._**2020**, _35_, e29.