1 Introduction

Worldwide, many developing countries have an undeveloped technical and logistical infrastructure. This not only causes numerous problems for the inhabitants in their daily life, but also has negative economic consequences (more on this can be found in Fay and Yepes (2003), Gaal (2017), Gurara et al. (2017), Oyedele (2016)). Classical examples of a logistical infrastructure are transport networks such as roads, tracks, and waterways. On the technical side, these are supply networks such as power lines, freshwater and wastewater lines, and communication networks. An immature technical infrastructure can severely curb the energy and transport sector. These containments can not only increase the manufacturing and transport costs of a product but can also impact entire construction projects, transport networks, and economic networks. The resulting consequences can reduce the development and progress of these countries. Besides, investors lose interest in investing in underdeveloped countries with a high amount of natural resources since the risk of a misinvestment is too high. Infrastructure projects are usually very costly. Planning firms or consulting companies often plan the development of new routes (alignment) based on empirical values or using estimation methods. However, these methods do not guarantee optimality. Such planning projects and feasibility studies can not only cause high costs but also be very time-consuming. In the case of extensive studies in risky areas, the presence of the staff on-site can pose a threat to the safety of the personnel. Risky zones can include regions with natural disasters or conflict zones. Last but not least, manual planning involves a residual risk of corruption and manipulation, as a manual planned route allows for unnecessary detours. By planning and constructing redundant detours, companies can generate more turnover and use part of the turnover to influence the transport ministries or the relevant authorities.

The Shortest Path Problem is a well-known graph theory problem where the goal is to find a shortest path between two nodes (start and end points) within a weighted graph \(G=\left( V,E,w\right)\), where V is a set of nodes, E is a set of edges, and \(w:E\longrightarrow \mathbb {R}_{+}\) is a cost function that defines the weight \(w_{i,j}\) of an edge \(\left\{ i,j\right\} \in E\). A shortest path between two nodes is a route with a minimum sum of all used edge weights to get from the start node to the destination node. Shortest path algorithms are particularly used for path planning or finding a path. Route planning is often used for autonomous mobile robots to find an optimal route from a starting point to a destination in complex environments. There are different heuristic and non-heuristic approaches for finding a way to calculate an ideal path on a terrain. One approach is that a graph is given and a search algorithm for a path is performed on this graph. Another approach is that a certain search algorithm does not search within a given graph, but simultaneously creates a graph in the direction of the target on which a potential optimal path could lie while searching for a path. Mitchell and Sharir present in Mitchell and Sharir (2004) an efficient algorithm that calculates Euclidean shortest paths in three dimensions with obstacles, in polynomial time. An \(L_{1}\) shortest path on polyhedron terrain, \(L_{2}\) shortest path on parallel walls, and \(L_{2}\) shortest path on a land-like, layered, and axis-aligned rectangles are analyzed and computed.

Belaidi et al. describe in Belaidi et al. (2014) an algorithm for mobile robots in a polygonal grid that plans a path to cross a given terrain with irregularities and obstacles. The objective function is, on the one hand, the distance and on the other hand the speed crossing an area. Saranya et al. modify the \(D^{*}\) algorithm in Saranya et al. (2016) by defining a cost function that depends on the distance and slope of the terrain. This allows an autonomous mobile robot to calculate an optimal route between two points in an unknown environment, such as an irregular terrain. In Muñoz et al. (2017), Muñoz et al. present another algorithm, the so-called “3D Accurate Navigation Algorithm (3Dana)”, which finds the most convenient path for mobile robots on a terrain (DTM—Digital Terrain Model) by considering, for example, the maximum gradient of a terrain that can be driven on. Subsequently, they tested this algorithm on the digital topography of Mars. The geometry of a terrain influences the trajectory of a potential route. Fowler and Little show in Fowler and Little (1979) that they model a terrain with a Triangulated Irregular Network (TIN). In this work they describe a method to automatically extract a TIN model from dense raster data. A first approximation is constructed by automatically triangulating a set of feature points derived from the grid model. Basu and Snoeyink describe in Basu and Snoeyink (2007) how RTINs (rectangular, irregular networks) can be used to represent terrain as a mosaic of polynomial surface areas.

Compared to the above papers, the main focus of our research is not the development of an algorithm for finding a shortest path, but the development of algorithms for a discrete modeling of a Riemannian submanifold \(U\subset \mathbb {R}^{3}\) through a special grid \(\varGamma =\left( V,E,W\right)\) of nodes V, edges E and weights W, where U is a topographic terrain with obstacles. On \(\varGamma\) a shortest path for the expansion of transport infrastructure on U is searched.

A regular grid \(\varGamma\) is constructed on a geographical area A by mapping \(\varGamma\) to the topography U of A and representing U approximatively. A family of grids \(\left( \varGamma _{a},\varGamma _{b},\varGamma _{c}\right)\) with different weights \(\left( W_{a},W_{b},W_{c}\right)\) characterized by certain criteria is calculated. Each edge \(\left\{ i,j\right\}\) represents a segment of a route, and the non-negative weight \(w_{i,j}\) of that edge indicates (a) the length, (b) the construction cost, or (c) the absolute elevation change between nodes i and j. For the calculation and evaluation of the edge weights \(\left( W_{a},W_{b},W_{c}\right)\) different algorithms were developed. For these algorithms different data are used, e.g., the soil condition, the elevation data of a terrain (topography) and the construction costs per unit length. The resulting routes can be either transport routes or transmission lines connecting two locations or running from one starting point through several locations to a destination. The aim is to construct the shortest route in terms of distance, the most cost-effective route, and the most convenient route with minimum vertical fluctuation. Compared to the above approaches, we will not use heuristics to search for an optimal route but solve the problem with a search algorithm, such as the Dijkstra (1959), which guarantees a global optimum. Through the Pareto method, these different grids are combined into multi-criteria grids \(\varGamma _{\mathrm {Pareto}}=\left( \varGamma _{1}^{\mathrm {Pareto}},\ldots ,\varGamma _{n}^{\mathrm {Pareto}}\right)\) so that a family of n grids is generated based on compromises between these criteria (Ehrgott 2005). On each multi-criteria grid \(\varGamma _{k}^{\mathrm {Pareto}}\) of \(\varGamma _{\mathrm {Pareto}}\) an optimal route is determined. These solutions represent a set of optimal trade-offs to design ideal transport and energy infrastructures. The presented work is based on Zazai (2020) and is a largely extended version of Zazai and Fügenschuh (2018).

The advantages and differences of our method compared to the above approaches in the papers are as follows:

  1. 1.

    We present a new method by planning infrastructure development with discrete optimization and graph theory, considering different construction criteria. This approach is different from the approach of autonomous mobile robots, where a vehicle moves from its starting point to its destination in an environment. The environment remains invariant while an autonomous mobile robot crosses it, but when a route is laid out, the environment may change as a result of construction work. This means that certain topographical outliers can be tolerated because they are removed when a route is developed.

  2. 2.

    Although the TIN (Triangulation) method is a good approximation for modeling a terrain, it does not guarantee efficiency for calculating routes on that terrain. Especially when the geometry of a terrain is only a secondary consideration, such as when designing the most cost-effective route, where the ground conditions must be taken into account.

  3. 3.

    Unlike the path-finding of autonomous mobile robots, the edges of a grid \(\varGamma\) can consist of different infrastructure segments, such as roads, tracks, pipelines or power lines. For the selection of a specific infrastructure segment, the input data is modified and adjusted, such as the average cost or the structure of the ground.

  4. 4.

    On \(\varGamma\) no locally, but globally optimal routes are computed.

  5. 5.

    Once a grid \(\varGamma\) of a topographic submanifold U is computed, it is possible to calculate between any start and destination point on U an optimal path with a running time of \(\mathcal {O}\left( |V|\mathrm {log}\left( |V|\right) +|E|\right)\)Turau (2004). For each changed start and destination point on U, the cost for the computation of the edge weights W is being saved.

  6. 6.

    All planning results, such as trajectory coordinates, construction costs, distances, and total absolute altitude changes, are given separately for each optimal route.

  7. 7.

    The Pareto method is used to define multi-criteria grids by using the different grids \(\varGamma _{a},\varGamma _{b}\), and \(\varGamma _{c}\). The results can model an environment more realistically. These grids are used to determine various optimal trajectories with the corresponding results, which represent optimal compromises between the mentioned criteria.

