## 3 Cognitive Packet Network  
Searching physical routes for evacuees or communication routes for emergent messages can be modelled as nonlinear combinatorial optimisation problems to search optimal paths, while minimizing desired cost functions [34]. Due to the fact that classical optimization algorithms can be easily trapped in local minima [35] and exact solutions can be computationally expensive and time consuming for NP-hard problems [36], in this paper, we use the concept of the cognitive packet network, which is a meta-heuristic inspired by natural intelligence, to emergency planning problems. The cognitive packet network (CPN) introduced in [37, 38, 39] was originally proposed for large-scale and fast-changing packet networks and can provide QoS-driven routing to satisfy diverse end users in multimedia networks. By employing smart packets (SPs), CPN can discover optimal routes rapidly and heuristically and realise continuous self-improvement. Contrary to conventional routing protocols, in the CPN, intelligence is realised by using random neural networks (RNNs) [40, 41, 42, 43], which is a mathematical model of natural mammalian neuronal networks and is constructed into SP search. Hence, SPs can discover optimised routes with their predefined goals and improve QoS by learning from their own investigations and experience from other packets. CPN has been applied to many domains, including emergency navigation [44, 45] and emergency resource allocation [35, 46, 47, 48]. As the world's first software-defined network (SDN), it can be installed on computers seamlessly [49]. In the proposed system, the CPN-based algorithm is deployed in the back-end cloud, and each node in the CPN represents a realistic location where evacuees can identify their locations by uploading visual snapshots and querying the cloud. Each node is composed of a recurrent RNN to determine the direction of SPs and a mailbox (MB). Each neuron in the RNN represents a neighbour node, and the neighbour node associated with the highest excitation probability indicates the most beneficial forwarding direction of SPs. The notation in Table 1 is the same as that used in the original RNN model [40]. The mailbox maintains a routing list to store the paths discovered by SPs and sensory data uploaded by smartphones. Consequently, the original WSN-based CPN algorithm in [44] is virtualised in the cloud. CPN contains three types of packets: smart packets (SPs), acknowledgements (ACKs) and dumb packets (DPs). SPs gather information from the traversed nodes and search paths to destinations with respect to predefined QoS goals. They can either choose the neighbour node decided by random neural networks as the next hop or drift randomly to explore and update routes. When an SP reaches the destination, an ACK, which reserves the discovered path, and collected data will be generated and sent back to the source node through the reverse path. When an ACK reaches a node, it will update the MB and train the random neural network by performing reinforcement learning (RL), as shown in Pseudocode 1. DPs are the packets that actually carry the payloads. they always choose the top-ranked path in the routing list as the next hop. In the context of emergency evacuation, evacuees are considered as DPs. AHCPN [8] is a variant of the original CPN and is used in the high dynamic mobile _ad hoc_ networks (MANETs) in which the position of users varies continuously. Since CPN can allocate resources in proportion to the probability of finding an optimal route there, it can significantly replace broadcast transmissions in traditional routing protocols with unicasts. Because each smart phone can communicate with the cloud via 3G directly, hence each smart phone can be considered as a local \"exit\", and SPs needto decide when to stop searching among mobile phones and transmit to the access node that connects to the remote cloud.