## 3 The Proposed Algorithms
### Description of the Proposed PSO Algorithm
A fish f performs _InnerPrey_() (Algorithm 2, Line 22) procedure when its neighborhood is quite rich in fish, towards which it could make a move. A fish f\({}_{1}\), different from f, is selected randomly from the neighbors of f and if it has better fitness than f then fish f moves towards f! using procedure _RandomApproach_() and procedure _InnerPrey_() is completed. If the fitness of f! is not better than the fitness of f then f can also move towards f! using procedure _RandomApproach_() with probability equal to \(e^{\frac{dc}{gen}}\) (dc is the difference in fitness between fish f! and fish f and gen is the current generation) and procedure _InnerPrey_() is completed, too. This is repeated PREY_TRY_NUMBER times at most. In case none of the above situations take place, procedure _Prey_() is executed. The pseudo code of procedure _InnerPrey_() is presented in Algorithm 4. ```
0. For try \(\blacklozenge\) 1 to PREY_TRY_NUMBER {
1. accept \(\blacklozenge\) random number between 0 and 1;
2. pick a random fish f! among its neighbors;
3. dc \(\blacklozenge\) fitness of f! - fitness of f;
4. If fitness of f! \(\subset\)= fitness of f then {
5. Execute procedure _RandomApproach_(); // _move randomly fish f towards fish f! ;
6. return;
7. } // end If
8. If (fitness of f! \(>\) fitness of f) and (\(e^{\frac{dc}{gen}}>\) = accept) then {
9. Execute procedure _RandomApproach_(); // _move randomly fish f towards fish f! ;
10. return;
11. } end If
12. } end For
13. Execute procedure _Prey_(); // _See Algorithm 3
14. return;
```  
**Algorithm 4**The pseudo code of procedure _InnerPrey_(). A fish f performs procedure _SwarmNChase_() (Algorithm 2, Line 24) when its neighborhood is neither \"dense\" nor \"sparse\" in fish. Fish f, using procedure _RandomApproach_(), moves separately and independently to the localCentre fish of its neighborhood (swarm behavior) and to the localBest fish of its neighborhood (chase behavior) [17,24]. The fish f finally takes the move which gives better fitness. If neither of the two moves lead to better fitness, the fish executes procedure _InnerPrey_(). The pseudo code of procedure _SwarmNChase_() is presented in Algorithm 5. ```
0. tempFish! \(\blacklozenge\) f;
1. tempFish! \(\blacklozenge\) f;
2. move randomly fish tempFish! towards the localBest of neighborhood of f;
3. move randomly fish tempFish! towards the localCentre of neighborhood of f;
4. tempFish! \(\blacklozenge\) fish with the minimum fitness among tempFish! and tempFish! ;
5. If fitness of tempFish! \(\subset\)= fitness of f then
6. f \(\blacklozenge\) tempFish;
7. Else
8. InnerPrey_(f); // _See Algorithm 4
9. Return;
```  
**Algorithm 5**The pseudo code of procedure _SwarmNChase_(). As seen in the previous paragraphs, the proposed AFS algorithm uses many user-defined parameters that affect the algorithm's convergence and efficiency. In Table 1 all user defined parameters are summarized and explained. Moreover, their values used in all experiments are listed. Although the adjustment of user-defined parameter values remains an open issue, as there is no obvious way to tune them, after having conducted exhaustive experiments we decided to use the values presented in Table 1, since this combination of values resulted in the best performance of the proposed AFS algorithm.