2 Topographical grid generation

In this section, we construct a special grid \(\varGamma\) on a spheroid S. For this we take an area \(U'\) from S, which is curved. This curved area has to be mapped on a Euclidean plane in \(\mathbb {R}^{3}\) by a homeomorphism. Thus the construction of \(\varGamma\) in the Euclidean space will be simplified. A spheroid S can be described by an implicit representation

$$\begin{aligned} \frac{x^{2}+y^{2}}{a^{2}}+\frac{z^{2}}{c^{2}}=1, \end{aligned}$$
(1)

or a parameter representation

$$\begin{aligned} \left( \begin{array}{c} a\,\mathrm {cos}\left( \alpha \right) \mathrm {cos}\left( \beta \right) \\ a\,\mathrm {cos}\left( \alpha \right) \mathrm {sin}\left( \beta \right) \\ c\,\mathrm {sin}\left( \alpha \right) \end{array}\right) \end{aligned}$$
(2)

where the numbers a and c are the half-axes of the rotating half-ellipse, \(-\frac{\pi }{2}\le \alpha \le \frac{\pi }{2}\), \(0\le \beta \le 2\pi\) and \(a,c>0\).

The shape of the earth is spheroidal which defines an equivalent manifold to S. In the following, S represents the surface of the earth. Since the earth is represented by a flattened spheroid, we set \(a>c\). A submanifold \(U'\) of S is mapped to a submanifold U of \(\mathbb {R}^{3}\) by a homeomorphism \(\varphi _{U'}\) so that U is a Euclidean representation of the curved surface \(U'\) in \(\mathbb {R}^{3}\). It is assumed that U describes the topography of a geographical area \(A\subset \left\{ \left( x,y,0\right) \in \mathbb {R}^{3}\right\}\) on Earth. So the surface of U can have irregular altitudes and depths. The topography of an area is collected from discrete elevation data which is given by a matrix H. A rectangular weighted grid \(\varGamma\) of nodes and edges is constructed on a geographical area A, so that \(\varGamma \left( A\right)\) defines a geographical grid of A. \(\varGamma \left( A\right)\) consists of rectangular grid cells that have vertices and borderlines in the plane in \(\mathbb {R}^{3}\). The boundary of each cell consists of four borderlines. The upper and lower borderlines consist of \(m\in \mathbb {N}\) equidistant edges and the left and right borderlines consist of \(k\in \mathbb {N}\) equidistant edges (see Fig. 1). A cell of \(\varGamma\) has \(2m+2k\) associated nodes on the borderlines. All node pairs of these cells (except those on the same borderline) are connected by edges. These edges are added to the set \(E_{A}\). A grid \(\varGamma\) consists of \(X\cdot Y\) cells, where Y cells in \(\varGamma\) are stacked vertically and in every \(i-\)th row X cells are placed horizontally next to each other.

Fig. 1
figure 1

On the right a grid \(\varGamma\) consists of \(X\cdot Y = 4\cdot 3 = 12\) cells and on the left a cell of \(\varGamma\) with \(m=2\) and \(k=2\) decomposition consisting of \(2m+2k=8\) nodes and \(m^{2}+4km+k^{2}=24\) edges

A grid with rectangular cells has the advantage that it is a structured grid. The cells are regularly sorted (parqueted) so that they lie next to each other in a grid. This allows the nodes of the cells to be easily indexed and counted one after the other. All node pairs of a rectangular cell of \(\varGamma\) with 2k vertical and 2m horizontal segments are connected by \(m^{2}+4km+k^{2}\) edges. On the surface of U, a grid \(\varGamma \left( U\right) =\left( V_{U},E_{U}\right)\) is constructed from nodes \(V_{U}\) and edges \(E_{U}\), which approximatively models the topography of A. Next, the topographic grid is to be extended with graphs from altitude contours that lie on local areas of submanifold U, such as the contour line of a mountain or the altitude edges of a canyon. These contours improve the modeling quality of terrain. Since the elevation data H are discrete, only discrete contours can be generated from these data.

Fig. 2
figure 2

Two neighboring contours \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) in black for \(i\ge 1\) interconnected by red edges

Calculating these contours for each altitude \(h_{i}\in h=\left\{ h_{1},\ldots ,h_{k}\right\}\) of U the Marching Squares algorithm (see Ho et al. 2005; Hanisch 2004) is used, where k is the number of contours for different altitudes from H. Consequently, the result is a set of edge lines in different altitudes of h. Each contour consists of nodes and edges. This algorithm generates the sets of contours \(\gamma \left( h_{1}\right) ,\ldots ,\gamma \left( h_{k}\right)\) where \(\gamma \left( h_{i}\right) =\left\{ \gamma _{1}\left( h_{i}\right) , \ldots ,\gamma _{s_{i}}\left( h_{i}\right) \right\}\) is a set of discrete contours on U at the level \(h_{i}\) for \(i\in \left\{ 1,\ldots ,k\right\}\). Each contour defines a path of edges on U. The contours are required later for the computation of a mountain road. These contours which are adjacent and lie on top of each other are interlinked by additional edges, so that one has a transition between the contours in different levels. As an illustration, two-layered contours with level \(h_{i}\) and \(h_{i+1}\) are considered which are connected as follows: Let \(\gamma \left( h_{i}\right) =\left( V_{i},E_{i}\right)\) and \(\gamma \left( h_{i+1}\right) =\left( V_{i+1},E_{i+1}\right)\) be two adjacent contours lying one above the other that generate a graph through nodes \(V_{i},V_{i+1}\) and edges \(E_{i},E_{i+1}\) in \(\mathbb {R}^{3}\). For each node \(v_{j}\in V_{i}\) the next neighboring node is determined from \(V_{i+1}\). Let \(p_{j}^{i}\) and \(p_{m}^{i+1}\) be points in \(\mathbb {R}^{3}\) representing the nodes \(v_{j}\) and \(v_{m}\in V_{i+1}\). The nearest neighboring nodes of \(V_{i}\) are calculated as nodes \(V_{u}:=\left\{ u_{1},\ldots ,u_{|V_{i}|}\right\} \subset V_{i+1}\) with minimal distances:

$$\begin{aligned} \forall v_{j}\in V_{i}:q_{j}^{i+1}=p_{m}^{i+1},\,\,\,\mathrm {if\,\,}\mathrm {dist}\left( p_{j}^{i},p_{m}^{i+1}\right) \le \mathrm {dist}\left( p_{j}^{i},p{}_{s}^{i+1}\right) , \end{aligned}$$
(3)

for all \(p_{s}^{i+1}\in V_{i+1}\), where \(q_{j}^{i+1}\) is a point representing a node \(u_{j} \in V_{u}\) and \(\mathrm {dist}\) is a distance function between any two points in \(\mathbb {R}^{3}\). Each node \(v_{j}\) is connected to its nearest neighboring node \(u_{j}\) through an additional edge \(e_{j}=\left\{ v_{j},u_{j}\right\}\). Repeat this step for all contours except the second last. This generates a mesh between neighboring contours that defines an unstructured grid. Figure 2 shows two neighboring contours \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) where the red edges connect all nodes of \(V_{i}\) to the nodes of \(V_{i+1}\). Some nodes of \(V_{i+1}\) located far away have no direct connections to the nodes of \(V_{i}\). The crosshatched red edges make a connection to the next nodes of the neighboring contours.

Fig. 3
figure 3

The discrete elevation contours \(\gamma \left( h_{i-1}\right)\), \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) of U are connected by (red) edges to the (red) nodes of the grid \(\varGamma \left( U\right)\)

