# A Genetic Crow Search Algorithm for Optimization of Operation Sequencing in Process Planning
## 4 A Genetic Crow Search Algorithm (GCSA) for Optimization of Operation Sequencing  
### Crow Search Algorithm  
Crow search algorithm (CSA) was introduced in 2016 by [PERSON] [21]. Its inspiration is derived from the crows' intelligent behavior exhibited in their ability to hide food and use memory to recall and restore the food when necessary.  
Generally, crows are considered as one of the most intelligent living organisms on the planet, with many distinctive attributes such as self-awareness, sophisticated communication, face remembrance, food hiding, memorization, thievery, thievery avoidance and so on.  
Their well-known greediness and cleverness is particularly demonstrated in situations when they observe other crow's movement with the purpose of finding better source of food and steal it once they are gone. Afterwards, crow thieves make sure they hide the stolen food and therefore avoid being victims of thievery as the previous owners. Another important element of cleverness is reflected in the fact that a crow can find out when the other crow is following it. Then, the crow that is being followed can fool the other crow by changing the direction of their flight.  
From a computational point of view, the CSA algorithm is a population-based optimization algorithm which utilizes some of the exhibited crow's intelligence. A flock of crows may consider a population of search agents \(N\) where each crow \(i\) has its position \(x_{i}^{it}\) at iteration _it_. Every crow in a flock can memorize its hiding place whose position can be denoted as \(m_{i}^{it}\). Similar to the personal best position (local best) of each particle in the PSO algorithm, the CSA considers the memory \(M_{i}^{it}\) the best food source (hiding place) the crow \(i\) found so far. Flying around the search space and moving towards another crow's hiding place helps crows to update their position and memory and possibly find a better food source. Two important states are possible when crow \(i\) tries to steal hidden food of crow \(j\):  
State 1: Crow \(j\) is not aware that is followed by crow \(i\), resulting in the situation when crow \(i\) successfully commits thievery by moving towards the hiding place of crow \(j\) using the following expression:  
\[X_{i}^{it+1}=X_{i}^{it}+rand_{i}\times fl\times\left(M_{j}^{it}-M_{i}^{it}\right) \tag{1}\]  
where \(X_{i}^{it}\). and \(X_{i}^{it+1}\) are positions of the crow \(i\) in iterations _it_ and _it_ + 1 respectively, \(rand_{i}\) stands for a random number between 0 and 1, \(fl\) is flight length of crow and \(M_{i}^{it}\) and \(M_{i}^{ij}\) are memorized positions of crow \(i\) and crow \(j\) respectively.  
Figure 2: Operation precedence graph and precedence matrix.  
State 2: Crow \(j\) realizes that it is followed by crow \(i\) and fools crow \(i\) by choosing a new position randomly in order to save its food:  
\[X_{i}^{it+1}=\left\{\begin{array}{cc}X_{i}^{it+1}=X_{i}^{it}+rand_{i}\times fl \times\left(M_{j}^{it}-M_{i}^{it}\right)&\quad\text{if }rand_{j}\geq AP\\ a\text{ random position}&\quad\text{otherwise}\end{array}\right. \tag{2}\]  
where \(rand_{j}\) denotes a random number in range [0,1] and AP is awareness probability.  
Two most important parameters of the flight length and the awareness probability. The role of the flight length parameter \(fl\) is to achieve equilibrium between local and the global search. Small values direct the search towards the local optimum (close to \(X_{i}^{it}\)) and large values prone towards the global optimum (away from \(X_{i}^{it}\)). Awareness probability \(AP\) also has the similar role in balancing intensification and diversification. Just as for the flight length, small values of \(AP\) increase local search capacity, and evidently, larger values emphasize global search capacity.