## 4 History-Based Trajectory Planning
The formulation of \(entg_{i}^{2}(v+1)\) appears in (3) and it is based on the ARMA model,  
\[entg_{i}^{2}(v+1)=ARMA\_prediction(\mathit{en\_rg_{i}}(1),\mathit{en\_rg_{i}}(2 ),...,\mathit{en\_rg_{i}}(v)) \tag{3}\]  
Similar to energy, time delay \(\mathit{time\_del}_{i}(v)\) is modeled in (4) as the average of \(time\_del_{i}^{1}(v+1)\) and \(\mathit{time\_del}_{i}^{2}(v+1)\) where \(time\_del_{i}^{1}(v+1)\) specifies exact time delay required to complete all the tasks present in task queue \(C_{i}\) where \(time\_del_{i}^{2}(v+1)\) is the time delay predicted by the ARMA model from history of time delay of previous sessions in the HST table. \[time\_del_{i}(v+1)=\left\{ \begin{subarray}{c}\frac{1}{2}[time\_del_{i}^{1}(v+1 )+time\_del_{i}^{2}(v+1)]\quad\mathit{if}\mathit{time\_del}_{i}^{1}(v+1)>time \_del_{i}^{2}(v+1)\\ \mathit{time\_del}_{i}^{1}(v+1)\quad\mathit{otherwise}\end{subarray} \right. \tag{4}\]where  
\[time\_del_{i}^{1}(v+1)=del\_unit\_len\_task(i)\times\sum_{j=1}^{|tsk_{q}ueue(|)|} length(task_{i}(j))\text{ and}\]  
\[time\_del_{i}^{2}(v+1)=ARMA\_prediction(del\_rg_{i}(1),del\_rg_{i}(2),\dots \dots,del\_rg_{i}(v))\]  
Here, \(del\_unit\_len\_tsk(i)\) is the amount of time delay required for executing a unit-length task. \(del\_rg_{i}(1),del\_rg_{i}(2),\dots,del\_rg_{i}(v)\) are time delays specified in \(\mathbf{v}\) earlier sessions as per the history of task execution of \(C_{i}\). ARMA model-based prediction is incorporated here because the situation that all tasks are successfully computed in one go is nothing but the ideal situation which does not always happen. Certain tasks have to be redone more than once. So, in order to estimate the energy and time delay that may be required for the execution of all those tasks in the task queue of \(C_{i}\), including the non-ideal situations, we apply the ARMA model for both the energy and delay contexts. After executing all the tasks in the task queue of \(C_{i}\), residual energy \(res\_eng_{i}(UAV)\) of the UAV will be formulated as (5). \[res\_eng_{i}(UAV)=res\_eng_{i-1}(UAV)-enrg_{i}(v+1) \tag{5}\]  
From the history table (HST) of \(C_{i}\), certain regions are identified as sensitive while others are identified as insensitive. Assume that after \(C_{i}\) set of sensitive regions remaining to b traversed in the current run is given by \(CLS\_SET_{i}(UAV)\), such that, \(CLS\_SET_{i}(UAV)=\{C_{a1},C_{a2},\dots,C_{au}\}\) for trajectory planning, we need to determine which CH \(C_{ap}\) should be visited after \(C_{i}\), where \(1\leq p\leq u\), s.t., \(u\) is the number of CHs of the sensitive region in \(CLS\_SET_{i}(UAV)\). The weight of \(C_{ap}\) is given by \(W(C_{ap})\) and formulated in (6). It is nothing but a function of estimated energy consumption required for executing tasks in \(C_{ap}\) as per the HST table of \(C_{i}\). Energy consumption required for traveling from \(C_{i}\) to \(Cap\), estimated time required for execution of task in \(C_{ap}\) as per HST table of \(C_{i}\), area covered by \(C_{ap}\) with respect to the area of the entire agricultural field. The number of earlier sessions in which \(C_{ap}\) was found sensitive as per the HST table of \(C_{i}\) with respect to the total number of earlier sessions involving \(C_{ap}\). \[W(C_{ap})=[f_{i}^{1}(C_{ap})\times f_{i}^{2}(C_{ap})\times f_{i}^{3}(C_{ap})]^ {-1}\times(f_{i}^{4}(C_{ap})\times f_{i}^{5}(C_{ap})\times f_{i}^{6}(C_{ap})) \tag{6}\]  
\[f_{i}^{1}(C_{ap})=k^{\prime}\bigg{\{}\big{(}x_{i}-x_{ap}\big{)}^{2}+\big{(}y_ {i}-y_{ap}\big{)}^{2}\bigg{\}} \tag{7}\]  
\[f_{i}^{2}(C_{ap})=\bigg{\{} \begin{subarray}{c}\frac{1}{2}\big{[}{\textit{ energy}}_{ap}^{1}(v+1)+{\textit{energy}}_{ap}^{2}(v+1)\big{]},&\text{if }{\textit{ energy}}_{ap}^{2}(v+1)>{\textit{energy}}_{ap}^{1}(v+1)\\ {\textit{energy}}_{ap}^{1}(v+1),&\text{Otherwise}\end{subarray}