In the last step, these contours are connected to the grid \(\varGamma \left( U\right) =\left( V_{U},E_{U}\right)\) so that a transition between them is possible. To connect \(\varGamma \left( U\right)\) with the set of contours \(\gamma \left( h\right) =\gamma \left( h_{1}\right) \cup \ldots \cup \gamma \left( h_{k}\right)\) with \(\gamma \left( h_{i}\right) =\left\{ \gamma _{1}\left( h_{i}\right) ,\ldots ,\gamma _{s_{i}}\left( h_{i}\right) \right\}\) for \(i\in \left\{ 1,\ldots ,k\right\}\), edges with minimal distance are searched, which connect these two sets. As far as possible, all nodes of the contours should be connected with \(V_{U}\). Seven cases are considered for this type of meshing to keep the number of connections to a minimum except for the most necessary: Let \(\gamma \left( h_{i-1}\right)\), \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) be three contours lying on top of each other.

  1. (a)

    If nodes of \(V_{U}\) exist between these three contours, then all nodes of \(\gamma \left( h_{i}\right)\) are connected to the nearest nodes of \(V_{U}\) that lie between \(\gamma \left( h_{i-1}\right)\) and \(\gamma \left( h_{i+1}\right)\). This means that each node of \(\gamma \left( h_{i}\right)\) is connected to two nodes of \(V_{U}\) with one node being above \(\gamma \left( h_{i}\right)\) and the other node being below \(\gamma \left( h_{i}\right)\).

  2. (b)

    If no nodes of \(V_{U}\) exist between the two contours \(\gamma \left( h_{i-1}\right)\) and \(\gamma \left( h_{i+1}\right)\), then the middle contour \(\gamma \left( h_{i}\right)\) has no direct connection to \(V_{U}\).

  3. (c)

    If there are nodes of \(V_{U}\) between \(\gamma \left( h_{i-1}\right)\) and \(\gamma \left( h_{i}\right)\), then there are direct connections from \(\gamma \left( h_{i}\right)\) to \(V_{U}\), so that each node of \(\gamma \left( h_{i}\right)\) is connected to the nearest node of \(V_{U}\).

  4. (d)

    If there are nodes between \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\), then the nodes of \(\gamma \left( h_{i}\right)\) are connected to the nearest nodes of \(V_{U}\) above \(\gamma \left( h_{i}\right)\).

  5. (e)

    If \(\gamma \left( h_{i-1}\right) =\emptyset\), then \(\gamma \left( h_{i}\right)\) is locally the lowest contour. Each node of \(\gamma \left( h_{i}\right)\) is connected to the nearest nodes of \(V_{U}\) below \(\gamma \left( h_{i}\right)\) and between \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) (if such a node exists).

  6. (f)

    If \(\gamma \left( h_{i+1}\right) =\emptyset\), then \(\gamma \left( h_{i}\right)\) is locally the highest contour. Each node of \(\gamma \left( h_{i}\right)\) is connected to the nearest nodes of \(V_{U}\) above \(\gamma \left( h_{i}\right)\) and between \(\gamma \left( h_{i}\right)\) and \(\gamma \left( h_{i+1}\right)\) (if such a node exists).

  7. (g)

    If \(\gamma \left( h_{i-1}\right) =\gamma \left( h_{i+1}\right) =\emptyset\), then each node of \(\gamma \left( h_{i}\right)\) is connected to the nearest nodes of \(V_{U}\) below and above \(\gamma \left( h_{i}\right)\).

Figure 3 shows as an example three discrete height contours of U, which on the one hand are connected by dashed red edges and on the other hand these contours are connected to the (red) nodes of the grid \(\varGamma \left( U\right) =(V_{U},E_{U})\) by orange edges. The dashed blue connections are the edges that connect the nodes of \(V_{U}\).

The minimum distance from \(v_{j}\in V_{i}\) to \(V_{U}\) can be determined for the above seven cases as follows: Let \(p_{j}^{i}\) be an associated point of \(v_{j}\in V_{i}\),

$$\begin{aligned} V_{i}^{+}:={\left\{\begin{array}{ll} \begin{array}{l} \left\{ v_{u}\in V_{U}|\,v_{u}\,\,\mathrm {is\,\,between\,\,}\gamma \left( h_{i}\right) \,\,\mathrm {and}\,\,\gamma \left( h_{i+1}\right) \right\} ,\\ \left\{ v_{u}\in V_{U}|\,v_{u}\,\,\mathrm {is\,\,above\,\,}\gamma \left( h_{i}\right) \right\} , \end{array} &{} \begin{array}{l} \mathrm {if}\,\,\gamma \left( h_{i+1}\right) \ne \emptyset ,\\ \mathrm {if}\,\,\gamma \left( h_{i+1}\right) =\emptyset , \end{array}\end{array}\right. } \end{aligned}$$
(4)

and

$$\begin{aligned} V_{i}^{-}:={\left\{ \begin{array}{ll} \begin{array}{l} \left\{ v_{u}\in V_{U}|\,v_{u}\,\,\mathrm {is\,\,between\,\,}\gamma \left( h_{i}\right) \,\,\mathrm {and}\,\,\gamma \left( h_{i-1}\right) \right\} ,\\ \left\{ v_{u}\in V_{U}|\,v_{u}\,\,\mathrm {is\,\,below\,\,}\gamma \left( h_{i}\right) \right\} , \end{array} &{} \begin{array}{l} \mathrm {if}\,\,\gamma \left( h_{i-1}\right) \ne \emptyset ,\\ \mathrm {if}\,\,\gamma \left( h_{i-1}\right) =\emptyset , \end{array}\end{array}\right. } \end{aligned}$$
(5)

two subsets of \(V_{U}\) and \(q_{1},\ldots q_{|V_{i}^{+}\cup V_{i}^{-}|}\) points in \(\mathbb {R}^{3}\) representing nodes of these subsets. To minimize the distance of each point \(p_{j}^{i}\) of the node \(v_{j}\in V_{i}\) the following applies

$$\begin{aligned} \sum \limits _{k=1}^{|V_{i}^{+}\cup V_{i}^{-}|}\mu _{k}\,\mathrm {dist}\left( p_{j}^{i},q_{k}\right) \longrightarrow \mathrm {min!},\,\,\forall \mu _{k}\in \left\{ 0,1\right\} , \end{aligned}$$
(6)

with the auxiliary condition

$$\begin{aligned} \sum \limits _{k=1}^{|V_{i}^{+}\cup V_{i}^{-}|}\mu _{k}={\left\{ \begin{array}{ll} \begin{array}{r} 1,\\ 2,\\ 0, \end{array} &{} \begin{array}{l} \mathrm {if}\,\,V_{i}^{+}\ne V_{i}^{-}=\emptyset \,\,\mathrm {or}\,\,V_{i}^{-}\ne V_{i}^{+}=\emptyset ,\\ \mathrm {if}\,\,V_{i}^{+}\ne \emptyset \,\,\mathrm {and}\,\,V_{i}^{-}\ne \emptyset ,\\ \mathrm {if}\,\,V_{i}^{+}=V_{i}^{-}=\emptyset . \end{array}\end{array}\right. } \end{aligned}$$

For each \(v_{j}\in V_{i}\) with \(\mu _{m}=1\) and \(m\in \{1,\ldots ,|V_{i}^{+}\cup V_{i}^{-}|\}\) an edge is generated with minimal distance from \(v_{j}\in V_{i}\) to a node \(q_{m}\in V_{U}\). Repeat this algorithm for each node of the contours of U until they have meshed with the grid \(\varGamma \left( U\right)\). This mesh, together with the mesh of all neighboring and superimposed contours of the set \(\gamma \left( h\right)\), generates an unstructured mesh \(\varGamma \left( \gamma \right) =\left( V_{\gamma },E_{\gamma }\right)\) consisting of nodes \(V_{\gamma }\) and edges \(E_{\gamma }\). Since \(\varGamma \left( U\right)\) is structured, together with \(\varGamma \left( \gamma \right)\) it forms a hybrid grid

$$\begin{aligned} \varGamma _{\mathbb {R}^3}\left( U \right) =\varGamma \left( U\right) \cup \varGamma \left( \gamma \right) =\left( V_{U}\cup V_{\gamma },E_{U}\cup E_{\gamma }\right) . \end{aligned}$$
(7)

This grid is used in the next section to calculate optimal routes or shortest paths to the surface of U.

3 Optimal routes

The construction of an optimal route on a topographical area U is based on the computation of a shortest path. To solve this problem, the routes are discretized to a grid \(\varGamma\). The edge weights of \(\varGamma\) are non-negative values, which are determined by a cost function \(w:E\longrightarrow \mathbb {R}_{\ge 0}, e_{i,j} \longmapsto w_{i,j}\). Since these values are always non-negative, algorithms such as the Dijkstra (1959) can be used to compute a global optimal route that represents the shortest, most cost-effective, or most convenient route (minimum absolute elevation changes along the route). The higher the number of cells is chosen at a constant size of \(\varGamma\), the more accurately the routes are determined with simultaneously higher computing time.

Obstacles on U can be modeled by finitely many discrete polygons \(O_{1},\ldots ,O_{m}\). If a trajectory is not allowed to cross an obstacle, then it must first be checked whether an edge \(e_{i,j}\) intersects one of the polygons \(O_{1},\ldots ,O_{m}\). If \(e_{i,j}\) has at least one intersection with these polygons, then the weight of this edge is set as \(w_{i,j}=+\infty\). If \(e_{i,j}\) touches these polygons at the boundary or has no intersection point, then the weight of this edge is given by the equation (12). If a set of obstacles are \(O:=\left\{ O_{u},\ldots ,Q_{k}\right\}\) for \(u\ge 1\) and \(k\le m\) lies between a starting node and a destination node then a shortest route is computed around \(O_{u},\ldots ,Q_{k}\).

The geographical coordinates on earth are usually given in latitude and longitude coordinates. The latitude coordinate is the geographical width measured from the equator to the north and south. The latitude values range from \(-90^{\circ }\) at the south pole over \(0^{\circ }\) at the equator to \(+90^{\circ }\) at the north pole. The longitude coordinate is the geographical length going from the zero meridian \(0^{\circ }\) to \(180^{\circ }\) eastwards and from \(0^{\circ }\) to \(-180^{\circ }\) westwards.

3.1 Shortest routes

Let S be a spheroid and \(U_{S}\) a submanifold of S, where S has the size of the earth and the subset \(U_{S}\) has a regular non-topographic surface. A submanifold U is defined as a connected topographical area on earth which represents the submanifold \(U_{S}\) in \(\mathbb {R}^{3}\) as a topographical surface. The shortest routes with respect to a distance are routes within a weighted topographic grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right) =\left( V,E,W_{D}\right)\), where the weights \(W_{D}\) indicate the distances of the edges of \(E_{U}\). First \(W_{D}\) is computed and then the weights of \(W_{D}\) are assigned to the corresponding edges of the grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\). For \(U_{S}\) and U the latitude and longitude coordinate systems are used. The distances \(W_{D}\) of the edges of \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) are computed with the formulas of Vincenty for spheroids (Vincenty 1975) since U is an approximation of \(U_{S}\) except for the topography. Let

