1 Introduction

Almost half of the world population resides in urban areas, and this trend is expected to be advancing positively due to people circumstantially migrating to urban areas from the conventional rural areas for seeking economical progression and achieving a better standard of life. Conceptually, the smart cities present the motivation for enhancement and modification in metropolitan urban planning and modernization. Different types of advance and smart technologies are integrated to establish highly favorable and conventional networks. These networks make traditional cities into smart cities where several devices are connected to form a data communication platform and offer various services [1, 2]. Smart cities play a significant role where people seek benefits by using more feasible, cost-effective and convenient solutions for their healthcare services, transportation systems, industrial growth, public services, environmental and socioeconomic perspective. The dream of smart cities became true when several countries have changed their traditional cities into smart cities by revamping their traditional systems into new technology-oriented systems. Smart city services can be expanded into numerous and diversified domains. The most prominent examples of smart cities are Busan in South Korea, Chicago in the USA, Milton in the UK and Santander in Spain. Intelligent transportation systems (ITS), Internet of Things (IoT), smart grid, agriculture precision networks, information systems (IS), healthcare systems, sensor-enabled networks disciplines have been implemented jointly or separately and offering a number of services [3, 4]. Due to the complex and mixture of advanced technologies, the smart cities’ framework is more complex and challenging [5].

Due to complex and integrated systems, smart cities are suffered from various open challenges like how to handle the high mobility of nodes, how to handle and provide more convenient to users for their smart living environment and security provision for smart city networks [6]. Various different types of solutions have been introduced to handle the mentioned challenges, but still, these all areas are suffering from data communication degradation, more feasible and people interest smart living solutions and more important the security concern. There are various other challenges to design the smart city solutions like heterogeneity, data handling and analysis, data security and sustainability. Heterogeneity means the complex smart city architecture where multiple vendors, different devices and applications are involved. There is a still challenge how these heterogeneous things integrate and operate on application layer. Due to open nature of smart living applications, the data of users are not secure and need high security to design the techniques for data management. Information security is on risk and needs additional measures to secure the smart city networks.

Nature-inspired optimization solutions have been designed to handle the issues in different areas. Computational intelligence has changed the computing trend and offers new optimization techniques and new intelligent systems for complex networks. Some of the well-known nature-inspired algorithms are ant colony optimizer, dragonfly algorithm, grasshopper optimization algorithm, swarm algorithm, bee algorithms and red swarm algorithm [7, 8]. The inspiration is related to the ant, swarm and fly skills for searching food and fighting for food, mates and territories. Nature-inspired algorithms have some advantages over traditional solutions due to its optimal nature to handle optimization issues. These algorithms are applied in the form of optimization and find the optimal solution to solve the problem. The inspiration behind these solutions is nature which is one of the most suitable entities for solving complex problems.

In this paper, we designed three solutions for smart mobility, smart living and security provision in smart cities. These solutions are dragon clustering mobility in IoV (DCMIoV), smart living moth flame electric management (MFEM) model and ant colony-based intrusion detection system (ACIDS) for smart cities. The detail of these solutions is discussed in the next sections. The solutions are also tested in a simulation environment to check the performance in terms of related parameters. The main objectives of this paper are as follows:

  • To propose a layered architecture for smart cities.

  • To review most recent nature-inspired solutions for smart cities.

  • To propose a solution for smart mobility data communication by using dragonfly inspiration.

  • To propose a solution for economical smart living by reducing the electric cost by using moth flame inspiration.

  • To propose a security provision intrusion detection system by using ant colony inspiration for smart cities.

  • To present simulation-based experiments for all solutions to check their performance and abilities.

The rest of the paper is organized as follows: Sect. 2 discusses the open challenges related to smart cities. Section 3 presents the smart city architecture with its main areas. Section 4 discusses the related work on nature-inspired solutions for smart cities and their technical comparison. Section 5 presents the three proposed solutions for smart cities. Section 6 presents the experimental results of the proposed solutions. The last section concludes the paper with a future direction.

2 Current challenges of smart cities

Smart cities’ concept and its real implementation are different aspects. The development of smart city systems in perspective of design, processes, deployment and operation stages has various hurdles and complexities. Various underdeveloping countries have thinking smart cities in perspective of its cost, maintenance and control management. No doubt with several benefits, this concept has suffered from different challenges like data management, security, sustainability, scalability and heterogeneity among devices. The first challenge is operational and design cost where financial cost is higher than real-world implementation [9, 10]. Heterogeneity is another challenge where multi-vendor and multi-purpose sensors, different devices and applications are working together where incompatibilities occur. Smart city concepts are based on various elements that are open to a varied set of cybersecurity trends, threats and unlawful usages. In such an environment, a single vulnerability once exploited by an adversary could jeopardize the whole smart city model [11]. Such complex and unreliable circumstances possess a trivial challenge to digital cyber investigators, which will perpetually have relied on the generation of sensitive data obligated by the secure smart city components [12, 13]. To visualize a secure smart city over a cybersecurity platform to maintain and access reliable forensic substantiation, data mining, transfer and storage are given due diligence in the Cloud is obligated [14, 15]. A secure smart city is based on a complex cyber preparedness that invariably benefits the development of more substantial and sustainable ways to distinguish, identify and avert technical issues earlier to prevent harm to sensitive and critical data. To tackle and address the discussed challenges, we proposed a layer architecture for smart city and three areas solutions for better system integrations [16, 17].

3 Proposed smart city architecture

The concept of smart cities has significantly gained popularity and importance. Smart city concept is comprised of anthology-based entities which are developed, designed, deployed and administered within a city to ease convenience and provides the superior living standard. Globally numerous initiatives have facilitated the emergence of smart cities that concentrate on the needs of businesses, institutions and citizens, through the beleaguered and proficient quality of services. Emergence new technologies guarantee the provision of the interconnected environment through intelligent, interoperable and proficient technologies and platforms based on cloud, big data and secure communication platforms. Smart city model shall incorporate various types of IoT-based sensors particularly for smart parking, structural health awareness, metropolitan noise mapping in real-time, traffic-level monitoring and route optimization along with the secure and smart road lighting.

3.1 Main areas of smart cities

Various components of smart cities have been designed including smart mobility, smart grid systems, smart community, smart healthcare systems, disaster management, waste management and smart schooling. These all areas are established after analyzing the smart cities’ needs and requirements. For this paper, we selected three main areas including smart mobility, smart living and security provision.

