## 4 Problem Formulation
```
Step:1 Input data: \(X_{u},Y_{u}\leftarrow\) Meter coordinates \(X_{d},Y_{d}\leftarrow\) UDAP coordinates \(X_{eb},Y_{eb}\leftarrow\) Base station coordinates \(X_{c},Y_{c}\leftarrow\) Head Office Coordinates \(N=card(X_{u})\); \(M=card(X_{d})\) \(K=card(X_{eb})\); \(P=card(X_{c})\) \(X_{T}=[X_{u},X_{d},X_{eb},X_{c}]\); \(Y_{T}=[Y_{u},Y_{d},Y_{eb},Y_{c}]\) Step:2 Calculation of distances: for\(i=1:card(X_{T})\) for\(j=1:card(Y_{T})\) \(D(i,j)\gets Haversine([Y_{i}\;\;X_{i}],[Y_{j}\;\;X_{j}])\) endfor endfor \(D(D=0)\leftarrow\infty\) \(\alpha=N+M+K+P\); \(D_{max}=\delta\quad\forall\;\delta\in\mathbb{Q}^{+}\) \(G_{\alpha,\alpha}\leftarrow\) ceros; \(G(D\leq D_{max})\leftarrow\) unos Step:3 Minimum roads and route costs: \([rp\;\;ci\;\;ai]\leftarrow\) compress sparse matrix\((G)\) \(A=[rp\;\;ci\;\;ai]\) pred\(\leftarrow\) Dijkstra\((A,\alpha)\) Cost\(T\leftarrow\) RouteCost\((\alpha,pred)\)
```  
**Algorithm 1** Shortest Routes in a Wireless Network```
1 Input data:  Initialize variables \(CapNodo=\mu\quad\forall\;\mu\in\mathbb{N}\) \(Coverage=\lambda\quad\forall\;\lambda\in\mathbb{Q}^{+}\) Step: 2 Minimum spanning tree generation: \(B_{M,N}\gets zeros\) for\(i=1:M\) \(XY1=\left[X_{T}(1:N),Y_{T}(1:N)\right]\) \(XY2=\left[X_{T}(N+i),Y_{T}(N+i)\right]\) \(tmp\gets Prim(XY1,XY2,CapNodo,Coverage)\) \(B(i,temp)\leftarrow ones\) endfor Step: 3 SCP resolution and UDAP selection: \(s\gets sum(B)\): \(L=1:N\) \(ind\gets find(s=0)\) \(L(ind)\leftarrow\varnothing\): \(B(:,ind)\leftarrow\varnothing\): \(B=B^{\prime}\) \([solC,\;solL]\leftarrow GreedySP(B)\) \(R\gets ordered(solL^{\prime},rows^{\prime})\) \(X_{el}=X_{d}(R);Y_{el}=Y_{d}(R)\) \(X_{d}=X_{el};Y_{d}=Y_{el}\) Step: 4 Calculation of distances: \(G\leftarrow\varnothing\); \(M=length(X_{el})\) ;\(D\leftarrow\varnothing\) \(X_{T}=\left[X_{u},X_{d},X_{eb},X_{c}\right]\); \(Y_{T}=\left[Y_{u},Y_{d},Y_{eb},Y_{c}\right]\) for\(i=1:card(X_{T})\) for\(j=1:card(Y_{T})\) \(D(i,j)\gets Harsine(\left[Y_{i}\;\;X_{i}\right],\left[Y_{j}\;\;X_{j}\right])\) endfor endfor \(D(D=0)\leftarrow\infty\) Step: 5 Minimum roads and route costs: \(D_{max}\leftarrow\delta\quad\forall\;\delta\in\mathbb{Q}^{+}\) \(G\leftarrow Assignweights(D,D_{max},N,M,K,P)\) \([rp\;\;ai]\leftarrow\) compress sparse matrix\((G)\) \(A=[rp\;\;ai]\) \(pred\leftarrow Dijkstra(A,\alpha)\) \(CostT\leftarrow RouteCost(\alpha,pred)\)
```

**Algorithm 2** Optimal Number of UDAP in a Wireless Network```
Input:\(D,D_{max},N,M,K,P\) Output:\(G\) Step:1 Input data:\(\alpha=N+M+K+P\) \(G_{n,A}\leftarrow\) zeros \(G(D\leq D_{max})\leftarrow\) ones \(G2_{n,A}\leftarrow\) zeros \(v2\approx v1;v3>v9;v4\approx v2;v5>v4\) \(v6>v3;v7>v5;v8\approx v7;v9>v8\) \(\forall\ v1,v2,v3,v4,v5,v6,v7,v8,v9\in\mathbb{N}\) Step:2 Assignment of weights:\(\text{G2}(1:N,1:N)=v1\) \(\text{G2}(1:N,N+1:N+M)=v2\) \(\text{G2}(N+1:N+M,1:N)=v2\) \(\text{G2}(1:N,N+M+1:N+M+K)=v3\) \(\text{G2}(N+M+1:N+M+K,1:N)=v3\) \(\text{G2}(1:N,N+M+K+1:N+M+K+P)=\infty\) \(\text{G2}(N+M+K+1:N+M+K+P,1:N)=\infty\) \(\text{G2}(N+1:N+M+1:N+M)=\Phi\) \(\text{G2}(N+1:N+M,N+M+1:N+M+K)=v5\) \(\text{G2}(N+M+1:N+M+K,N+1:N+M)=v5\) \(\text{G2}(N+1:N+M,N+M+K+1:N+M+K+P)=v6\) \(\text{G2}(N+M+K+1:N+M+K+P,N+1:N+M)=v6\) \(\text{G2}(N+M+1:N+M+K,N+M+1:N+M+K)=v7\) \(\text{G2}(N+M+1:N+M+K,N+M+K+1:N+M+K+P)=v8\) \(\text{G2}(N+M+K+1:N+M+K+P,N+M+1:N+M+K)=v9\) \(\text{G2}(N+M+K+1:N+M+K+P,N+M+K+1:N+M+K)=v9\) \(\text{G2}=G*G2\)
```  
**Algorithm 3** Assign Weights