$$\begin{aligned} \begin{array}{cccc} \mathrm {dist}{:} &{} U\times U &{} \longrightarrow &{} \mathbb {R}_{\ge 0},\\ &{} \left( p_{i},p_{j}\right) &{} \longmapsto &{} d_{i,j} \end{array} \end{aligned}$$
(8)

be a function that gives a distance between two points \(p_{i}\) and \(p_{j}\) of U according to Vincenty formulas for distances on \(U_{S}\). Due to the topological conditions, the edges of a topographic grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) have different slopes. Usually, traffic routes may not exceed a certain slope otherwise, the crossing of this route is not possible or the consumption of a vehicle increases significantly. Therefore, when building a route, a maximum gradient angle is always taken into account. An edge \(e_{i,j}=\left\{ v_{i},v_{j}\right\}\) is decomposed in \(u_{i,j}\in \mathbb {N}\) segments \(e_{i,j}\left( k\right) =\left\{ v_{i,j}\left( k-1\right) ,v_{i,j}\left( k\right) \right\}\) for \(k=1,\ldots ,u_{i,j}\) where \(v_{i,j}\left( k\right)\) for \(k=1\ldots u_{i,j}-1\) are elements of a set of auxiliary nodes \(V_{\mathrm {aux}}\) lying on the edge \(e_{i,j}\) (see Fig. 4). For the first and last auxiliary node of an edge \(e_{i,j}\) is

$$\begin{aligned} v_{i,j}\left( k\right) ={\left\{ \begin{array}{ll} \begin{array}{l} v_{i}\in V,\\ v_{j}\in V, \end{array} &{} \begin{array}{l} \mathrm {if\,\,}k=0,\\ \mathrm {if\,\,}k=u_{i,j}. \end{array}\end{array}\right. } \end{aligned}$$
(9)

These nodes generate between \(v_{i}\) and \(v_{j}\) the segments \(e_{i,j}\left( 1\right) ,\ldots ,e_{i,j}\left( u_{i,j}\right)\) on the surface of U. Let \(\varphi _{\mathrm {max}}\in \left[ 0,90\right]\) be a maximum allowed angle of a segment and \(\varphi _{i,j}\left( k\right) \in \left[ 0,90\right]\) the angle of a segment \(e_{i,j}\left( k\right)\) with respect to a horizontal plane. For each node \(v_{i,j}\in V\cup V_{\mathrm {aux}}\) there is a map \(h:V\cup V_{\mathrm {aux}}\longrightarrow \mathbb {R}\) so that \(h\left( v_{i,j}\right)\) gives the altitude of \(v_{i,j}\) on an area \(A\subset \left\{ \left( x,y,0\right) \in \mathbb {R}^{3}\right\}\) where A has the altitude 0. The absolute elevation change between two neighboring auxiliary nodes \(v_{i,j}\left( k-1\right)\) and \(v_{i,j}\left( k\right)\) of \(V\cup V_{\mathrm {aux}}\) is defined as

$$\begin{aligned} \varDelta h_{i,j}\left( k\right) :=|h\left( v_{i,j}\left( k\right) \right) -h\left( v_{i,j}\left( k-1\right) \right) |, \end{aligned}$$
(10)

for \(k=1,\ldots ,u_{i,j}\). A segment \(e_{i,j}\left( k\right)\) is called critical if this segment has at least one intersection with O so that this segment is either entirely or partially in O. If \(e_{i,j}\left( k\right)\) is a critical segment then the edge \(e_{i,j}\) is also critical. All critical segments on \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) with respect to O define a set \(E_{\mathrm {crit}}\). Each segment \(e_{i,j}\left( k\right)\) is assigned a distance \(d_{i,j}\left( k\right)\): Let \(\pi :U\longrightarrow A\) be an orthogonal projection of the typographic area U on the area A. With Vincenty’s formulas,first the length

$$\begin{aligned} d'_{i,j}\left( k\right) :=\mathrm {dist}\left( \pi \left( p_{i,j}\left( k\right) \right) ,\pi \left( p_{i,j}\left( k-1\right) \right) \right) \end{aligned}$$
(11)

of the segment \(e_{i,j}\left( k\right)\) is calculated where the points \(p_{i,j}\left( k-1\right)\) and \(p_{i,j}\left( k\right)\) represent the nodes \(v_{i,j}\left( k-1\right)\) and \(v_{i,j}\left( k\right)\) for \(k=1,\ldots ,u_{i,j}\) in \(\mathbb {R}^{3}\). Finally, the length of a segment is computed by considering a absolute slope angle or maximum slope angle that can cause an additional lengthening:

