# A Smart and Mechanized Agricultural Application: From Cultivation to Harvest
## 3 Materials and Methods
### Cultivation Phase
#### 3.1.1 SCSO Algorithm  
The Sand Cat Herding Optimization (SCSO) algorithm is inspired by the sand cat's foraging and hunting behavior [50]. In this algorithm, a low-frequency noise detection behavior mechanism is used to find the prey of sand cats. Since these cats can detect low frequencies below 2 kHz, they can find even the furthest prey in the shortest possible time and with very little movement. These cats also have an incredible ability to dig for prey. This algorithm has a successful performance in searching and hunting using these two great features. With an adaptive mechanism, SCSO can be good at solving many problems, as they are balanced in the exploration and exploitation phases. In addition to these features, this algorithm is preferred specifically for this problem, since it uses few parameters and is a simple implementation. The mathematical equations of this algorithm are given below (Equations (1)-(5)):  
\[\overset{\rightarrow}{F_{G}}=s_{M}-\left(\frac{2\times S_{M}\times iter_{c}}{ iter_{Max}+iter_{max}}\right) \tag{1}\]  
\[\overset{\rightarrow}{R}=2\times\overset{\rightarrow}{F_{G}}\times rand\ (0,1)-\overset{ \rightarrow}{F_{G}} \tag{2}\]  
\[\overset{\rightarrow}{r}=\overset{\rightarrow}{F_{G}}\times rand(0,1) \tag{3}\]  
where '\({}_{G}\)' is a constant inspired by the listening ability of sand cats. It will linearly decrease from two to zero as the iterations progress to approach the prey (solution) it is looking for and not to lose or pass it (not to move away). The \"\(S_{M}\)\" value is inspired by the hearing characteristics of the sand cats, its value is assumed to be 2. The '\(r\)' demonstrates sensitivity range of each cat. The '\(r\)' is used for operations in exploration or exploitation phases while '\(r_{C}\)' guides the '\(R\)' parameter for transition control in these phases. '\(R\)' is the main parameter  
Figure 1: General scheme of all operations of the proposed model.  
in controlling the transition between exploration and exploitation phases. If '\(R\)' is lower than one, the sand cats are directed to attack their prey, otherwise, the cats are tasked with finding a new possible solution in the global area. The '\(iter_{c}\)' is the current iteration and '\(iter_{max}\)' indicates the maximum iterations. The '\(t\)' is the current time.  
\[\overset{\rightarrow}{X}(t+1)=\left\{\begin{array}{l|l}\overset{\rightarrow}{ Pos_{b}}(t)-Pos_{md}^{\rightarrow}\cdot\cos(\theta).\overset{\rightarrow}{r} \\ \overset{\rightarrow}{r}.\left(\overset{\rightarrow}{Pos_{bc}}(t)-rand(0,1). \overset{\rightarrow}{Pos_{c}}(t)\right)\end{array}\right.\begin{array}{l|l} |R|\leq 1\;; exploitation\quad(a)\\ |R|>1\;;exploration\quad(b)\end{array} \tag{4}\]  
Equation (4) is proposed to determine the next move of each cat. The '\(Pos\)' indicates the best position and '\(Pos_{c}\)' represents the current position. The '\(Pos_{md}\)' indicates the random position and ensures that the cats involved can be close to prey. '\(Pos_{md}\)' is obtained from Equation (5). In addition, SCSO also performs well in convergence behavior. The pseudocode of the relevant algorithm is shown in Algorithm 1.  
\[Pos_{md}^{\rightarrow}=\left|rand(0,1)\cdot Pos_{b}(t)-Pos_{c}(t)\right| \tag{5}\]  
```
Initialize the population  Calculate the fitness function based on the objective function  Initialize the \(r\), \(r_{G}\), \(R\)  While(\(t\) <= maximum iteration)  For each search agent  Get a random angle based on the Roulette Wheel Selection (\(0^{\circ}\leq\theta\leq 360^{\circ}\))  If(abs(\(\otimes\) <= 1)  Update the search agent position; Equation (4a)  Else  Update the search agent position; Equation (4b)  End  end \(t\) \(t\) = \(t\)++ End
```  
**Algorithm 1** Sand cat swarm optimization algorithm pseudocode.