## 3 Design and Methodology
### On/Off Attack
```
1:Input : FS, TC, VC, FL; Output : SS,CS, AS(CR),ATS(CR),CAS(CR);
2:procedure collusion attack
3:TR\(\leftarrow\)T(F\({}_{n}\),CR)\({}^{\text{FS}}\times\)TC
4:maxVR\(\leftarrow\)V(F\({}_{n}\),CR)\({}^{\text{FS}}\times\)VC
5:minVR\(\leftarrow\)V(F\({}_{n}\),CR)\({}^{\text{FS}}\times\)VC
6:for i=1 to n-1 ifT(F\({}_{n}\),CR)\({}^{\text{FS}}-\)T(F\({}_{i}\),CR)\({}^{\text{FS}}\leq\)TR
7:andV(F\({}_{n}\),CR)\({}^{\text{FS}}\geq\)V(F\({}_{i}\),CR)\({}^{\text{FS}}\)andV(F\({}_{n}\),CR)\({}^{\text{FS}}-\)V(F\({}_{i}\),CR)\({}^{\text{FS}}\leq\)maxVR then move (F\({}_{i}\),CR)\({}^{\text{FS}}\) from FS to SS elseifT(F\({}_{n}\),CR)\({}^{\text{FS}}-\)T(F\({}_{i}\),CR)\({}^{\text{FS}}\leq\)TR
8:andV(F\({}_{n}\),CR)\({}^{\text{FS}}\)\(<\)V(F\({}_{i}\),CR)\({}^{\text{FS}}\)andV(F\({}_{n}\),CR)\({}^{\text{FS}}-\)V(F\({}_{i}\),CR)\({}^{\text{FS}}\geq\)minVR then move (F\({}_{i}\),CR)\({}^{\text{FS}}\) from FS to SS
9:endelseif
10:endfor
11:for i=1 to n ifT(F\({}_{n}\),CR)\({}^{\text{FS}}-\)T(F\({}_{i}\),CR)\({}^{\text{SS}}\leq\)TR
12:andV(F\({}_{n}\),CR)\({}^{\text{FS}}\geq\)V(F\({}_{i}\),CR)\({}^{\text{SS}}\)andV(F\({}_{n}\),CR)\({}^{\text{FS}}-\)V(F\({}_{i}\),CR)\({}^{\text{SS}}\leq\)maxVR then move (F\({}_{n}\),CR)\({}^{\text{FS}}\) from FS to SS elseifT(F\({}_{n}\),CR)\({}^{\text{FS}}-\)T(F\({}_{i}\),CR)\({}^{\text{SS}}\leq\)TR
13:andV(F\({}_{n}\),CR)\({}^{\text{FS}}<\)V(F\({}_{i}\),CR)\({}^{\text{SS}}\)andV(F\({}_{n}\),CR)\({}^{\text{FS}}-\)V(F\({}_{i}\),CR)\({}^{\text{SS}}\geq\)minVR then move (F\({}_{n}\),CR)\({}^{\text{FS}}\) form FS to SS
14:endelseif
15:endif
16:endfor
17:for\(i=1\) to n
18:\(\text{CAF}(\text{SR}_{i}\),CR) \(\leftarrow\) FN(SR\({}_{i}\),CR)/FN(SS,CR)
19:if\(\text{CAF}(\text{SR}_{i}\),CR) \(\geq\) FL then move \(\text{SF}(\text{SR}_{i}\),CR) to CS
20:else
21:moveSF(SR\({}_{i}\),CR) to FS
22:endif
23:endfor
24:\(\text{AS}(\text{CR})\gets 1-\text{RN}(\text{CS})/\text{FN}(\text{CS},\text{CR})\)
25:\(\text{ATS}(\text{CR})\leftarrow\text{FN}(\text{CS},\text{CR})/\text{FN}(\text{AFS},\text{CR})\)
26:for i = 1 to n
27:\(\text{CAS}(\text{CR})\leftarrow\text{FN}(\text{CS},\text{CR})/\text{FN}(\text{AFS},\text{CR})\)
28:endfor
29:endprocedure
```  
**Algorithm 2** Collusion Attack Algorithm  
The example of the collusion attack given below can be evaluated. This example demonstrates how the trust value of the roles is influenced by the collusion attack algorithm. Here, we assume that the matrix given below consists of all feedback times. \[\sum\limits_{i=1}^{n}\text{FS}(\text{CR})= \begin{array}{c}\text{T}(\text{F} _{1})\cdots\text{T}(\text{F}_{n-1})\text{T}(\text{F}_{n})\\ \text{SP}_{1}\\ \text{SP}_{2}\\ \vdots\\ \text{SP}_{n}\\ \end{array} \]  
\[ \begin{array}{c}\text{T}(\text{F}_{1})\cdots\text{T}(\text{F}_{n-1})\text{ T}(\text{F}_{n})\\ \text{SP}_{1}\\ \text{SP}_{2}\\ \vdots\\ \text{SP}_{n}\\ \end{array} \]
The different feedback times are compared by the algorithm, beginning with the final feedback time \(\mathrm{V_{n,n}}\). We make the assumption that the time period is two hours and all the feedback is obtained on the same day. Six feedback items are found in this time period, and their values are compared by the trust model. The following feedback values are assumed:  
\[ \begin{array}{l}\mathrm{V(F_{1})}\cdots\mathrm{V(F_{n-1})}\ \mathrm{V(F_{n})}\\ \sum\limits_{i=1}^{n}\mathrm{FS(CR)}=\begin{array}{c}\mathrm{SP_{1}}\\ \mathrm{SP_{2}}\\ \vdots\\ \mathrm{SP_{n}}\\ \end{array}\left(\begin{array}{cccc}90\%&\cdots&99\%&98\%\\ 92\%&\cdots&95\%&97\%\\ \vdots&\ddots&\vdots&\vdots\\ 61\%&\cdots&99\%&82\%\end{array}\right)\\ \end{array} \]  
Here, the system shifts the six feedback items to the suspected set \(\mathrm{(SS)}\); the collusion attack frequency for every recommender that has feedback in the suspected set \(\mathrm{(SS)}\) will then be determined by the trust model.