$$\begin{aligned} d_{i,j}\left( k\right) ={\left\{ \begin{array}{ll} \begin{array}{ll} \dfrac{d'_{i,j}\left( k\right) }{\mathrm {cos}\left( \varphi _{i,j}\left( k\right) \right) }, &{} \mathrm {if\,\,}\varphi _{i,j}\left( k\right) \le \varphi _{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}},\\ \\ \dfrac{\varDelta h_{i,j}\left( k\right) }{\mathrm {sin}\left( \varphi _{\mathrm {max}}\right) }, &{} \mathrm {if\,\,}\varphi _{i,j}\left( k\right) >\varphi _{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}},\\ \\ N, &{} \mathrm {if\,\,}e_{i,j}\left( k\right) \in E_{\mathrm {crit}}, \end{array}\end{array}\right. } \end{aligned}$$
(12)

for all \(k\in \left\{ 1,\ldots ,u_{i,j}\right\} , \varphi _{\mathrm {max}} > 0\) and \(N\in \mathbb {R}_{+}\). Serpentines are mostly built in mountain slopes to be able to go up or down steep areas. The second entry in equation 12 describes the segment \(e_{i,j}(k)\) as a serpentine with an maximal slope angle \(\varphi _{\mathrm {max}}\). That is, if this segment exceeds the angle \(\varphi _{\mathrm {max}}\), then this segment is assigned the length of a serpentine which has a maximum slope angle \(\varphi _{\mathrm {max}}\). A serpentine is due to its shape longer than a straight segment. If a segment \(e_{i,j}(k)\) is within one of the polygons of O or it intersects with O then the value N in the third entry of equation 12 is the weight of this segment. The polygons of O are usually unfavorable areas in which the construction of a route is unsuitable. If these areas are forbidden then set \(N=+\infty\). If these areas are not prohibited but unsuitable for construction or crossing, then \(N<\infty\) is a sufficiently large positive number. For the computation of a shortest route regarding the construction of a start node v and destination node t, the following objective function has to be minimized:

$$\begin{aligned} \underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}\underset{k\in I_{i,j}}{\sum }d_{i,j}\left( k\right) \longrightarrow \mathrm {min}!, \end{aligned}$$
(13)

for \(I_{i,j}=\left\{ 1,\ldots ,u_{i,j}\right\}\) such that for all \(v\in V\):

$$\begin{aligned} \begin{array}{l} \underset{e_{i,j}\in \delta ^{-}\left( v\right) }{\sum }x_{e_{i,j}}-\underset{e_{i,j}\in \delta ^{+}\left( v\right) }{\sum }x_{e_{i,j}}={\left\{ \begin{array}{ll} \begin{array}{r} -1,\\ 1,\\ 0, \end{array} &{} \begin{array}{l} \mathrm {if\,\,}v=s,\\ \mathrm {if\,\,}v=t,\\ \mathrm {else}, \end{array}\end{array}\right. }\\ \\ \forall e_{i,j}\in E:x_{e_{i,j}}\ge 0. \end{array} \end{aligned}$$
Fig. 4
figure 4

An edge \(e_{i,j}=\left\{ v_{i},v_{j}\right\}\) is divided into the segments \(e_{i,j}\left( 1\right) ,\ldots ,e_{i,j}\left( u_{i,j}\right)\) with the auxiliary nodes \(v_{i,j}\left( 1\right) ,\ldots ,v_{i,j}\left( u_{i,j}-1\right)\)

3.2 Cheapest routes

The construction of a route can depend on several factors, such as the construction price, the ground conditions on which the route is to be built, and personnel costs. In this paper, the weights of a grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right) =\left( V,E,W_{C}\right)\) are the average construction costs \(W_{C}\) of the edges \(E_{U}\). The cost of building a route per length unit is made up of the average construction cost per length unit and the ground condition. The objective is to compute a route between two nodes on \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) that can be built most cost-effectively. The soil condition can be described by a set of discrete polygons \(P=\left\{ P_{1},\ldots P_{n}\right\}\) on U where each \(P_{i}=\left( V_{i},E_{i}\right)\) consists of nodes \(K_{i}\) and edges \(E_{i}\). Each polygon is assigned a color that describes the structure of the ground. For example, if the color of a polygon is j then this polygon represents a ground structure \(s_{j}\). All polygons of P with a color j create a polygon class \(G_{j}\subset P\). Each polygon of P is assigned to exactly one polygon class. All polygons of P are classified in \(k\le n\) different subsets so that \(P=G_{1}\cup \ldots \cup G_{k}\) consists of k disjunctive polygon classes. Each polygon class \(G_{j}\) is assigned a surface structure value \(\alpha _{j}>0\). If a route passes through \(G_{j}\), this value is the multiple of the construction costs of this route. This means if a route is built over an area \(P_{u}\) of \(G_{j}\) the construction costs on this area increase by the factor \(\alpha _{j}\). Let \(e_{i,l}\) be an edge of s segments such that the edge \(e_{i,l}=\left( e_{i,l}\left( 1\right) ,\ldots ,e_{i,l}\left( s_{i,l}\right) \right)\) can be decomposed into the segments \(e_{i,l}\left( 1\right) ,\ldots ,e_{i,l}\left( s_{i,l}\right)\). The cost \(c_{i,l}\) of an edge e\(_{i,l}\) can be expressed as the sum of all incurred costs of the segments

$$\begin{aligned} c_{i,l}\,\,=\,\,\mathcal {C} \sum _{k\in K_{i,l},j\in J_{i,l}}d_{k}\cdot \alpha _{j}, \end{aligned}$$
(14)

where \(K_{i,l}=\left\{ 1,\ldots ,s_{i,l}\right\}\) is the index set of the segments, \(J_{i,l}\) is the index set of the occurring surface structures on an edge \(e_{i,l}\), \(\mathcal {C}\) is the average costs for the construction and maintenance of a route per length unit, \(d_{k}\) is the length of the k-th segment of an edge \(e_{i,l}\). To identify a segment \(e_{i,l}\left( k\right)\) on \(G_{j}\), an auxiliary node \(m_{k}\) is generated in the middle of this segment. This point is checked by the Point-in-Polygon algorithm (Sunday 2001) to see if it lies in a closed polygon \(P_{u}\) of P. If not, this procedure is continued for the next polygons until the result is positive. If \(m_{k}\) is in \(P_{u}\) with the color j, the segment \(e_{i,l}\left( k\right)\) is assigned the value \(\alpha _{j}\). Calculating the length \(d_{k}\) of a segment \(e_{i,l}\left( k\right)\) lead to one of the following cases:

  1. 1.

    If there are no intersections and the auxiliary node \(m_{k}\) is not in \(P_{u}\), then

    $$\begin{aligned} d_{k}=0. \end{aligned}$$
  2. 2.

    If there are no intersections and the auxiliary node \(m_{k}\) lies in \(P_{u}\), then the following is applied with \(k=1\)

    $$\begin{aligned} d_{k}=\mathrm {dist}\left( v_{i},v_{l}\right) . \end{aligned}$$
  3. 3.

    If there is exactly one intersection \(s_{1}\) with \(e_{i,l}\left( k\right) =\left\{ v_{i},s_{1}\right\}\), then

    $$\begin{aligned} d_{k}=\mathrm {dist}\left( v_{i},s_{1}\right) . \end{aligned}$$
  4. 4.

    If there is exactly one intersection \(s_{1}\) with \(e_{i,l}\left( k\right) =\left\{ s_{1},v_{l}\right\}\), then

    $$\begin{aligned} d_{k}=\mathrm {dist}\left( s_{1},v_{l}\right) . \end{aligned}$$
  5. 5.

    If there are two intersections \(s_{1}\) and \(s_{2}\) with \(e_{i,l}\left( k\right) =\left\{ s_{1},s_{2}\right\}\), then

    $$\begin{aligned} d_{k}=\mathrm {dist}\left( s_{1},s_{2}\right) . \end{aligned}$$