3.1.1 Smart mobility

In smart mobility, all types of transportation within the city are included. In urban areas, traffic congestion is a significant issue due to traffic flows, complex road structures and poor traffic control systems. For any city, the transportation system is considering one of the main pillars. Vehicle nodes are connected with or without infrastructure and form a network for safety and infotainment applications for drivers and passenger’s convenience. Separate networks like vehicular ad hoc networks (VANET), Internet of Vehicles (IoV) and other intelligent transportation systems have been working separately [18]. In these systems, the services are based on safety and alerting message dissemination and hybrid emergency message broadcasting. In smart cities, the previous research has focused on traffic management and control systems [19, 20]. Some other attempts have been done to solve the information collection and data gathering systems to control the traffic systems and by using new Internet technologies [21]. Vehicle tracking and localization are other focused areas in the smart mobility domain where the vehicle is tracked in real-time manners. The transportation system is embedded with different types of communication and navigation systems. After extensive work on vehicular networks, recently some drone-enabled solution has been proposed to handle traffic issues by gathering the messages and monitoring the traffic by using smart drones in urban areas [22, 23]. Unmanned aerial vehicles are used to enforce the traffic rules, and facilitate the traffic police to locate the traffic congestion areas. The most popular applications of drone-enabled transportation systems are flying speed camera monitoring, flying accident report agents and emergency support agents.

3.1.2 Smart living

Smart living is a broad area where various services have been integrated for public safety, public health care, tourism, education, smart buildings and disaster management to enhance the quality of life. In urbanization, public safety is one of the significant concern areas. Such a system has been designed for smart living like interactive voice response (IVR) where the people report and take feedback about any safety-related concern [24]. Health care is another aspect of smart living and considered one of the main pillars in urbanization. Various studies have been designed real-time mounting systems for elderly people, sportsmen and normal patients for heart rate, brain functions, physical movement and other important health parameter monitoring. In this area, all the medical centers are connected with wearable devices to serve the services to the patient at their homes and in hospitals. Smartphones, sensors and other devices have used and deployed and connected with cloud computing services, big data analytic systems for further investigation and decision making. Some other areas of smart living are the tourism ecosystem for tourist services. This system provides a significant benefit for visitors, promotes local businesses and plays a significant role in city economic growth. Smart building is also included in smart living systems where people are using their smart devices to collect and send information, and experience their shopping’s, with the help of navigation systems [25].

Smart grids are another important area and the main pillar of urbanization. Without energy resources, the other system has been suffered because the main source of any system is electricity. Smart grids are a crucial component for a sustainable energy future. This system provides more compatible data flows, electric management, electric controlling, operation management, distribution management and maintenance. These electricity smart systems are operated and facilitated by users or other stakeholders [26]. Smart grid systems are able to provide the capacity to integrate the distributed renewable energy sources, control all the processes from user to grid and power generation plants and fulfill the demand and supply management by using smart data analytic modes and sensor and technology-based solutions. One the user side, smart metering also facilitates the users by receiving all status on their smartphones. These systems are also based on new ICT technologies and reduced the cost and another environmental emission by using smart sensors to monitor and observe any grid output and reduce loss ratio.

3.1.3 Security provision

Security is one of the main components of any system where secure data communication is required to protect the user’s data from unauthorized access, manipulation and any other malicious activity. Different systems have been designed to handle security loopholes from the networks, but still due to the attacker’s attention, always there is a gap to think about security concerns [27]. Nature-inspired solutions have used to protect the data in smart cities.

3.2 Smart city operational layers

A combination of multiple networks, need to design a universal architecture of smart cities that is acceptable and feasible for real-world deployment. Various new communication technology standards and protocols have been adopted for high data communication. These new standards and technologies ensure the better networking, with low interference and low signal attenuation, and ensure the spectrum utilization. The solutions of smart cities should be scalable and have high coverage and low cost, robustness and high authentication encryption mechanism. Some of the emerging technologies are software-defined networks, network function virtualization, cognitive radio communication, 6LowPAN standards, Sigfox and 5G. There are some other modern communication technologies are used in smart cities like WiMAX, Wi-fi, LTE, LTE-A, ZigBee and Bluetooth [28, 29]. The main objectives of these all standards and technologies are to provide error-free connectivity, ultra-high spectral efficiency, high-data-rate transmission and low power consumption [30]. In this paper, we propose smart city architecture which is divided into five layers including service layer, data handling layer, data communication layer, device deployment layer and security layer as shown in Fig. 1.

Fig. 1
figure 1

Smart city layer architecture

The first layer is the device’s deployment layer where the sensing smart devices in the shapes of smart sensor nodes, physical devices and infrastructure are deployed. This layer deals with complex computation processes, information storage, sensing capabilities and intelligent decision making. Smart city services are based or rely on this layer, due to its importance in decision making. This layer also responsible to handle scalability and integration issues due to several mix devices and their communication rage and interconnectivity [31]. Data collection is another challenge of this layer due to immense heterogeneity. Smart devices of IoT, wireless sensor networks (WSN), IoV, drones are working together and form a network for different services such as collecting and sensing the data, and routing and disseminating the data. Different types of technologies have been adopted to fulfill this layer operation including ZigBee, Bluetooth and other radio deployed sensors. This layer is based on physical devices and infrastructure like base stations, access points and other microwave towers. Deployment of these devices is another challenge in complex urban scenarios.

Layer two is the data communication layer, where various types of standards like 3G, 4G and 5G are working with the help of cellular, wireless, Wi-fi, Li-Fi, WiMAX and wired network architectures. This layer is a backbone layer due to its convergence with various communication networks [32]. The data handling layer is another framework based on different data acquisitions and applications. Big data handling and data management are the main tasks of this layer. For the sustainability of smart city processes, this layer has an important role by maintaining data vitality. This layer also contains data fusion, data storage, data processing and decision management. Service layer is the top layer in smart city architecture where users perform their operation by using different types of computer-based, android-based and user interface-based applications. The most popular applications at this layer are smart weather forecasting, smart grid services, transportation, industrial IoT and community development applications. Smart applications are more liable for decision execution. This layer also responsible for performance improvement plus certain and uncertain needs of users. The last layer is providing security provisions to protect and secure the user’s data from any unauthorized access. Smart cities have various types of security threats due to their open system architectures where only one single vulnerability exploited by any individual or group of attackers may put the whole city into a serious risk [11]. This layer handles different types of security threats. The data collection, processing and data routing need security and privacy measures.

