## 4 Solution Method
### Select a Number of Facilities to Be Opened from the Potential Facilities  
The purpose of this algorithm is to select from potential facilities \(J\) a number of facilities \(p\) to be opened that maximizes the total demand of patients that can be served. Let \(I\) be the list of all potential patients and \(J\) be the list of all potential facilities with their potential patients such that patient \(i\) can be covered by facility \(j\) if a drone can reach \(i\) in one trip using its battery charge. In other words, \(b_{ij}\leq B\), where \(b_{ij}\) is calculated using Equation (1). In addition, suppose that \(p\) is the maximum number of facilities to be opened. Let \(S\) be an empty list of the initial solution of size \(p\) to maintain open facilities. Let \(U_{f}\) be the capacity of each facility calculated according to Equation (2) (i.e., all facilities have identical capacities). After implementing the above steps, the algorithm repeats the following steps \(p\) times, until \(J\) is exhausted or until all patients in \(I\) have been served:  
First, calculate \(\sum_{i\;\in\;I}\;w_{i}\;c_{ij}\;\forall\;j\in J\). That is, we calculated the total demand weights of the potential patients of each facility \(j\in J\). In turn, sort \(J\) is sorted in descending order according to these values. Then, select a subset \(HF\) consisting of \(n\) facilities from \(J\) with the highest \(\sum_{i\;\in\;I}\;w_{i}\;c_{ij}\), and select a facility \(f\)--to be opened from \(HF\) at random. In this case, the idea is to utilize a greedy randomized approach to ensure that a facility is selected from among the top facilities that can cover large patient demand. This maximizes the coverage and, at the same time, eliminates selection bias and variegates the results using random selection, which cannot be achieved using only the greedy criterion. Next, remove \(f\) is removed from \(J\) so that it will not appear again in subsequent iterations when selecting a new facility to be opened. Second, the potential patients \(i\) of \(f\), where \(i\in I\) and \(c_{if}=1\), in descending order according to the demand weight \(w_{i}\). Following this, iterate over these patients and mark them as covered until \(U_{f}\) is filled, or until the list of \(f\)'s potential patients is exhausted (thus making these patients unavailable for other facilities). Hence, if there is more than one facility in \(J\) with the same potential patient \(A\), marking \(A\) as covered by \(f\) will change \(\sum_{i\;\in\;I}\;w_{i}\;c_{ij}\;\forall\;j\in J\) (i.e., the total demand weights of the potential patients of each facility \(j\in\;J\)). It is noteworthy that this affects their appearance in \(HF\) in the next iteration. The last part of the second algorithm adds \(f\) to \(S\). Finally, list \(S\) now contains the facilities to be opened that can serve the greatest possible demands. Algorithm 1 presents the details of the above steps. ```
1. \(I\leftarrow\) List of all potential patients
2. \(J\leftarrow\) List of all potential facilities with their potential patients
3. \(p\leftarrow\) Maximum number of facilities to be opened
4. \(S\leftarrow\{\ \}\)
5. Calculate \(U_{f}=\frac{\sum_{i<\mathit{w}_{i}}w_{i}}{0.8\,p}\setminus\) capacity of each facility \(f\) in \(S\)
6. Repeat
7. Calculate \(\sum_{i\,\in\,\,I}\,\,\mathit{w}_{i}\,\mathit{c}_{ij}\forall\,\,j\,\in\,J\setminus\) the total demand weights of the potential patients of each facility \(j\,\in\,J\)
8. \(Sort(J)\setminus\) in descending order of the total demand weights of the potential patients
9. \(HF\gets J[1\ldots n]\)
10. \(f=Random(HF)\)
11. \(Remove(f,J)\)
12. \(Sort(\mathit{potential\,\,patients\,\,of\,\,f})\setminus\) in descending order of patients demand weight \(w_{i}\)
13. Repeat
14. \(MarkAsCoverd(\mathit{patient}_{i},f)\)
15. Until filling \(U_{f}\) OR the list of \(f\)'s potential patients is exhausted
16. \(S\gets S\cup\,f\)
17. Until Size \(p\) is reached OR \(I\) is exhausted OR \(J\) is exhausted
18.