If a segment \(e_{i,l}\left( k\right)\) lies in a polygon \(P_{u}\) with the color j, then the segment length \(d_{k}\) is multiplied by the corresponding surface structure value \(\alpha _{j}\). Note that the distances \(\left\{ d_{k}\right\}\) have to be calculated analogously to the equation (12). Figure 5 shows an edge \(e_{i,l}\) lying on the three polygons \(P_{1}\) in red, \(P_{2}\) in green and \(P_{3}\) in blue. It has two intersections \(s_{1}\) and \(s_{2}\). The first intersection \(s_{1}\) is at the boundary between \(P_{1}\) and \(P_{2}\) and the second intersection \(s_{2}\) is between \(P_{2}\) and \(P_{3}\). The edge \(e_{i,l}\) is divided into three segments \(e_{i,l}\left( 1\right)\), \(e_{i,l}\left( 2\right)\) and \(e_{i,l}\left( 3\right)\). In the middle of these segments are the midpoints \(m_{1}\), \(m_{2}\) and \(m_{3}\) which determine the surface structure values \(\alpha _{1}\), \(\alpha _{2}\), and \(\alpha _{3}\) of these segments using the Point-in-Polygon test. The yellow dotted line represents the length \(d_{1}\), the red dotted line the length \(d_{2}\), and the white line the length \(d_{3}\).

Fig. 5
figure 5

The decomposition of an edge \(e_{i,l}\) in the three segments \(e_{i,l}(1)\), \(e_{i,l}(2)\), and \(e_{i,l}(3)\) on the three polygons \(P_{1}\), \(P_{2}\), and \(P_{3}\) representing different soil conditions

The following objective function has to be minimized to compute the cheapest route in terms of construction:

$$\begin{aligned} \underset{e_{i,l}\in E,K_{i,l}\subset K,J_{i,l}\subset J}{\sum }x_{e_{i,l}}\left( \sum _{k\in K_{i,l},j\in J_{i,l}} d_{k}\cdot \alpha _{j}\right) \longrightarrow \mathrm {min}! \end{aligned}$$
(15)

where K is the index set of all existing segments and J is the index set of the occurring surface structures on the edges of E. The complexity of the Point-in-Polygon algorithm is \(\mathcal {O}\left( N_{\mathrm {Poly}}\right)\) and of the calculation of the intersections of an edge with the polygons also \(\mathcal {O}\left( N_{\mathrm {Poly}}\right)\) where \(N_{\mathrm {Poly}}\) is the number of all nodes of the polygons P. Consequently, the time complexity of calculating the weight \(c_{i,l}\) of any edge \(e_{i,l}\) is also \(\mathcal {O}\left( N_{\mathrm {Poly}}\right)\).

3.3 Most convenient routes

In this part two variants for the calculation of the trajectory of a most convenient or passable route on U are presented. In the first variant a method is presented in which a route between two nodes is computed with a minimum sum of absolute elevation changes. This means that a route with the least vertical variations is searched for. Similarly, in the second variant, a route with a minimum sum of absolute gradients from the starting point to the destination is calculated.

3.3.1 Absolute elevation change

Both for ordinary traffic and for the transport of heavily loaded vehicles, routes are preferred which are easy and comfortable to drive on. Due to the topography of U, the surface of U has both ups and downs corresponding to the grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\). An edge \(e_{i,j}=\left( e_{i,j}\left( 1\right) ,\ldots ,e_{i,j}\left( u_{i,j}\right) \right)\) of V is divided into \(u_{i,j}\) segments. Let \(V_{\mathrm {aux}}\) be a set of auxiliary nodes on the grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) and \(A\subset \left\{ \left( x,y,0\right) \in \mathbb {R}^{3}\right\}\) an area with an elevation of 0. Analogue to Sect. 3.1, the weight of a segment \(e_{i,j}\left( k\right)\) is defined as an absolute elevation change between two neighboring nodes \(v_{i,j}\left( k\right)\) and \(v_{i,j}\left( k-1\right)\) of \(V\cup V_{\mathrm {aux}}\) as follows

$$\begin{aligned} \varDelta h_{i,j}\left( k\right) :=|h\left( v_{i,j}\left( k\right) \right) -h\left( v_{i,j}\left( k-1\right) \right) |, \end{aligned}$$
(16)

for \(k=1,\ldots ,u_{i,j}\). A route between the starting node s and the destination node t is called the most convenient route regarding the absolute elevation change, if the sum of the absolute elevation changes on \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) is minimal. Figure 6 shows that there are two nodes \(v_{i}\) and \(v_{j}\) on U and between these nodes there are horizontal-equidistant auxiliary nodes \(v_{i,j}\left( k\right)\) of \(V_{\mathrm {aux}}\) for \(k=1,\ldots ,u_{i,j}-1\). These nodes generate between \(v_{i}\) and \(v_{j}\) the segments \(e_{i,j}\left( 1\right) ,\ldots ,e_{i,j}\left( u_{i,j}\right)\) on the surface of U. The surface of U is depicted between \(v_{i}\) and \(v_{j}\) by a red connection curve. An edge line consisting of the segments \(e_{i,j}\left( 1\right) ,\ldots ,e_{i,j}\left( u_{i,j}\right)\) approximates this connecting curve in order to discretely model the surface of U. Discrete modeling of U is sufficient since the elevation data of terrain are also discrete. The red arrows illustrate the elevation changes between all neighboring auxiliary nodes along an edge \(e_{i,j}\).

Fig. 6
figure 6

A depiction of the decomposition of an edge \(e_{i,j}=\left\{ v_{i},v_{j}\right\}\) in smaller segments with weights of absolute elevation changes. The red curve describes the topology U of a geographical area A, the black nodes \(\left\{ v_{i,j}\left( 1\right) ,\ldots ,v_{i,j}\left( u-1\right) \right\}\) are the auxiliary nodes between \(v_{i}\) and \(v_{j}\) on U and the blue connections are the segments of an edge \(e_{i,j}\)

If an absolute elevation change \(\varDelta h_{i,j}\left( k\right)\) of a segment of a route exceeds a maximum elevation change \(\varDelta h_{\mathrm {max}}>0\) then this route may not be passable. A segment \(e_{i,j}\left( k\right)\) is called critical with respect to the absolute elevation change if \(\varDelta h_{i,j}\left( k\right) >\varDelta h_{\mathrm {max}}\). An alternative most convenient route with \(\varDelta h_{i,j}\left( k\right) \le \varDelta h_{\mathrm {max}}\) for all \(k\in \left\{ 1,\ldots ,u_{i,j}\right\}\) and \(e_{i,j}\in E\) is searched where \(u_{i,j}\) is the maximum number of segments of \(e_{i,j}\). All weights of the segments within \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) will be modified when considering a maximum elevation change. Let \(h_{\mathrm {max}}>0\) be a maximal allowed absolute elevation change of a segment \(e_{i,j}\left( k\right)\). Then the weight of the segment \(e_{i,j}\left( k\right)\) is defined as

$$\begin{aligned} w_{i,j}\left( k\right) ={\left\{ \begin{array}{ll} \begin{array}{l} \varDelta h_{i,j}\left( k\right) , \\ N_{1}, \\ N_{2}, \end{array} &{} \begin{array}{l} \mathrm {if\,\,}\varDelta h_{i,j}\left( k\right) \le \varDelta h_{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}}, \\ \mathrm {if\,\,}\varDelta h_{i,j}\left( k\right) >\varDelta h_{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}}, \\ \mathrm {if\,\,}e_{i,j}\left( k\right) \in E_{\mathrm {crit}}. \end{array}\end{array}\right. } \end{aligned}$$
(17)

where \(N_{1},N_{2}\in \mathbb {R}_{+}\) are two sufficiently large positive numbers. The weight of an edge \(e_{i,j}\) is given by

$$\begin{aligned} w_{i,j}=\underset{k=1}{\overset{u_{i,j}}{\sum }}w_{i,j}\left( k\right) . \end{aligned}$$
(18)

If we assume that the absolute altitude change of \(e_{i,j}\left( k\right)\) may not be greater than \(\varDelta h_{\mathrm {max}}\) then \(N_{1}=+\infty\). If for \(e_{i,j}\left( k\right)\) the areas from O are prohibited then \(N_{2}=+\infty\) when this segment is in O or intersects this set. A route is searched between s and t of V with minimal absolute elevation changes:

$$\begin{aligned} \underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}w_{i,j}\longrightarrow \mathrm {min}! \end{aligned}$$
(19)

Note that modifying the weights from equation (17) for \(N_{1}=+\infty\) and/or \(N_{2}=+\infty\) may result in not finding a solution in the worst-case.

3.3.2 Absolute gradients