4 Nature-inspired approaches to solve smart city challenges

Computational intelligence and new integrated technologies have changed the computing trend and presented the new emerging computation era. Nature-inspired solutions have been proposed and designed for optimization and developed new intelligent systems for complicated problems. Some of the well-known nature-inspired algorithms are ant colony optimizer, dragonfly algorithm, grasshopper optimization algorithm, swarm algorithm, bee algorithms and red swarm algorithm. The inspiration is related to the ant, swarm and fly skills for searching food, fighting for food, mates and territories. Nature-inspired algorithms have some advantages over traditional solutions due to its nature to handle optimization. These algorithms are applied in the form of optimization and finding the optimal solution to solve the problem. The inspiration behind these solutions is nature which is one of the most suitable entities for solving complex problems. These solutions also maintain a balance between various components. There are various types of nature-inspired algorithms have been designed such as human decision making (fuzzy logic, game theory) and swarm intelligence (particle swarm, ant colony, bee colony) [33].

4.1 Nature-inspired solutions for smart mobility

The authors in [34] proposed a grey wolf optimization clustering for VANET (GWOCNET) based on grey wolf social behavior and hunting mechanism. This algorithm uses a clustering approach plus four positions of grey wolf to attack the prey. The four positions are searching, surrounding, attacking and confronting the target. A mathematical model is designed to understand the algorithm process. An optimized number of clusters are used for convergence values to reach the best value. This algorithm is evaluated with two variants including particle swarm optimization and CLPSO. The final simulation results indicated that this algorithm is better in terms of routing cost and the number of clusters. The authors claimed that fewer clusters reduced the resource requirements, especially in vehicular networks. However, the vehicular network environment is unpredictable where the traffic is dense and sparse, so this type of solution is not feasible when the scenario is not according to logarithm design.

The authors in [35] proposed a cluster algorithm for vehicular networks based on dragonfly optimizer (CAVDO) by using transmission range and traffic density in the networks. This algorithm has inspired with ant colony optimization approach where an algorithm uses dynamic network parameters, tuning weights and 5G interfacing techniques. Also, the proposed algorithm is constructed to deal with multi-objective optimization and provides more predictable solutions. This algorithm also uses a swarm-based multi-objective technique for clustering and uses inertia weights for food search. The advantages of 5G also have adopted for interfacing. The simulation is performed to evaluate this algorithm in terms of less number of cluster selection and dynamic transmission range selection. This algorithm is evaluated with existing algorithms in the presence of several nodes and cluster formation time. However, the IoV environment is based on high mobility, dynamic topologies and real-time applications where prediction factor is not so accurate for data routing.

The authors in [36] proposed a clustering-based modified ant colony optimizer for the Internet of Vehicles (CACOIOV). This solution is designed to handle the IoV networks where the topologies are changing and lead to instability in the networks. This algorithm is based on a metaheuristic clustering algorithm by using ant colony optimization for route optimization. This paper also proposed another algorithm for mobility management and merged with CACOIOV. The main objectives of this algorithm are to provide stability among vehicle nodes by using a dynamic nature-enhanced approach and also optimize and scale the network load by equal distribution in IoV. Ant behaviors for searching food resources are taken into account to find the shortest path in the network. For every cycle, the algorithm finishes the process by using investigative information. Simulation results indicated that this algorithm has higher performance in terms of data delivery ratio, data throughput and end-to-end delay.

In another effort in [37], the authors proposed a modified cognitive tree routing protocol (MCTRP) inspired by whale optimization. This algorithm is based on tree structure for optimal routing by the inclusion of an efficient optimized scheme. The genetic whale optimization algorithm is used to select the root channel for data transmission. When the root channel is active, then other channels are disabled. Bubble net hunting strategy is used to mirror the hunting behavior of the humpback whales. These whales use spiral-shaped bubbles to follow and encircle their prey. In addition, a hybrid whale optimization is adopted for spiral-shaped bubbles to encircle their prey. By using NS-2 simulation, this algorithm is evaluated in terms of data delay, channel utilization, overhead, data delivery and throughput. However, this type of tree-based solutions is no more appropriate for IoV networks due to sparse and dense traffic situations.

In [38], the authors proposed an ant colony algorithm for traffic management systems. This system is designed for the Internet of Vehicles, for route selection by using the ant colony algorithm to control the traffic. This system improves traffic efficiency and reduces travel time. Ant colony algorithm uses forwarding and backward ant process to identify the optimal route in the network. The number of vehicle nodes plus road length is taken into account. Forward ant is also finding the shortest path to reach the destination. To evaluate the system performance, the authors compared this system with a well-known Dijkstra algorithm and Orim’s algorithm. This system has better results in terms of average waiting time. However, this system is not evaluated in terms of average delivery, overhead and delay parameters which are most significant for these types of systems.

In another study [39], the authors proposed a new scheme ant colony optimization algorithm for traffic light (ASTL) to intelligently control the cycles of traffic lights. This solution controls the traffic light management by using nature-inspired solution called ant colony optimization. The main purpose of this approach is to find the best possible results in terms of less waiting time, maximizing the flow crossing between intersections when the traffic lights are green. This solution is designed for intelligent transportation system which is one of the subclasses of smart cities. Traffic light control problem is one of the core issues in urban environment where the fix timing traffic lights are working to control the traffic and not feasible when there is not any traffic existing on the roads. In order o solve this problem, the proposed ASTL solution provides real-time solution to record the traffic flow and optimize the total waiting time for more convenient.

In [40], the author proposed a mobility traffic algorithm (MTA) for real-time information optimization. The proposed approach is using dynamic movement system and mobility traffic model to decrease the stress level of the buses especially ion data time. In this model, every passenger receives the information related to current location of the bus carpool and seating availability. This information is based on passenger preference arrival time and price. The authors selected the objective function for finding the minimum value of trip price and time. Passenger can select the preferable time and cost bus. The results indicated that this model achieved the satisfaction level of passengers during carpooling to travel. This model is tested in Ottawa city where they generated random movements of nodes.

4.2 Nature-inspired solutions for smart living

