## 4 History-Based Trajectory Planning
 \tag{8}\]  
\[\textit{energy}_{ap}^{1}(v+1)={\textit{enr}}\_unit\_len\_tsk(ap)\times(ARMA\_ prediction(task\_len_{ap}(1),task\_len_{ap}(2), \tag{9}\]  
\[\ldots,task\_len_{ap}(v)))\]  
\[\textit{energy}_{ap}^{2}(v+1)\text{ has already been formulated in (3).}\]  
\[f_{i}^{3}(c_{ap})=\bigg{\{} \begin{subarray}{c}\frac{1}{2}\big{[}time\_del_{ap} ^{1}(v+1)+time\_del_{ap}^{2}(v+1)\big{]},&\text{if }{\textit{time}}\_del_{ap}^{2}(v+1)>time\_del_{ap}^{1}(v+1)\\ {\textit{time}}\_del_{ap}^{2}(v+1),&\text{Otherwise}\end{subarray}  \tag{10}\]  
\[time\_del_{ap}^{1}(v+1)=del\_unit\_len\_tsk(ap)\times(ARMA\_prediction(task\_len_{ap}(1),task\_len_{ap}(2), \tag{11}\]  
\[\ldots,task\_len_{ap}(v)))\]\[f_{i}^{\text{A}}(ap)=\frac{area(ap)}{F} \tag{12}\]  
\[f_{i}^{5}(ap)=\frac{v^{\prime}(ap)}{v(ap)} \tag{13}\]  
\(v^{\prime}(ap)\) is the number of sessions in which ap was detected as sensitive, and \(v(ap)\) is the number of sessions for which data involving \(ap\) is stored in the HST table of \(C_{i}\). \[f_{i}^{6}(C_{ap})=\frac{enrg_{ap}^{1}(v+1)}{enr\_unit\_ten\_tsk} \tag{14}\]  
In this way, the weight values of all CHs are calculated for all p, s.t., \(1\leq qp\leq u\). In each pass, the CH with height weight is chosen as the next destination of the UAVs after traversing the sensitive region q times, insensitive regions are visited once, and the value of q is based on the ratio of areas covered by sensitive and insensitive regions. Its value is computed in (15). \[q=\frac{\sum_{p=1}^{u}area(ap)}{F-\sum_{p=1}^{u}area(ap)} \tag{15}\]  
For traversing insensitive regions, weight values of CH are also calculated and the CH with the next weight is traversed next. A flow chart of SVM_UAV_ARMONT before and during the classification of regions is shown in Figure 3.  
When the system begins operation, initially the agricultural field is divided into some regions, sensors are deployed, and then CHs are elected. Turn = 0 specifies that traversing of CHs has just begun and the first CH is about to be traversed. The first CH is identified by arranging CHs using [PERSON]'s shortest path algorithm. For all subsequent traversals, the turn will remain 1. After the first clustered is visited by the UAV, the turn will be set to 1. The record will contain all information (region_area, session_id, num_of_sessions, tot_len_of_task_exec, no_of_task_exec, enrg_consumed, time_del, res_enrg_UAV) about current CH and the same information will be stored in history table or HST of the current CH. Additionally, the current CH will be stored in a preview or previous CH record which is supposed to be the next CH. This will continue until the HST table contains (N*10) records. Then, classification is performed where a set of sensitive regions will be denoted as \(\alpha\) and a set of insensitive regions will be denoted as \(\beta\); q denotes the ratio of the area of sensitive and insensitive regions. Sensitive regions will be traversed q number of times whereas insensitive regions will be traversed once. The technique is similar to the previous one, only the next destination CH will be chosen based on weight values computed using the SVM_UAV_ARMONT technique. After classifying regions as sensitive or insensitive, re-classification takes place after a time interval \(\zeta\). If it is found that the outcome of region labels (sensitive or insensitive) remains the same then \(\zeta\) is increased to \(2\times\zeta\), that is, doubled. On the other hand, if the label of at least one region changes, then the re-classification interval is halved, that is, becomes \(\zeta/2\). Accordingly, the route of the UAV also changes. Therefore, classification is not always permanent and it depends on behavior regions. A flowchart of the overall system appears in Figure 4.  
Figure 3: Flowchart of SVM_UAV_ARMONT before and during the classification of regions. Figure 4: Flowchart of the overall system after the classification of regions.