Another variant of the most convenient route within a grid \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) is a route with segment weights of absolute gradients

$$\begin{aligned} s_{i,j}\left( k\right) =\frac{\varDelta h_{i,j}\left( k\right) }{d'_{i,j}\left( k\right) }, \end{aligned}$$
(20)

where \(s_{i,j}\left( k\right)\) is the weight of a segment \(e_{i,j}\left( k\right)\) and \(d'_{i,j}\left( k\right)\) is the distance of \(e_{i,j}\left( k\right)\) using the formulas of Vincenty. In this subsection, we consider the absolute gradients of the segments of \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\). A most convenient route in terms of the absolute gradient on \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) is a route between a starting node s and a destination node t that has a minimum sum of absolute gradients in \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\). Such a route is a route with minimal fluctuations from the starting point to the destination. Let \(s_{\mathrm {max}}\in \mathbb {R}\) be a maximum gradient a vehicle can drive. A segment \(e_{i,j}\left( k\right)\) is critical with respect to the absolute gradient if \(s_{i,j}\left( k\right) >s_{\mathrm {max}}\). This critical segment is part of the route that is unsuitable for vehicles due to the high gradient of this segment. All weights of the critical segments of \(\varGamma _{\mathbb {R}^{3}}\left( U\right)\) have to be modified. The weight of \(e_{i,j}\left( k\right)\) is modified as follows

$$\begin{aligned} s_{i,j}\left( k\right) ={\left\{ \begin{array}{ll} \begin{array}{ll} \dfrac{\varDelta h_{i,j}\left( k\right) }{d'_{i,j}\left( k\right) }, &{} \mathrm {if\,\,}\varDelta h_{i,j}\left( k\right) \le d'_{i,j}\left( k\right) \cdot s_{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}}, \\ N_{1}, &{} \mathrm {if\,\,}\varDelta h_{i,j}\left( k\right) >d'_{i,j}\left( k\right) \cdot s_{\mathrm {max}}\,\,\text {and}\,\,e_{i,j}\left( k\right) \notin E_{\mathrm {crit}}, \\ N_{2}, &{} \mathrm {if\,\,}e_{i,j}\left( k\right) \in E_{\mathrm {crit}}, \end{array} \end{array}\right. } \end{aligned}$$
(21)

where \(N_{1}\) and \(N_{2}\) are sufficiently large positive real values. A route is searched from s to t with minimal absolute gradients:

$$\begin{aligned} \underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}\underset{k=1}{\overset{u_{i,j}}{\sum }}s_{i,j}\left( k\right) \longrightarrow \mathrm {min}! \end{aligned}$$
(22)

Analogue to the most convenient routes with respect to the absolute altitude change, the modification of the weights from equation (21) for \(N_{1}=+\infty\) and/or \(N_{2}=+\infty\) can result in no solution in worst-case.

4 Pareto optimal routes

Multi-criteria optimization (Pareto optimization) is used to optimize an objective function with several criteria (such as minimizing the route length as well as minimizing the construction costs of this route) Ehrgott (2005). Often it is not possible to optimize all objectives simultaneously since in general, it is not possible to improve the first objective without worsening the other objectives. Since there is no unique optimal solution defined. A set of solutions is determined in which the improvement of one objective function can be achieved only by the worsening of another, i.e., the set of optimal trade-offs (Pareto front). In our case, the Pareto front gives the optimum of the combination of the three criteria, the shortest route with respect to the distance, the cheapest route regarding the construction costs and the most convenient route in terms of the absolute elevation change or absolute gradient. In our investigation, we have defined a Pareto objective function \(f_{\mathrm {Pareto}}\left( E\right)\) on \(\varGamma _{\mathbb {R}^3}\left( U\right)\) that consists of a distance function \(f_{D}\left( E\right)\), a cost function \(f_{C}\left( E\right)\), and an absolute elevation change function \(f_{H}\left( E\right)\) as follows:

$$\begin{aligned} f_{\mathrm {Pareto}}\left( E\right) =\alpha \cdot f_{D}\left( E\right) +\beta \cdot f_{C}\left( E\right) +\zeta \cdot f_{H}\left( E\right) \longrightarrow \mathrm {min!}, \end{aligned}$$
(23)

with

$$\begin{aligned}&f_{D}\left( E\right) =\underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}d_{i,j}, \end{aligned}$$
(24)
$$\begin{aligned}&f_{C}\left( E\right) =\underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}c_{i,j}, \end{aligned}$$
(25)

and

$$\begin{aligned} f_{H}\left( E\right) =\underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}w_{i,j}, \end{aligned}$$
(26)

such that for all \(v\in V\):