The authors in [41] proposed random forest classifier (RFC) and MapReduce process. This solution is inspired by an improved dragonfly algorithm for better classification. This solution is designed for IoT networks where big data is generated, processed and separated. M-Health data are used to analyze where the optimal features are selected to build a cost-effective model for prediction. The basic idea behind this solution is to enhance the performance of data mining and machine learning techniques by eliminating redundant irreverent features. Several experiments are presented in this work to evaluate the proposed algorithm performance in terms of accuracy, time and classifiers. This method is compared with the Gaussian mixture model and logistic regression models where this method achieved better accuracy. However, this algorithm has process complexities due to big data.

The authors in [42] proposed a hybrid ambient-assisted living–naïve byes firefly algorithm (HAAL-NBFA) for IoT healthcare systems. This architecture is based on five classification techniques to handle the big imbalanced data sets. This paper uses the firefly algorithm to optimize the features and provide high accuracy. This solution provides a safe-fail module to stop the system and permits its continuation if the sensor is failed. The firefly concept is used for optimization by mimicking the attitude of the firefly and attracting the mating partner. Fireflies are using their flashing lights to warn predators besides attracting mating partners. This approach was adopted in this solution to design and solve the prediction process with more accuracy. The experiments indicated that the proposed solution provides high accuracy to predict the health status of a patient suffering from blood pressure. However, due to complex processes, this type of system is facing complexity issues and taking more time.

In [43], the authors proposed two algorithms inspired by moth flame and genetic algorithms called time-constrained genetic moth flame optimization (TG-MFO). The proposed algorithm is designed for nearly zero end user comforts by scheduling in home appliances. The basic idea behind this system is to evaluate the scheduling of home appliances in the smart grid systems by using single and multiple home scenarios. The TG-MFO is compared to five existing algorithms including genetic, ant colony, cuckoo, firefly and moth flame. The simulation results indicated that the proposed algorithm has reduced the energy for a single user in the residential sector. The performance of the proposed algorithm is evaluated in terms of energy cost, average waiting time and maximum delay. However, this approach is costly and deployment is also complex.

In [44], the authors proposed an energy management solution called home energy management scheduler (HEMS) by using two nature-inspired algorithms: crow search and genetic algorithms. This system reduces the electricity cost and provides real-time pricing for electric bills. Through a genetic algorithm, this system evaluates the population and also provides a better optimal solution than other existing algorithms. The genetic algorithm is evaluating the initialization of population, selection of parents, crossover and mutation and then terminates the population. Also, the crow algorithm is based on crow behavior by using initialization of population, initialization flow of results, initialization of the population and energy efficiency of smart grids. Simulation results indicated that the proposed algorithm has a better performance compared with existing algorithms in terms of peak-to-average ratio and desirable waiting time. However, this type of algorithms is taking the time and slow in processing.

In [45], the authors proposed a system for smart traffic management in city areas to control the traffic flow. This hybrid intelligent application based on bat algorithm especially designed for smart cities. The classifier of the region of traffic light images is utilized for classification by suing nature-inspired algorithms. The bat behavior is used to classify the regions of traffic lights and predict the future route by using the optimization method. This system is a useful resource for color blind people to identify the traffic signals. This system is also used as a recommendation system to provide a different scenario based on time and location. This system also predicts the route for safety and comfort. The simulation results indicated that this system is useful for color blind people and assists them to find the traffic lights clearly and also provide a platform for future direction. However, this system scope is very limited because this type of system is costly and complex due to its color analysis.

The author proposed an improved artificial bee colony optimization-based clustering (IABCOCT) in [46] based on bee colony optimization technique. For smart living, the sensor nodes are using to sense and monitor the required data and help to maintain the connectivity and coverage. This paper presents the bee colony-based solution and improves the energy efficiency of the nodes and convergence rate. This proposed solution is tested in simulation environment to evaluate the results in terms of packet loss, delay and average energy consumption. The basic function of this approach is to select the CH by using the merits of grenade explosion method and Cauchy operator. The main benefits of these methods are their embedded features to improve the degree of exploration during CH selection. The CH selection and election are the significant phases in every cluster-based approach because most of the energy is depleted in these phases. If these phases are based on feasible methods, then the overall performance of any approach increased.

4.3 Nature-inspired solutions for security provision

In this paper [47], the authors proposed a technique for privacy preservation inspired by a grey wolf and cat swarm optimizer called grey wolf optimizer–cat swarm optimizer (GWO–CSO). In cloud-based systems, data privacy is one of the significant concerns. Nature-inspired algorithms have been adopted for privacy preservation. This technique is processed by using k-anonymization criteria for duplicating k-record from the original database. The main objective of this technique is to maximize the privacy and data utility by using the balance method between data retrieval and data protection. Four searching agents are used for decision making. The simulation results are indicated that this technique is better in terms of classification accuracy and information loss as compared to existing techniques. However, this type of solution has complexity issues which lead to utilizing more time.

The authors in [48] proposed cryptography-based encryption for medical image security for IoT. This approach is based on a cryptographic model with optimization strategies. Medical data need security due to its availability on cloud and other open systems. To handle security concerns, this approach is based on encryption and decryption by using hybrid swarm optimization and grasshopper optimization. The concept of grasshopper optimization is its creepy crawlies to classified bug. Grasshopper has usually harmed the crop production. This algorithm utilizes less memory and has less unpredictability. This algorithm takes less time for encryption and decryption processes. The experiments are conducted in different scenarios to evaluate the proposed algorithm performance such as with or without attacks. However, the cryptography-based solutions are not more reliable, especially in a cloud-based environment.

The authors in [49] proposed a scheme dragon particle swarm optimization (dragon PSO). This scheme is based on two techniques called dragonfly algorithm and particle swarm optimization. This scheme is designed for the cloud-based environment which suffered from security and privacy concerns. The proposed scheme is inspired by a dragon to find the optimal value of satisfying the k-anonymization criteria. Afterward, this scheme develops a database with high utility and privacy. This scheme is evaluated in terms of information loss and classification accuracy. The simulation results are indicated that the proposed privacy preservation scheme achieved the best results as compared to other existing schemes. However, security and privacy are different and need more attention to deal with separately.

The authors in [50] proposed an ant colony optimization algorithm for secured routing (ACOSR) for WSN. This model is based on trust perception where the algorithm estimated the node trust value which is derived from its behavior to identifying the malicious nodes in the network. Trust evaluation is based on an ant colony routing algorithm. This algorithm deals with different malicious attacks like selfish attack and the black hole attack. This algorithm is also adopted residual energy among all nodes and reduces the energy consumption of WSN networks. The simulation results indicated that the proposed algorithm is better in terms of the packet loss ratio, end-to-end delay and data throughput. However, this algorithm is tested in a normal scenario and not taken complex networks.

