# Multi-Task Agent Hybrid Control in Sparse Maps and Complex Environmental Conditions
## 2 Path Planning Algorithms Under Sparse Map Conditions
### Adaptive Heuristic Function A* Path Planning Algorithm Based on Sparse Maps  
For ground-based intelligent agents, the map space introduces a non-grid elevation \(h\) atop the two-dimensional base plane, creating a three-dimensional environment where directions are no longer isotropic. This characteristic limits the use of Manhattan distances and complicates the direct application of Euclidean distances. To address this, our study accounts for the differential impact of vertical versus horizontal movements by adjusting the weight of vertical distance in the Euclidean metric, incorporating this as the evaluation function for the path planning algorithm. In comparison to existing heuristic-based or adaptive methods, this study introduces an adaptive heuristic function A* path planning algorithm designed specifically for sparse maps and environments with limited prior knowledge. This algorithm improves path planning by simulating real-world scenarios where some obstacles can be traversed at a certain cost. Through dynamic evaluation, the algorithm assesses whether the agent can afford such costs and adjusts its path accordingly--a feature typically absent in the related research. This dynamic cost-assessment mechanism enhances the algorithm's adaptability in complex environments with varied obstacles. \[ \begin{split} g(n)_{\text{ours}}&=\sum_{j=1}^{k}\sqrt{ \sum_{i=x,y}\left(i_{p_{j}}-i_{p_{j-1}}\right)^{2}+\delta\left|h_{p_{j}}-h_{p_{ j-1}}\right|^{\lambda}}\\ h(n)_{\text{ours}}&=\sqrt{\sum_{i=x,y}\left(i_{T}-i_ {n}\right)^{2}+\delta\left|h_{T}-h_{n}\right|^{\lambda}}\end{split}  \tag{10}\]  
where \(h_{T}\) is the elevation of the target location, \(h_{n}\) is the elevation of the current node, and \(\delta\) and \(\lambda\) are hyperparameters that need to be dynamically adjusted according to specific environmental physical parameters, the agent's single movement distance, and the agent's performance capabilities. Unlike binary maps, in sparse map conditions, obstacles in the map are no longer explicitly expressed but are implied through the magnitude of elevation values. This necessitates establishing thresholds based on actual conditions to determine where in the map are inaccessible obstacles. Given the challenges with the precision of sparse maps, it is prudent to maintain a certain distance from known obstacles on the planned path. This study sets penalty areas around known obstacles based on the agent's size and the map's global characteristics, artificially increasing the cost of traversing these areas but not preventing the agent from passing through them, thereby enhancing the value of routes that stay away from obstacle zones. Based on this approach, this study has made improvements to the evaluation function of the traditional A* algorithm:  
\[f(n)_{\text{ours}} =g(n)_{\text{ours}}+h(n)_{\text{ours}}+o(n) \tag{11}\]  
where  
\[ \begin{cases}o(n)=\frac{h_{n}}{h}\cdot\max_{(x,y)}\sqrt{\left(\frac{\partial h }{\partial x}\right)^{2}+\left(\frac{\partial h}{\partial y}\right)^{2}},& \text{where }n\in G_{p}\\ G_{p}=\left\{(x,y)\right|(x,y)=\mathbf{r}(t)+\lambda\cdot\frac{(-y^{\prime}( t),x^{\prime}(t))}{\sqrt{x^{\prime}(t)^{2}+y^{\prime}(t)^{2}}},\lambda\in(0,R_{p}],t \in[a,b]\right\}\\ R_{p}=R_{1}\cdot\left(1+\frac{S_{\text{obs}}}{S_{\text{total obs}}}\right)\end{cases}  \tag{12}\]  
\(h_{n}\) is the elevation of the current node, \(h\) is the average elevation of the known area, \(r(t)=(x(t),y(t)),t\in[a,b]\) represents the boundary curve of the obstacle area projected onto the X-Y plane, \(G_{p}\) is the projection of the penalty area onto the X-Y plane, \(R_{1}\) is the safe range of the intelligent agent, \(S_{\text{obs}}\) is the projected area of the obstacle zone onto the X-Y plane, and \(R_{p}\) is the radial length of the penalty area, which can be dynamically adjusted based on the projected area of the obstacle. Figure 2 illustrates the range of a single-step action of the agent, the obstacle area, and the penalty area. \(o(n)\) is known as the obstacle distance cost function.