$$\begin{aligned} \begin{array}{l} \underset{e_{i,j}\in \delta ^{-}\left( v\right) }{\sum }x_{e_{i,j}}-\underset{e_{i,j}\in \delta ^{+}\left( v\right) }{\sum }x_{e_{i,j}}={\left\{ \begin{array}{ll} \begin{array}{r} -1,\\ 1,\\ 0, \end{array} &{} \begin{array}{l} \mathrm {if\,\,}v=s,\\ \mathrm {if\,\,}v=t,\\ \mathrm {else}, \end{array}\end{array}\right. }\\ \\ \forall e_{i,j}\in E:x_{e_{i,j}}\ge 0, \end{array} \end{aligned}$$

where \(\alpha +\beta +\zeta =1\) for all \(\alpha ,\beta ,\zeta \in \left[ 0,1\right]\). Since \(\varGamma _{\mathbb {R}^3}\left( U\right)\) is discrete, the minimum of the objective function \(f_{\mathrm {Pareto}}\left( E\right)\) generates a solution space \(S_{\mathrm {Pareto}}\) of points in \(\mathbb {R}^{3}\) for all \(\alpha ,\beta ,\zeta \in \left[ 0,1\right]\) with respect to the equation \(\alpha +\beta +\zeta =1\) . This space lies on a hypersurface of \(\mathbb {R}^{3}\). Each point of \(S_{\mathrm {Pareto}}\) is a minimum of the function \(f_{\mathrm {Pareto}}\left( E\right)\). The Cartesian coordinate axes that depicted the solution set \(S_{\mathrm {Pareto}}\) represent the three criteria distance, construction costs, and absolute elevation changes of a route. The values of each axes indicate the quantity or unit of the objective functions \(f_{D}\) in meters or kilometers, \(f_{C}\) in monetary units and \(f_{H}\) in meters, respectively. The values of \(S_{\mathrm {Pareto}}\) indicate which values the respective objective functions have for each axis in \(\mathbb {R}^{3}\). In case one is looking for Pareto optima with two criteria with respect to \(\{\left( \alpha ,\beta ,\zeta \right) \in \left[ 0,1\right] ^{3}|\,\alpha +\beta +\zeta =1\}\) then one can orthogonally project the set \(S_{\mathrm {Pareto}}\) from \(\mathbb {R}^{3}\) to \(\mathbb {R}^{2}\). The projection of \(S_{\mathrm {Pareto}}\) is a curve in \(\mathbb {R}^{2}\) in that each coordinate axis of this subspace indicates the values of the two remaining criteria. Let \(\zeta =c_{0}\in [0,1)\) be a constant with respect to the equation (23). Then \(\beta =1-c_{0}-\alpha\) for all \(\alpha \in \left[ 0,1-c_{0}\right]\). The set \(S_{\mathrm {Pareto}}\) is projected for a fixed \(c_{0}\) onto a curve in \(\mathbb {R}^{2}\). This will give all optimal compromises between the two functions \(f_{D}\) and \(f_{C}\) for any \(c_{0}\) part of the function \(f_{H}\).

5 Computing optimal routes using CONTRA

For the construction of new routes, we developed a software called \(\textsc{Contra}\), which is the acronym for Computing an Optimal Network of Transit Routes through mathematical Algorithms. This tool is capable of computing and planning the construction of new routes connecting two locations (e.g., cities) in any country. These routes consist possibly of different infrastructure segments such as roads, railways, gas pipelines, etc. This software uses GIS-data, e.g., ground conditions and elevation data, and optimization techniques to compute the building of optimal routes. The output of the software is a summary of the data of the computed route, such as road coordinates, construction costs, and lengths. As an example, we compute routes between the city of \(\textit{Khas Uruzgan}\) and the city of \(\textit{Kabul}\). In this part we computed routes that are below the elevation of 3500 m. In practice, it is unusual to build routes in elevated areas, because the oxygen decreases with increasing altitude.

5.1 Input data

Contra uses for the computation different GIS-data of a chosen area. To determine an optimal route, the following input data is required by this program:

  1. 1.

    Coordinates of the start and destination points (in latitude and longitude) are given in Table 1. These two points are colored in red in Fig. 7. The red dashed line is the line-of-sight connection between them.

  2. 2.

    For the national land cover of Afghanistan the shapefiles of the organization AIMS (1997), formerly of the Afghan Geodesy and Cartography Head Office, were used (AIMS 1997). The whole country is partitioned in polygonal shapes that describe the respective type of land, see Fig. 8.

  3. 3.

    For the topographic representation of Afghanistan, the SRTM-30m data of NASA are used Watkins (2019). The resolution of the SRTM-30m data for Afghanistan is 1-arcsecond (in total \(36001\times 54001\) pixels) in a latitude/longitude projection (EPSG:4326). As an example, in Fig. 9 the area of the province of Uruzgan in Afghanistan is depicted.

  4. 4.

    The maximum gradient angle of the routes is \(\varphi _{\mathrm {max}} = 2.8624^{\circ }\), which corresponds to a maximum gradient of 5%. If this gradient is exceeded in steep areas, serpentines with a gradient of 5% are built.

  5. 5.

    According to reports of the Asian Development Bank and the Ministry of Public Works of the Islamic Republic of Afghanistan, the construction of a two-lane road in Afghanistan is on average approximately USD 1000 per meter (ADB 2007). The cost amount can depend on the land surface on which it is built (Operations 2010). For our research we assumed an estimated cost depending on the different land covers. In general, it is possible to modify the estimated cost.

  6. 6.

    We assume the construction costs of roads along a mountain pass or on the mountainside on average USD 3000 per meter. The costs of quarrying and earthworks is higher than that of building an ordinary road.

Table 1 Start and destination points as geographical coordinates
Fig. 7
figure 7

Start and destination points from the city of Khas Uruzgan to Kabul in Afghanistan

Fig. 8
figure 8

A map of Afghanistan with different land cover. Each color represents a specific land cover (e.g., deserts or forests)

Fig. 9
figure 9

The topography of the Uruzgan province in Afghanistan. The color spectrum from dark to light indicates the height of the terrain

5.2 Results

We compute optimal solutions for the construction of a route from the city of Khas Uruzgan to the city of Kabul in Afghanistan regarding three different single objectives: the shortest route in red, the cost-minimal or cheapest route in green, and the most convenient route w.r.t. the elevation change in blue, see Fig. 10. The columns in Table 2 describe (a) the construction costs of the routes in million USD, (b) the lengths of the routes in km and (c) the absolute elevation changes of the routes, i.e., the sum of all height changes from the starting point to the ending point along the route. Each of these three routes has a certain length and elevation profile.

Fig. 10
figure 10

Three single-objective optimal roads between the cities Khas Uruzgan and Kabul in Afghanistan computed with \({\textsc{Contra}}\): shortest (red), cheapest (green), and most convenient (blue). Image rendering: Google Earth

Table 2 The result of the three routes regarding the cost, length, and absolute elevation changes

Figure 11 shows the elevation profile of a shortest road with respect to the distance between the cities Khas Uruzgan (left) and Kabul (right). Note that there is a slight difference in the lengths of that route computed by our algorithm (337 km, see Table 2) and the re-rendering of that very path in Google Earth (299 km). We believe that this is due to the fact that Google Earth does not take the elevation changes into account when computing a path length. Figure 12 shows the elevation profile of a cheapest road with respect to the construction costs from Khas Uruzgan to Kabul. Analogously, Fig. 13 visualizes the elevation profile of the most convenient road above sea level between these two cities. One can see that this route is a longer distance, but most parts of the route have low absolute elevation changes.

Fig. 11
figure 11

The elevation of a shortest road on terrain from left the city of Khas Uruzgan to right the city of Kabul in Afghanistan. Image rendering: Google Earth

Fig. 12
figure 12

The elevation of a cheapest road on terrain from left Khas Uruzgan to right Kabul in Afghanistan. Image rendering: Google Earth

Fig. 13
figure 13

The elevation of a most convenient road with minimal absolute elevation changes from left Khas Uruzgan to right Kabul. Image rendering: Google Earth

For the Pareto optimum, the following objective function of cost and elevation change is minimized for different \(0\le \lambda \le 1\):

$$\begin{aligned} \underset{e_{i,j}\in E}{\sum }x_{e_{i,j}}\left( \lambda c_{i,j}+\left( 1-\lambda \right) w_{i,j}\right) \longrightarrow \mathrm {min!} \end{aligned}$$
(27)

Figure 14 shows the Pareto front of the routes from Khas Uruzgan to Kabul regarding the two objectives “construction costs” and “elevation changes”. This chart shows on the horizontal axis the construction costs of the routes in million USD and on the vertical axis the absolute elevation changes in meters. The small red circles represent specific routes between these two cities. The leftmost circle represents the cheapest route and the right most circle represents the most convenient route with minimal altitude variation. The circles that lie between these two extremal circles, are other optimal routes from Khas Uruzgan to Kabul which are trade-offs of these two criteria. The gaps between the circles in this figure indicate that there is an unsuitable area (obstacle) between two routes so that the construction of a route across this area is sub-optimal. Thus, the routes run around such ”obstacle areas” and generate gaps in the Pareto front.

Figure 15 shows the optimal routes picked from the red circles in Fig. 14 for six different \(\lambda\) values. For the extremal value \(\lambda =1\) the Pareto optimal route is the cheapest route between Khas Uruzgan and Kabul (see top left depiction in Fig. 15). The second extremal value \(\lambda =0\) presents the most convenient route between these two cities (see below right depiction in Fig. 15). All the other depictions are optimal compromises between these two extremes.

Fig. 14
figure 14

The Pareto front of the most convenient and cheapest routes regarding absolute elevation change and construction costs from Khas Uruzgan to Kabul. Each red circle represents an optimal trade-off routes between the cheapest and the most convenient routes where the most left circle represents the cheapest route and the most right circle represents the most convenient route 

6 Conclusions

The search for a suitable trajectory for the construction of a route in the transport or energy sector can be very time-consuming considering the environmental information. This paper presented a new method of computing the shape of a new route using discrete optimization and mathematical algorithms. The relevant information was taken from the GIS data such as the geographical environment, structure of the soil, topographic elevation data of terrain, and average construction costs of an infrastructure segment. In the first step, U was discretely approximated by a weighted grid \(\varGamma\). In the second step, the weights of this grid were computed regarding the three criteria: (a) distance, (b) construction costs and (c) absolute elevation changes or absolute gradients. In the third step, routes with minimal edge weights were determined between two locations whereby these routes are globally optimal. Furthermore, with Pareto optimization, we have combined these optimization criteria to determine optimal compromises between them that correspond to the real conditions. Finally, we modeled the area between Khas Uruzgan and Kabul in Afghanistan with our computer program \({\textsc{Contra}}\) and with the corresponding GIS data and determined the shortest, cheapest, and most convenient roads between these two cities. With the Pareto optimization we determined several compromises between the cheapest and the most convenient route and presented the change between both extremes as trajectories. In further work, we have the goal to compute the construction of optimal routes with tunnels and bridges. The calculation of tunnels or bridges along a route is more complicated than routes on the surface. When planning tunnels and bridges, the computation must be carried out in a three-dimensional space. This makes the calculation more difficult and time-consuming.

Fig. 15
figure 15

The variants of optimal trade-offs for \(\lambda = 1, 0.5737, 0.3413, 0.0925, 0.0325, 0\): transition from the cheapest route (top left) to the most convenient route (bottom right)