In [51], the authors proposed an elliptic curve integrated encryption scheme (ECIES) to protect the data. This framework is based on cloud services where a service provider selects the eminent server using a cuckoo algorithm with a Markov chain process and levy’s fly. After the selection of the server, this framework encrypted the user data at the user side and forwarded it to the service provider which is cloud-based. Also, the service provider stores the encrypted data and applied its cryptographic technique. This double strategy is more authentic and offers confidentiality at bothering sides. This system is more secure and offers data secrecy and integrity at the user end before storing it at the cloud server. The authors also highlighted the more authentication and confidentiality of data as well as computing efficiency. However, this system is not tested in a real environment because usually the double-encryption techniques.

In another latest study [52], the authors proposed a density-based spatial clustering of applications with noise (DBSCAN) solution for smart city IoT domain. This approach is used to detect the anomalies in large-scale data. The author improved the traditional algorithm problem where the nearest neighbor search and parameter section problem existed. This proposed approach solved this issue by using multistage model for anomaly detection. In the first stage, the proposed approach captured the relevant set of features from data set and then used firefly algorithm for partitions. In the third stage, a kernel-based locality hashing method is used to solve the problem of the nearest neighbor search (see Table 1).

Table 1 Comparison of nature-inspired solutions

5 Discussion

One of the most significant aspects is optimal usage of available services in smart cities. Different devices including sensors, access points, routers and high-end systems are connected with each other and utilizing available resources for various mobility and smart living applications. A number of solutions have been designed to accommodate the smart city services. However, still smart city operations have suffered with overhead, complexity, delay and security issues. The nature-inspired solutions are the best ally to handle the smart city data communication such as ant colony, swarm computing, grammatical evolution and swarm. These nature-inspired solutions are widely investigated to address the smart city challenges. These solutions behavior makes the data communication more efficient by providing alternate routes and data security. As discussed above, the nature-inspired solutions have adopted in smart living, mobility and security domains. The different nature living things’ behavior is taken into account to design the solutions such as dragonfly, ant colony, grasshopper, firefly and grey wolf. These solutions are used for classification, optimization, improving the data delivery and reducing the computational time and delay. These solutions also provide integrity and secrecy and reduce the any security risk for users. These solutions are adopted for system trust and privacy such as in [49, 51]. On the other hand, these solutions are also used for smart living system where these solutions resolved optimization and maximize the energy cost, average waiting time and maximum delay problems.

6 Proposed nature-inspired solutions for smart mobility, living and security

In this section, we proposed three nature-inspired solutions for smart mobility’ dragon clustering mobility in IoV (DCMIoV), smart living moth flame electric management (MFEM) model and security provision ant colony-based intrusion detection system (ACIDS) in smart cities. The complete design, model and process are discussed to understand the implementation of proposed solutions.

6.1 Proposed solution for smart mobility

Smart mobility is one of the core components of smart cities where the vehicle nodes move toward the destinations. The urban areas are more congested due to heavy traffic conditions. The traditional VANET have changed into the more advanced IoV. IoV is evolving with more advance wireless access technologies, for vehicle-to-vehicle and vehicle-to-infrastructure and hybrid communication [53]. These networks are complex where high mobility of nodes creates a challenging problem for vehicle nodes and frequent disconnection issues occur. As inspired by nature, we proposed a technique based on dragonfly behavior. This technique handles the multi-objective optimization problem and provides the prediction for the future. We assumed that all the vehicle nodes are equipped with onboard units, GPS systems and able to communicate through the base station which is deployed in smart cities. Various types of solutions have been designed to tackle the optimization problem in IoV related to routing protocols for different layers, cross-layer frameworks, hybrid solutions and nature-inspired solutions. The main focus of this work is on nature-inspired algorithms like authors proposed in particle swarm optimization (PSO) [54] and gray wolf optimizer (GWO) [34]. The proposed solution is based on multi-objective optimization which has multiple constraints. We used the clustering approach to implementing the proposed techniques. The literature indicated that a cluster-based approach is more feasible for the IoV network because it has multi-objective optimization [55].

6.1.1 Dragonfly-based clustering algorithm

Dragonfly algorithm is one of the well-known metaheuristic or nature-inspired algorithms with unique swarming behavior for the hunt, food search and local movement. Static swarming is used as hunt, and dynamic swarming is for food search. This algorithm uses dynamic weights during its working process where different weights are used for each step for a diverse solution. Dragonfly has small predators for hunting small marine insects or small fishes [56]. Dragonfly has different behavior for food searching and deals with enemies in their life like in nymph and adult stage [57]. This dynamic behavior is taking into account to design a technique for smart mobility solutions in smart cities.

Dynamic topologies, high mobility of nodes and unpredictable networks lead to instability, overhead and disconnection issues in IoV. In cluster-based solutions, the network is divided into clusters where each cluster has a cluster head (CH) to handle the frequent broadcasting overhead in IoV. Other nodes are cluster members (CM) in every cluster. All CM is forwarding the data toward its CH, and then, CH forwards the data to other CH in the network. For the formation of CH and CM, a proper method is needed for selection and election. The proposed DCMIoV solution is an adopted dragonfly algorithm through which the packet is traversed.

We adopted dragonfly behavior where they initiate their flight, then explore the region and search for food and then target that food to terminate their operation. This behavior is taking into account to design the DCMIoV techniques as shown in Fig. 2.

Fig. 2
figure 2

Dragonfly social behavior to design the DCMIoV

In the first stage, DCMIoV initializes the searching process like all dragonflies (nodes) have no food and no enemy in their surroundings. By using this phenomenon, each dragonfly (node) explores search space and calculates the neighbor flies (nodes), food (CH). After this calculation, the dragonflies selected the food (CH) and started the routing process. Complete detail of the processing phase is discussed in next subsections.

6.1.1.1 Processing phase

The first stage is the initialization of network construction such as a number of vehicle nodes and vehicle node velocity through GPS systems. The initialization phase is just like the cohesion phase adopted by dragonflies where they start flights and inform others about their plan of action. After network initialization, the next step is setting node directions toward the destination to avoid any loop in the network. This phase is an inspiration from dragonfly’s behavior where they align their flight with other dragonflies. After this phase, the next step is clustering or grouping by collecting the traffic density information. This phase is the same as where dragonflies separate their positions and form a group. The BS plays a significant role to update the traffic density information and share the entire network field with all nodes in the network. Equation 1 shows the dissection process where BS dissected the network into A square partition.

