# ESCAPE: Evacuation Strategy through Clustering and Autonomous Operation in Public Safety Systems
## 5 ESCAPE Algorithm  
In this section, ESCAPE algorithm (Algorithm 1) and the low-complexity Distributed Exponential Learning Algorithm for Minority Games (DEMG) (Algorithm 2) for human evacuation are presented. Specifically, at each timeslot of the stochastic learning automata, each human \(m\in M\) determines their choice of evacuation route \(e_{m}^{(t)}\) that evacuee \(m\) wants to go considering their action probabilities \(Pr_{m}(t)=[Pr_{m,1}(t),\cdots,Pr_{m,|E|}(t)]\). It is highlighted that this human's decision expresses the evacuation route where the evacuee desires to go, while if they finally evacuate through the specific evacuation route will be determined by the second layer of their decision, i.e., the DEMG algorithmic component. Therefore, after each human's \(m\in M\) choice \(e_{m}^{(t)}\), a cluster of humans \(N_{e}\) is constructed for each evacuation route \(e\in E\), and a minority game is played in order for the set of humans who finally evacuate, i.e., \(N_{e}^{(go)}\), and the corresponding set of humans who do not evacuate, i.e., \(N_{e}^{(ngo)}\) to be determined. Toward determining the Pure Nash Equilibrium (PNE) of each minority game, a distributed exponential learning algorithm for minority games (DEMG) is introduced, allowing humans to learn from their past actions and make the most beneficial strategy selection. In other words, the humans are considered sophisticated players, exploring potential strategies and converging to a PNE [9]. In this paper, a distributed exponential learning algorithm is deployed in order to enable humans of each cluster \(N_{e}\) to converge to one of the \(( \begin{smallmatrix}N_{e}\\ C_{e}-|M|_{e}-1\end{smallmatrix} )+( \begin{smallmatrix}N_{e}\\ C_{e}-|M|_{e}+1\end{smallmatrix} )\) PNE points [24]. Based on the exponential learning algorithm, each human \(m\in M\), starting with equal probabilities, i.e., \(pr_{m,s_{m}=0}^{(0)}=pr_{m,s_{m}=1}^{(0)}=0.5\), and zero scores for the actions 'go' and 'do not go', i.e., \(\pi_{m,s_{m}=0}^{(0)}=\pi_{m,s_{m}=1}^{(0)}=0\), at each iteration \(ite\) of the minority game determines its action \(s_{m}^{(ite)}\), and based on their action's payoff \(f_{s_{m}}(m)\), as it is given in Equation (3), human \(m\) updates their chosen action's score \(\pi_{m,s_{m}}^{(ite)}\). In order for each human \(m\in M\) to evaluate payoff \(f_{s_{m}}(m)\) of their chosen action \(s_{m}^{(ite)}\), winning action \(w^{(ite)}\) is announced by the ECC as a broadcasted bit of information, i.e., \(w^{(ite)}\in\{0,1\}\). It should be clarified that the ECC does not make any centralized decision for the evacuation procedure and, accordingly, the decision-making process lies with the evacuees. Furthermore, in case that communication between evacuees and the ECC is not feasible, other mechanisms can be followed to substitute ECC's role, such as clustering mechanisms, where the cluster head per each evacuation route can communicate with the rest of the evacuees over device-to-device communication and announce the winning action. After the convergence of each minority game played at each evacuation route,evacuees \(N_{e}^{(go)}\), \(\forall e\in E\) are excluded from the system, and humans that did not evacuate \(N_{e}^{(ngo)}\), \(\forall e\in E\), acting as stochastic learning automata, determine their reward functions \(r_{m,e}(t)\), \(\forall e\in E\) and, based on Equations (2a) and (2b), they update their action probabilities \(Pr_{m,e}(t+1)\), \(\forall e\in E\) for the next timeslot.