# Coordination in Emergency Response System Design:
## 6 Genetic Algorithm
The fitness function and user preferences are as follows: \[f=\sum_{k\in A^{\mathit{Poor}}}y_{k}+\sum_{l\in A^{\mathit{Adq}}}z_{l}-\left( \sum_{i\in EAS\cup AAS}o_{i}+\sum_{j\in EFS\cup AFS}p_{j}\right)\] (17) Minimum _RTAS_: \[\left|DH_{ik}-DF_{jk}\right|\leq\overline{WT},\ \min(DH_{ik})\leq\overline{RTAS},\ DF_{jk}\leq \overline{RTFS}\] (18) \[\left|DH_{il}-DF_{jl}\right|\leq\overline{WT},\ \min(DH_{il})\leq\overline{RTAS},\ DF_{jl}\leq \overline{RTFS}\] (19) Minimum _RTFS_: \[\left|DH_{ik}-DF_{jk}\right|\leq\overline{WT},\ DH_{ik}\leq\overline{RTAS},\ \min(DF_{jk})\leq\overline{RTFS}\] (20) \[\left|DH_{il}-DF_{jl}\right|\leq\overline{WT},\ DH_{il}\leq\overline{RTAS},\ \min(DF_{jl})\leq\overline{RTFS}\] (21) Minimum WT: \[\min(\left|DH_{ik}-DF_{jk}\right|)\leq\overline{WT},\ DH_{ik}\leq\overline{RTAS},\ DF_{jk}\leq\overline{RTFS}\] (22) \[\min(\left|DH_{il}-DF_{jl}\right|)\leq\overline{WT},\ DH_{il}\leq\overline{RTAS},\ DF_{jl}\leq\overline{RTFS}\] (23) \[\forall i\in EAS\cup AAS,\ \forall j\in EFS\cup AFS,\ k\in A^{\mathit{ Poor}},\ l\in A^{\mathit{Adq}}\] (24)  
Equation (17) is the fitness function and (24) denotes the domains of \(i\), \(j\), \(k\), and \(l\). Equations (18) and (19) describe the minimum _RTAS_ preference for nodes in the poor and adequate zones, respectively. In this case, the minimum response time of an ambulance station for each node k would be selected when node k could be moved to the preferred zone. Similarly, Equations (20) and (21) describe the minimum _RTFS_ preference, and Equations (22) and (23) describe the minimum WT preference. 4. Selecting and Crossover: The generation gap is for helping select the outstanding chromosomes and crossing chromosomes. The crossover rules are as follows:Inside Crossover Rule: The ASLP chromosome crosses the ASLP chromosome with the setting of crossover probability. The FSLP chromosome crosses the FSLP chromosome with the setting of crossover probability. One to One Crossover Rule: In each crossing, randomly selecting one gene for crossing. V Mutation: The crossing genes can be randomly selected to mutate with mutation probability. The mutation of a gene is to change one location of new facilities into other alternative facility sites except for existing facility sites. We now apply the genetic algorithm to the illustrative example, which was solved to optimality, in Section 5. The parameter setting of the genetic algorithm is shown in Table 4 and its solution for different values of _NA_ and _NF_ are depicted in Table 5.  
Although the locations of the ambulance and fire stations are different, Table 6 depicts that the collaborative emergency coverage prescribed by the genetic algorithm is the same as the optimal solution in Table 3 (when \(\text{NA}\geq 2\) and \(\text{NF}\geq 2\)). Figure 5 shows the solutions of the genetic algorithm under different user preferences. Comparing Figure 5a-c reveal that the response and wait times at Node 6 and Node 4 vary with the user preferences. With the user prioritizing wait times, these two nodes are much closer to line 2, i.e., the zero-wait line. \begin{table}
\begin{tabular}{l l} \hline The size of ASLP & _NPAS_ = 100 \\ The size of FSLP & _NPFS_ = 100 \\ The generation gap & _Gap_ = 0.9 \\ The crossover probability & _p\({}_{c}\)_ = 0.9 \\ The mutation probability & _p\({}_{m}\)_ = 0.1 \\ The maximum genetic iteration & 1000 \\ \hline \end{tabular}
\end{table} 
Table 6: Parameter setting of the genetic algorithm in the Chengdu case. \begin{table}
\begin{tabular}{l l l l l} \hline \hline \multirow{2}{*}{**[NA,NF]**} & \multicolumn{4}{c}{**Location**} \\ \cline{2-5}  & \multicolumn{1}{c}{**Ambulance**} & \multicolumn{1}{c}{**Fire**} & \multirow{2}{*}{**Poor**\(\rightarrow\)**Pref. **} & \multirow{2}{*}{**Adeq.**\(\rightarrow\)**Pref. **} \\  & \multicolumn{1}{c}{**Station, \(o_{i}\)**} & \multicolumn{1}{c}{**Station, \(p_{j}\)**} & & \\ \hline
[1,1] & \(i=11\) & \(j=4\) & — & — \\
[1,2] & \(i=11\) & \(j=4\), \(11\) & — & [4,11] \\
[2,1] & \(i=4