$$ A = {\text{Nodes}}_{\text{TD}} *C_{\text{RP}} $$
(1)

where A indicates the number of square-shaped partition, \( {\text{Nodes}}_{\text{TD}} \) denotes the node traffic density and \( C_{\text{RP}} \) is the required cluster percentage. After this processing, the protocol segments the nodes into geographically based clusters. After this process, the BS evaluates the center point of each partition it broadcasted the information among nodes for every partition. The BS assigns a unique ID to all clusters until all networks are divided into clusters. The next step of the proposed DCMIoV technique where CM is joining the CH is the same as when dragonflies see the food and attracted to the food. We adopted an easy target strategy where dragonflies reach to food easily without any enemy distraction. For this, we select the low overhead node as a CH by calculating the load information and weight. Three main parameters are taking into account including distance, direction and signal strength of nodes. Equation 2 presents the CH attraction (food attraction) to select the one CH for every cluster.

$$ {\text{CH}}_{S} = \alpha *d + \beta *{\text{SS}} + \gamma *D $$
(2)

In the above equation, there are three weighted factors denoted with \( \alpha , \beta , \,{\text{and}}\, \gamma \) which shows the distance, signal strength and direction, respectively. The set value for the weighted factor is 1. After this calculation, the CH is found for every cluster and responsible to collect the data from CM and forward to other CH in the network.

After CH selection, there is a need to check the fitness of clustering by using the multi-objective technique to evaluate the dragonfly tour by the normalization of the objective function. Equation 3 is used to calculate the heuristic value and objective function.

$$ {\text{FE}}_{\gamma } = w1*f1 + w2*f2 $$
(3)

The w1 and w2 denoted the equal weight for fitness functions. In DCMIoV, \( f1 \,{\text{is}}\, \Delta \,{\text{difference}} \) and \( f2 \) denotes the sum of CM from CH. The fitness function is calculated as in Eqs. 4 and 5.

$$ f1\left( {\Delta {\text{difference}}} \right) = \mathop \sum \limits_{i = 1}^{\left| t \right|} {\text{ABS}}\left( {D - |{\text{CM}}_{i} |} \right) $$
(4)
$$ f2\left( {\text{Dist}} - {\text{sum}} \right) = \mathop \sum \limits_{i = 1}^{\left| t \right|} \left( {\mathop \sum \limits_{j = 1}^{{\left| {{\text{CM}}_{i} } \right|}} {\text{ED}}\left( {{\text{CH}}_{i} ,{\text{CM}}_{i,j} } \right)} \right) $$
(5)

In the above equations, the ABC is a function for absolute value and D is the destination and CM is cluster member. The \( \Delta \) difference should be 0 which is an optimal value.

Figure 3 shows the flowchart of DCMIoV, and Algorithm 1 presents the flow process of DCMIoV. As shown in Fig. 3, the first is initializing the input and starting the dragonfly cohesion and alignment phases. In cohesion phase, the nodes update the node position and velocity by using GPS systems which are already installed in nodes. In alignment phase, nodes set their direction toward the destination. After these updates, the next step is cluster formation where one node selected as CH and other nodes join the cluster as CM. The CH selection is based on weighted score by calculating the distance, direction and signal strength of nodes. After this step, the next step is dragonfly normalization phase where CM joins the CH and periodically starts the data communication.

figure a
Fig. 3
figure 3

Flowchart of DCMIoV

6.2 Proposed solution for smart living

The concept of smart homes has gained popularity due to its various application including smart appliance control, home management, electric management and smart grids. Electricity is one of the core resources for smart appliances for home-based and industrial solutions. Reliable electricity management is needed for high-quality systems to fulfill the user’s requirements. Inefficient and unnecessary use of electric energy leads to various issues related to economic and domestic issues. In this section, we proposed an energy-efficient solution based on nature-inspired moth flame behavior to address the energy optimization problem in smart cities for smart living. The proposed model is moth flame electric management (MFEM) model. The proposed MFEM model provides user controlling functions and offers energy management. In smart homes, the appliances are connected with the smart sensor and access points and the Internet enables home area networks and further connected with wide and metropolitan area networks. Different types of new and advanced cellular networks, Wi-fi, Wi-Max and 4G and 5G standards make these networks more feasible for data communication.

To test the proposed MFEM model, we applied different consumer scenarios including one home for 15 days and fifteen homes for 1 day. The proposed model reduces energy costs and offers a more efficient energy management solution. The smart grid system is used to implement the proposed model with a length of operational time and appliance power ratings. It is observed that the home power rating is different from each other due to their sizes and requirements; for example, small-size homes run a one-ton air conditioner and utilize around 12,000 BTU. First of all, we divided the 24 day hours into 48 time intervals where every time internal checks the appliance demand whether appliances need to on or off states. By using this strategy, the user utilizes fewer energy rates hours in and easy energy management initiates during peak and off-peak hours. We assumed that homes are equipped with solar systems. Figure 4 shows the social behavior of the moth flame to design the proposed MFEM solution for smart living.

Fig. 4
figure 4

Moth flame social behavior

6.2.1 Moth flame-based energy management solution

Moth flame is a nature-inspired algorithm based on a unique navigation method. Moth flame is a butterfly-like insect that transverses orientation during flying in the moonlight. During the flight of moth flame in a spiral, they maintain a constant angle toward the moon and ultimately use the direction of light. The spiral articulates the searching area and exploits the best solution. Moth flame is one of the population-based algorithms where the movement of moths in n dimensions is explained in Eq. 6.

$$ A = \left[ {\begin{array}{*{20}c} {a1,1} & \ldots & {a1,n} \\ \ldots & \ldots & \ldots \\ {am,1} & \ldots & {am,n} \\ \end{array} } \right] $$
(6)

In the above equation, the m denotes the number of moths that are stored in an array. The objective evaluates every moth fitness value. Every moth position vector is a matrix first row and calculated for the fitness function. Its output is allocated to its respective moth. After this calculation, Eq. 7 uses for corresponding flames as follows:

$$ B_{f} = \left[ {\begin{array}{*{20}c} {b1,1} & \ldots & {b1,n} \\ \ldots & \ldots & \ldots \\ {bm,1} & \ldots & {bm,n} \\ \end{array} } \right] $$
(7)

For efficient scheduling of the home appliances, the moths act as searching agents where the flames indicated the best position. For every repetition, a moth searches for best flame and analyzes by comparing it with the previous round. It is assumed that moth is always on hyper-ellipse space for sure exploration and exploitation of search space. Figure 5 shows the flowchart of MFEM, and Algorithm 2 presents the flow process of MFEM. The first step is initializing the input for randomly generate the population. In the initializing phase, the genetic algorithm parameters, moth flame parameters, population size and number of iterations are calculated. After this phase, the next step evaluates the node direction and randomly generates the initial population of moths and initial population. If the random generation has maximum value, then end the process; otherwise, check the fitness function and set the position of individual moth.

figure b
Fig. 5
figure 5

Flowchart and algorithm of MFEM

6.3 Proposed solution for security provision

Security is one of the significant concerns in smart city networks, where various types of internal and external attacks have encountered to disturb data communication. Different types of solutions have been designed and proposed to detect malicious activities. Intrusion detection system (IDS) is one of the well-known solutions and tools to detect the intrusion attacks in the network. These IDS are divided into two main categories including signature-based IDS and anomaly-based IDS. The signature-based IDS is usually used to detect the intrusion attacks in terms of signatures of discovered vulnerabilities. On the other hand, the anomaly IDS deals with statistical analysis attacks by using intrusion patterns and knowledge. Due to the large data size, the number of features is difficult to examine. Feature selection is commonly used in machine learning to simplifying the data set by reducing its dimensionality. In this section, we proposed an ant colony-based intrusion detection system (ACIDS) based on ant colony concept for feature extractions.

Ant colony optimization is a more efficient technique and a popular inspired algorithm due to its metaheuristic approach. Ant colony algorithm is inspired by the social behavior of ant colonies where the ants find the shortest route toward the food by using pheromone (chemical material) during movement [58]. The proposed ACIDS solution is used for feature selection to search the minimal subset every time. The selected feature subset is adopted as heuristic information. The data set is utilized from KDD Cup 99 data set which has further categorized into three groups including basic features, traffic and content features. Figure 6 shows the ant colony social behavior to design the security solution for smart cities.

Fig. 6
figure 6

Ant colony social behavior

6.3.1 Ant colony optimizer algorithm for security provision

Ant colony optimizer is a system based on cooperation and adaptation ant behavior. The basic idea behind ACIDS is using several constructive computational ants by using previous experiments stored in ant dynamic memory structure. Every ant is guided to the constructed solution and observation about the shortest paths to food. In the first step, the ACIDS searches the minimum cost path in a graph like an ant travel in a graph where minimum features and number of nodes satisfy the traversal stopping criteria. On the basis of this reformulation, the transition rules and pheromone update rules of standard ant colony algorithm. The next step is heuristic information collection where value is the attractiveness of features and the basic ingredient of ant colony algorithm. The heuristic information of traversal and node pheromone levels is merged to make the probabilistic transition rule which presented the probability that ant b includes features y in its subset at step e as shown in Eq. 8.

$$ A_{c}^{b} \left( e \right) = \left\{ {\begin{array}{*{20}l} {\frac{{\left[ {{\text{sub}}1 \left( e \right)^{\alpha } } \right] \cdot \left[ {{\text{sub}}2} \right]^{\beta } }}{{\mathop \sum \nolimits_{u \in jk} \left[ {{\text{sub}}1\left( e \right)^{\alpha } } \right] \cdot \left[ {{\text{sub}}2u} \right]^{\beta } }}, } \hfill & { {\text{cfc}} \in J^{b} } \hfill \\ {0,} \hfill & {\text{otherwise}} \hfill \\ \end{array} } \right. $$
(8)

In the above equation, the \( J^{k} \) is a set of features which b ant added in its data set sub1 and sub2. The pheromone values and heuristic information are related to features c. The \( \alpha \) and \( \beta \) are two parameters for analyzing the relative weight of pheromone value and heuristic information. The first sub1 has the history of successful moves, and sub2 has desirability of the move. Balance value is used to base on \( \alpha \) and \( \beta \) parameters where \( \alpha = 0 \) means no pheromone is utilized and \( \beta = 0 \) means the attractiveness or potential benefits of moves are neglected. After this, the next move is a pheromone update for suitability. After completion of the ant process, the pheromone evaporation on all nodes is triggered. Figure 7 shows the flowchart and algorithm of ACIDS. In the first step, the algorithm extracted the features and selected genetic ants. After these, the next step is initialization where all the required parameters are set. After this, the next step is pheromone setting and ant evaluation. If the evaluate ant is selected, then it returns the best subset; otherwise, again select new feature.

figure c
Fig. 7
figure 7

Flowchart and algorithm of ACIDS

7 Experimental results

To evaluate the nature-inspired solutions for smart cities, we use different scenarios and simulation parameters. We adopted MATLAB to test the performance of the proposed solution. Table 2 presents the simulation parameters and values. For the first solution for smart mobility, we implement the scenario in MATLAB and used a freeway mobility model with bidirectional node mobility.

Table 2 Simulation parameters

7.1 Performance parameters

The following performance parameters are adopted to evaluate the proposed solutions in simulation to check the improvement.

  1. A.

    Performance parameters for DCMIoV The first parameter is cluster formation time in which we evaluate the required time to connect nodes with clusters and form the cluster and less time is more preferable. The second parameter is CH operation time and its presence and performance. These two parameters show the performance of DCMIoV compared to GWOCNET [34].

  2. B.

    Performance parameters for MFEM The first parameter is the average waiting time of appliance scheduling for energy consumption in smart grids. The second and more attractive parameter is cost reduction in user electric bill. These two performance parameters are evaluated with normal electric rates to check the proposed solution cost-effective performance.

  3. C.

    Performance parameters for ACIDS The first performance parameter is true positive rate where the number of normal records which is incorrectly detected and divided into the normal record. This parameter is used to detect incorrect classification in the process and false positive rate.

7.2 Results of DCMIoV

In the first experiment, the cluster formation time is evaluated in the presence of a different number of nodes in the network. Cluster formation time is one of the main criteria in every cluster-based solution, especially for IoV networks. Minimum cluster formation time is considering a better technique for data communication. Figure 8 shows the comparative analysis of proposed DCMIoV with GWOCNET. We test this performance by using a different number of nodes in simulation with the time that how the network takes time to form a cluster in the network. The high number of nodes needs processing and time to form the clusters. In this experiment, the DCMIoV performs better in the presence of 55–80 nodes in the network and utilizes less average time compared to the GWOCNET solution.

Fig. 8
figure 8

Cluster formation time

In the second experiment (Fig. 9), we analyze the CH election time analysis in the presence of a different number of nodes in the network. After cluster formation, the next step is CH election and sustainability in the network. However, there are many rounds where the CH is reelected in every cluster especially when the nodes are mobile like in IoV networks. This experiment shows the proposed solution DCMIoV with GWOCNET. The proposed solution takes less time for the CH election and selection in the network. The graph also indicated that when the number of the nodes reached 80, the performance of DCMIoV is still greater than GWOCNET.

Fig. 9
figure 9

CH election time

7.3 Results of MFEM

To evaluate the performance of proposed MFEM solution for smart living in smart cities, we set the 15-day data of 15 homes. We test the hourly energy load, energy cost for schedule and unscheduled scenarios for 1 day to 15 days. We used the real-time pricing values for our simulation which is ranging from 10 to 60 US$, and we set the peak hours from 6:00 PM to 11:00 PM. We assumed the normal electric rates and compared the rates with proposed solution. The normal rate of one-unit electric is 1 US$. It is observed that there is great improvement in energy management as compared to normal energy rates. Figures 10 and 11 show the energy utilization in terms of its cost daywise and for 30 days.

Fig. 10
figure 10

1-day energy scheduling

Fig. 11
figure 11

30-day energy scheduling

7.4 Results of ACIDS

For evaluate the performance of ACIDS, we used well-known data set KDD Cup 99. This data set is one of the benchmarks especially for IDS evaluation. This data set contained around millions of record where every record has an around forty-one labeled features. For the first results, we only utilized 8% of data set for training. We consider the security attacks like DoS, Probing and U2R. The three features categories are used including basic, traffic and content features. In the first experiment, the false positive rate is analyzed where a number of normal records are incorrectly detected. This experiment presents the percentage of intrusions systems. For the simulation setting, we set the parameter values where each feature is equal to 1. The data set contains the around 45,350 instances in which the 15,000 are normal and 30,350 are related to three DoS, Probing and U2R attacks. Out of 41 features, we select only 14 features including normal = 5, Dos = 3, U2R = 3 and Probing = 3. Figure 12 shows the true positive rate of ACIDS and effect of sleeted features for three attack classes in each step. The maximum difference between positive rate and false positive rate shows the proposed solution performance.

Fig. 12
figure 12

True positive rate for each step

In the second experiment (Fig. 13), the results show the false positive rate of proposed ACIDS solution. We test the detection arte in two scenarios where the first scenario is with normal IDS open-source system and in the second with the proposed IDS to detect the features. The comparison table shows the positive performance of the proposed solution compared to normal without ant colony optimization results. ACIDS can detect more attacks compared to normal IDS.

Fig. 13
figure 13

True false rate for each step

Table 3 shows the clear comparison of both scenarios where proposed solution achieved better results compared to normal IDS systems to detect the attacks and normal instances.

Table 3 Result comparison

7.5 Discussion

After a detail results, we observed that nature-inspired solutions performance is better and achieves optimal score. We conducted three setups for three proposed solutions where in the first setup we evaluated the performance of DCMIoV in the presence of different nodes and time. The results indicated that this solution outperforms and consumes less time to select a CH. This solution is more feasible for IoV environment because it takes less time as compared to other existing solution. In the second experiment, the proposed solution MFEM is tested by using data of smart living. The real-time pricing values are adopted for simulation input and test energy management. The results indicated that this solution outperforms and optimal option for smart living domain as compared to existing approaches. We assumed the normal electric rates and compared the rates with proposed solution. In last experiment, the ACID is evaluated in terms of true and false positive rates. A well-known data set is adopted which designed for IDS evaluation. Different types of attacks are encountered to check the proposed solution performance. The results indicated the false positive rate and true positive rate of ACIDS and the effect of selected features on three attack classes in each step. The maximum difference between positive rate and false positive rate shows the better performance of the proposed solution. The three proposed solutions are best option for smart cities.

8 Conclusion

Smart city concepts have changed the traditional urbanization into smart and economical systems to improve the citizen lifestyle and good governess. The advancement of new technologies has changed the all processes into more smart communication systems. Due to various system and integration of number of new standards and systems, the smart cities have suffered with various open challenge-related technologies, node mobility, system controlling and management, scalability and security concerns. The different types of solutions have been implemented to deal and improve the existing systems and make them more feasible for smart cities. One of the inspiring solutions is nature-inspired optimization where the nature and social behavior of living things have adopted to design new solutions. Therefore, we designed three solutions for smart cities which are dragon clustering mobility in IoV (DCMIoV), smart living moth flame electric management (MFEM) and ant colony-based intrusion detection system (ACIDS) for smart cities. These solutions are based on dragonfly, moth flame and ant colony optimization techniques. Node mobility is one of the complex challenges where high mobility of nodes is facing frequent disconnection, packet dropping, interference and delay issues. As inspired by nature, DCMIoV handles the multi-objective optimization problem and provides the prediction for the future. Electricity is another core resource in smart cities, where electricity management is needed for high-quality systems to fulfill the user’s requirements. Inefficient and unnecessary use of electric energy leads to various issues related to economic and domestic issues. To address this issue, the MFEM provides user controlling functions and offers energy management. With these improvements, security is also needed in smart city networks, where various types of internal and external attacks have encountered to disturb data communication. The anomaly IDS deals with statistical analysis attacks by using intrusion patterns and knowledge. Due to the large data size, the number of features is difficult to examine. Feature selection is commonly used in machine learning to simplifying the data set by reducing its dimensionality. ACIDS provides the concept of feature extractions to search the minimal subset every time. The selected feature subset is adopted as heuristic information. The proposed solutions are evaluated in simulation, and we achieved the better performance in terms of standard performance parameters.

In future, we design more solutions for other smart city areas and expand our simulation setup with more data set, test bed environment and real environment. In addition, we also identify more challenges related to health, smart grids and other areas and try to solve by using other nature-inspired solutions for better data communication, optimization, security and privacy of users.