1 Introduction

In recent years, there has been a significant increase in the number of Internet users due to advancements in hardware and software. This has led to a substantial growth in data traffic, necessitating the management, control, and upgrade of foundational and infrastructure systems to meet the current demands of the Internet. One of the most popular technologies addressing this challenge is software-defined networking (SDN), which transforms traditional networking infrastructure into more adaptable, agile, flexible, and manageable network topologies. SDN is actively employed to solve various network operations issues and has found wide application in real-world networks such as Google B4. It is particularly important in the context of wide area networks (WANs) due to the increasing requirements of cloud computing, Internet of things (IoT), video conferencing, online gaming, traffic growth, and social networks. SDN is utilized for data center virtualization, campus networking, and service provider networks [1, 2]. SDN converts traditional network infrastructures into more adaptive, agile, flexible, and manageable network topologies [2, 3]. The dissociation of control and data planes is one of the key characteristics of SDN. The data plane performs essential functions, such as high-speed packet forwarding. The main responsibility of the control plane is routing and signaling in the network, and loading the results onto the controllers accordingly [4,5,6]. SDN architecture offers numerous advantages, including the simplicity of network management and hardware, enhanced network flexibility, reduced round trip delay, high reliability, optimized network performance, and overall system efficiency [7,8,9]. The basic architecture of SDN networks with multiple controllers and three layers is illustrated in Fig. 1. The infrastructure layer is located in the lower plane, the control layer is in the middle, and the application layer is situated on top [10,11,12]. The infrastructure layer is responsible for the processes of forwarding elements, such as routers, switches, and wireless access points. These devices receive network status information, send it to the controllers, and carry out the task of transporting packets by applying the rules received from the controllers. Controllers are located in the controller layer and are responsible for collecting information from forwarding devices and sending rules to the switches. Some features, such as mobility management, access control, VM migration, adaptive routing, load balancing, multicasting, network virtualization, and security monitoring, are implemented in the application layer [13,14,15].

Fig. 1
figure 1

Software-defined network architecture

In static networks, the number and location of the controllers are determined at the beginning and remain unchanged. However, in dynamic networks, the number of controllers changes rapidly based on network traffic. New controllers must be activated or turned on as the network load increases, while reducing the network load results in the deactivation or turning off of some deployed controllers [16]. Here, it is assumed that the network status is dynamic. Therefore, the number and status of each controller, whether they are on or off, depend on the network traffic. The challenge in SDN is to determine the appropriate number of controllers, their positions, and assigning suitable switches to them. This challenge is referred to as the controller placement problem (CPP) [5, 17, 18]. Solving CPP can provide objectives such as reducing delays, improving energy efficiency, balancing loads, enhancing reliability, and increasing security by finding the optimal number of controllers and assigning appropriate switches to them [7, 19, 20].

There are many optimization algorithms but each of them is suitable for a special problems [21,22,23,24]. While mathematical methods guarantee the attainment of an optimal solution, metaheuristic methods do not [25]. This is because heuristic methods excel at solving large and complex optimization problems, whereas mathematical methods struggle to do so [26, 27]. The assignment of suitable switches to the controllers in SDN is considered an NP-hard problem [28], making mathematical methods time-consuming for this purpose. Therefore, metaheuristic algorithms are suggested for selecting the switches associated with each controller. Consequently, as game theory possesses a mathematical foundation and is recommended as a precise method, this paper employs game theory to determine the appropriate number of controllers. Moreover, a hybrid metaheuristic-based algorithm is proposed to ascertain the optimal mapping between controllers and switches. Since CPP is a discrete problem, discrete algorithms must be utilized [29]. First, GEO [30] and GWO [31] are discretized, and the resulting discrete GEO and GWO algorithms are hybridized, which is called GEWO. Finally, GEWO assigns each switch to the proper controller.

Past studies have explored various approaches in the field of SDN. For instance, [32] employed a combination of hybrid discretized manta-ray foraging optimization and salp swarm algorithm to determine the optimal controller locations, while [33] utilized the Garter Snake optimization algorithm to improve overall latency. In [34], load balancing between controllers was enhanced using the poly-stable matching method. However, the present work takes into account additional metrics and aims to address load imbalance, end-to-end delay, and energy consumption. Further research in this area can be found in the "Related Work" section.

The results reveal that the proposed algorithm is more efficient than other competing algorithms. It decreases load imbalance, end-to-end delay, and energy consumption.

The summary of the significant findings of this paper is as follows:

  • Identifying an appropriate number of controllers by game theory.

  • Discretizing GEO and GWO.

  • Hybridizing the discrete GEO and GWO algorithms.

  • Applying the simulated annealing to the result of the hybrid algorithm.

  • Applying the proposed algorithm to the CPP.

  • Evaluating the proposed controller placement algorithm on four real-world software-defined networks.

  • Comparing the results of the proposed algorithm with the state-of-the-art metaheuristic-based algorithms.

The paper is organized as follows: Sect. 2 provides a review of the related works in this field; Sect. 3 offers a detailed description of the algorithms used in this work, including GEO, GWO, and Game theory. Section 4 is dedicated to explaining the proposed controller placement algorithm in detail to solve the CPP. Section 5 presents the results of the performed evaluations, and finally, Sect. 6 concludes this article.

2 Related work

The problem of providing a dynamic controller was first addressed by [35]. The study proposed a method where the location of controllers can change dynamically based on network traffic fluctuations. The authors formulated the dynamic controller provisioning problem as an integer linear program and introduced two heuristic algorithms to tackle the problem in large-scale scenarios. The results have proven that the utilization of metaheuristic methods is an efficient approach to solving the CPP. This section briefly describes some of the tasks that have employed metaheuristic algorithms to tackle the controlling placement problem (CPP). In [36], Schutz et al. mathematically formulated the controller placement problem (CPP) and employed a heuristic approach to determine the minimum number of controllers required in the SDN topology. They also considered the propagation delay between nodes and controllers, as well as load distribution, to identify the most optimal controller locations. Similarly, [17] presented a controlling placement approach that suggested an efficient and fast heuristic algorithm, MHNSGA, to improve delay between nodes and controllers. The numerical results showed that MHNSGA required less memory and computing time. However, the reliability and energy of the controllers were not considered as variables in this method, too.

The controller placement approach suggested by [1] Firouz et al. was focused on minimizing network propagation delay. The metaheuristic algorithm they used was a hybrid of the manta-ray foraging optimization (MRFO) algorithm and the salp swarm algorithm (SSA), however, had limitations such as increased CPU time usage and the requirement for additional storage space. In a similar vein, in [7], Ateya et al. proposed a metaheuristic algorithm according to the Salp Swarm Optimization Algorithm (SSOA) which dynamically determined the optimal number of controllers as well as the optimal paths between the switches and controllers. Their suggested method was able to improve network latency and reliability in SDN, but it had high computational complexity and did not guarantee accuracy. In [33], Torkamani et al. addressed these drawbacks by improving execution time and enhancing memory consumption. They introduced a new metaheuristic algorithm known as Garter Snake optimization for the Capacitated Controller Placement Problem (GSOCCP) to position controllers in SDN. This method took into account the capacity of controllers and used the 0–1 backpack problem to determine the maximum processing rate of controllers, improved execution time and more efficient memory consumption. They introduced a new metaheuristic algorithm called Garter Snake optimization capacitated controller placement problem (GSOCCP) and used it to position controllers in SDN. This method considered the capacity of the controllers and used the 0–1 backpack problem to determine the maximum processing rate of controllers. Furthermore, Singh et al. developed a novel varna-based optimization algorithm (VBO) in [37] and suggested it as a solution for the SDN controller placement problem. The main goal of the algorithm was to minimize average network latency. Even though the algorithm's convergence rate was reported to be better, the discretizing method and operators were not transparent, and the complexity issue was not discussed.

Authors in [38] first solved the controller placement problem as a multi-objective optimization problem based on some cuckoo species. Their algorithm performed well in finding the global optimum and was better in reliability, fault tolerance, and performance in terms of delay, synchronization overhead, and deployment cost; the algorithm could be used for large-scale WSNs. However, real network topologies were not deployed in the study.

In [41], Yi et al. introduced HeCPP as a multi-objective optimization issue. Its goal was to minimize the network delay, balance the use of heterogeneous controllers, and reduce the control plane error rate. In this regard, they proposed the SQHCP approach which could enhance control layer security and improve QoS; however, real network topologies were not used in the study.

In [40], Sahoo et al. proposed a strategy to solve the CPP using particle swarm optimization and firefly algorithms. They took into account a multi-path connection between switches and controllers to ensure that the entire network did not become unavailable if the primary path between a switch and a controller failed. This approach improved both the survival of control paths and network performance. In their work the authors also considered the optimal number and positions of controllers to maximize network efficiency. While this method minimized average delay in the event of a link failure, it required more computation time compared to other algorithms.

In [45], Fan et al. formulated a metaheuristic multi-objective RALO algorithm for multi-controller placement. RALO tried to improve the reliability and balance of the delay of the main and backup paths. Besides, in [42], Li and Xu proposed a new discrete cuckoo search algorithm to find the optimal locations of the controllers and to improve the average delay, but the network they used for their simulations was not dynamic. In this regard, [46] compared two metaheuristic optimization algorithms, namely non-dominated sorting genetic algorithm II (NSGA-II) and Pareto simulated annealing (PSA). They considered delay and bandwidth in the objective function. The results indicated that both algorithms provide good accuracy, processing time, and less use of computing resources. But the NSGA-II algorithm manifested better convergence properties and better search space exploration.

In [44], the authors used a grey wolf optimization algorithm for CPP, considering the capacity of controllers (CCPGWO). This research aimed to come up with the best controllers' position and plan for failure in the network. The results showed that CCPGWO reduced worst-case delay did not get stuck in the local optimum and had a result close to the global optimum. Furthermore, in [43], Aravind et al. developed a new optimization algorithm using the simulated annealing algorithm, which predicted the controller's failure. It was faster than mixed integer linear programming models and produced an almost optimal solution. The authors in [34] tried to reduce the maximum load imbalance among controllers by deploying a poly-stable matching algorithm. This algorithm selected a subset of switches and assigned them equally to the controllers. The remaining number of switches were assigned to their closest controllers.

As discussed in this section, most of the research has concentrated on using metaheuristic algorithms to solve CPP. In this article, first, the number of controllers is found using game theory due to the accuracy of mathematical algorithms. In the next step, controller placement is carried out using two metaheuristic algorithms, golden eagle and grey wolf. It should be reminded that due to the discrete nature of CPP, two algorithms should be discretized. The methods are discussed in this section and can be found in Table 1.

Table 1 Comparison of proposed methods for controller placement in SDN

3 Background

In this section, the basic concepts used in this paper are described.

3.1 Game theory

Game theory is a method based on mathematics that involves designing a game and determining how players can interact with each other in order to reach a stable state and maximize their benefits. To achieve this, the interaction between independent players is analyzed using various models. The theory is applicable in all fields and serves different purposes, such as defining how players can access shared and limited network resources [47, 48].

Every game has a tuple with three defining elements (N, A, U), where N is the number of players, A denotes actions, and U denotes payoff. Players are entities who are playing and can be either human or any software element. They choose an action while playing the game and the result of the payoff. This result can be either a positive or a negative score. There is U = (\(u_{1}\),\(u_{2} ,\) …,\(u_{n}\)), where \(u_{i}\) is a function that specifies the payoff for each action of the payer. There is \(A = A_{1} \ldots \times A_{n}\), where \(A_{i}\) is a finite set of possible actions. Each vector \(A_{i} = (a_{1}\),…,\(a_{m} )\) represents the actions performed by player i; it should be reminded that what each player does should remain unknown to other players. Strategies can be defined as the players’ specific plans for choosing a particular action among the set of actions and depend on the previous action's payoff. Equilibrium is a relation between the players' strategies. It posits the best choice for each player about the choices made by other players. Each player tries to maximize their payoff while minimizing the payoff of the other players. Nash equilibrium (NE) is a type of equilibrium in which everyone is at their maximum profit [49].

In game theory, strategies can be either pure or mixed. In pure strategy, each player chooses only one strategy, but in mixed strategy, each player can choose a set of strategies considering the probability of each. Equation (1) and Eq. (2) formulate mixed game theory in general, where \(\Delta \left( {S_{i} } \right)_{i \in N}\) means each player can choose a set of strategies, the sum of strategies’ probability is 1 and \(R^{m}\) is the set of probabilities.

$$G = < N,(\Delta \left( {S_{i} } \right)_{i \in N} ,\left( {u_{i} } \right)_{i \in N} >$$
(1)
$${\text{parent}}\;\Delta \left( {S_{i} } \right)_{i \in N} = \left\{ {\begin{array}{*{20}c} {\left( {p_{i1} , \ldots ,p_{{{\text{im}}}} } \right) \in R^{m} :p_{ij} \ge 0} \\ {,\forall j = 1, \ldots ,m} \\ {\mathop \sum \limits_{j = 1}^{m} p_{ij} = 1} \\ \end{array} } \right.$$
(2)

The set of mixed strategies is shown in Eq. (3), where P is the probability of each strategy. It means the game uses the product of the probability of choosing that strategy by the players, Eq. (3).

$$P\left( {s_{1} , \ldots ,s_{n} } \right) = \mathop \prod \limits_{i \in N} p_{i} \left( {s_{i} } \right)$$
(3)

The sum product of the payoff of that strategy for the \(i_{th}\) player is used to calculate the payoff obtained for that player, as shown in Eq. (4), and the combination of mixed strategies \((P_{1}^{*} , \ldots ,P_{n}^{*} )\) is called Nash equilibrium which is shown in Eq. (5) where \(s_{i}\) is the \(i_{{{\text{th}}}}\) strategy and \(p_{i}\) is the probability of choosing that strategy.

$$u_{i} \left( {p_{1} , \ldots ,p_{n} } \right) = \mathop \sum \limits_{{\left( {s_{1} , \ldots ,s_{n} } \right) \in S}} P\left( {s_{1} , \ldots ,s_{n} } \right) \times u_{i} \left( {s_{1} , \ldots ,s_{n} } \right)$$
(4)
$$u_{i} \left( {P^{\prime}_{i} ,P_{ - i} } \right) > u_{i} \left( {P_{i} ,P_{ - i} } \right), \forall P_{i} \in \Delta \left( {s_{j} } \right)$$
(5)

To obtain the Nash equilibrium, the best response functions defined in Eq. (6) must exist in the mixed strategy. Br represents the best answer.

$$Br_{i} \left( {P_{ - i} } \right) = \left\{ {P_{i} \in \Delta \left( {s_{i} } \right):u_{i} \left( {P_{i} ,P_{ - i} } \right) \ge u_{i} \left( {P^{\prime}_{i} ,P_{ - i} } \right) ,\forall P^{\prime}_{i} \in \Delta \left( {s_{i} } \right)} \right\}$$
(6)

3.2 Golden eagle optimization algorithm

GEO is a nature-inspired swarm-based metaheuristic method proposed as a solution to global optimization problems. The method investigates the behavior of golden eagles in adjusting their speed during different stages of hunting. In the initial stages of hunting, they tend to search more for prey (Cruise), while in the final stages, they tend to attack more. A golden eagle adjusts the two stages of searching and hunting to find the best possible prey in the shortest possible time. GEO has the ability to locate the global optimum and effectively avoid the local optimum [30].

Each golden eagle must select a prey in each iteration, and for each golden eagle attack, cruise vectors are calculated based on it. Each golden eagle i chooses a prey of golden eagle f randomly, where f ∈ {1, 2, …, PopSize}. It circles the best location that golden eagle f has seen. Each golden eagle can remember the best solution it has ever found. In GEO, the prey is the best solution ever found by the golden eagle population. The starting point for the attack vector is the golden eagle's current position and the ending point is the location of the prey in the eagle's memory. The attack vector for golden eagle i is calculated through Eq. (7).

$$\vec{A}_{i} = \vec{X}_{f}^{*} - \vec{X}_{i}$$
(7)

where \(\vec{A}_{i}\) is the attack vector of an eagle i, \(\vec{X}_{f}^{*}\) the best position (prey) ever visited by the eagle \(f\), and \(\vec{X}_{i}\) the current position of eagle i. The cruise vector is calculated based on the attack vector. The cruise vector is the tangent vector to the eagle's movement circle and is perpendicular to the attack vector. To find a random vector on the cruise hyperplane, first, a random destination point must be found on this hyperplane, which cannot be the current location of the golden eagle i. Equation (8) indicates the representation of the destination point on the cruise hyperplane where C is the destination point, \(C_{k}\) is the \(k_{{{\text{th}}}}\) element of C, d is the normal vector of a hyperplane in n-dimensional space, \(\vec{A}_{i}\), and k is the index of the fixed variable and \(a_{k}^{t}\) denotes the \(k_{{{\text{th}}}}\) element of the attack vector. The step vector for golden eagle i at iteration t is found as Eq. (9).

$$\vec{C}_{i} = \left( {c_{1} = {\text{random}},c_{2} = {\text{random}}, \ldots ,c_{k} = \frac{{d - \mathop \sum \nolimits_{j,j \ne k} a_{j} }}{{a_{k} }}, \ldots ,c_{n} = {\text{random}}} \right)$$
(8)
$$\Delta x_{i} = \vec{r}_{1} p_{a} \frac{{\vec{A}_{i} }}{{\left\| {\vec{A}_{i} } \right\|}} + \vec{r}_{2} p_{c} \frac{{\vec{C}_{i} }}{{\left\| {\vec{C}_{i} } \right\|}}$$
(9)

where r1 and r2 are random vectors, whose elements are embedded in the interval [0,1], \(p_{a}\) and \(p_{c}\) are the attack coefficient and cruise coefficient, respectively; \(p_{a}\) and \(p_{c}\) are user-defined. GEO uses pa and pc to shift from exploration to exploitation. The algorithm starts with low \(p_{a}\) and high \(p_{c}\). As the iterations proceed, \(p_{a}\) is gradually augmented while \(p_{c}\) is gradually reduced. \(\vec{A}_{i}\) is the Euclidean norm of the attack and \(\vec{C}_{i}\) is a cruise vector. The position of the golden eagles in iteration t + 1 is calculated simply by adding the step vector in iteration t to the positions in iteration t. Equation (10) shows the step vector for the golden eagle.

$$x^{t + 1} = x^{t} + \Delta x_{i}^{t}$$
(10)

In case the golden eagle's new position is a better fit than the position in its memory, the memory is updated with this new position if not, the eagle settles into the new position, but the memory remains unchanged. At the beginning of hunting, golden eagles showed more propensity to cruise and exploration while in the final stages had more propensity to attack and exploit.

3.3 Grey wolf optimization method

The GWO algorithm is a metaheuristic algorithm inspired by the hierarchical structure and behavior of grey wolves during hunting. Grey wolves typically live in groups consisting of 5 to 12 members, with each member having specific duties within the group's hierarchy. Each group comprises three levels of wolves:

  • Alpha wolves: These wolves are the leaders of the group, and other wolves follow them

  • Beta wolves: These wolves assist alpha wolves during decision-making and can be chosen as substitutes for them.

  • Delta wolves: These wolves are subordinate to beta wolves and consist of older wolves, hunters, and wolves responsible for caring for the young.

  • Delta wolves: These wolves are subordinate to beta wolves and consist of older wolves, hunters, and wolves responsible for caring for the young.

3.3.1 GWO consists of three main steps

  1. 1.

    Identifying and tracking the prey

  2. 2.

    Approaching the prey and surrounding it until it stops

  3. 3.

    Attacking

For modeling wolf behavior, the following equations have been introduced.

$$\overrightarrow {D} = \left| {\overrightarrow {C} \cdot \overrightarrow {{X_{p} }} \left( t \right) - \overrightarrow {X} \left( t \right)} \right|$$
(11)
$$\vec{X}\left( {t + 1} \right) = \overrightarrow {{X_{p} }} \left( t \right) - \vec{A}.\vec{D}$$
(12)
$$\vec{A} = 2\vec{a}.\overrightarrow {{r_{1} }} - \vec{a}$$
(13)
$$\vec{C} = 2.\overrightarrow {{r_{2} }}$$
(14)

where t indicates the current iteration, \(\vec{A}\) and \(\vec{C}\) are coefficient vectors, \(\vec{X}\) is the position vector of the prey, and \(\vec{X}\) indicates the position vector of a grey wolf, where components of \(\vec{a}\) are linearly decreased from 2 to 0 throughout iterations and \(r_{1}\), \(r_{2}\) are random vectors in [0, 1]. The parameter \(a\) is decreased from 2 to 0 to emphasize exploration and exploitation, respectively. Candidate solutions tend to diverge from the prey when \(\left| {\overrightarrow {{A_{i} }} } \right| > 1{ }\) and converge toward the prey when \(\left| {\overrightarrow {{A_{i} }} } \right| < 1.{ }\) Finally, the GWO algorithm is terminated by the satisfaction of an end criterion.

In the GWO grey wolf optimizer, alpha is regarded as the most suitable solution; the second and the third appropriate solutions are named beta and delta, respectively. The remaining solutions are considered omega.

The hunt is usually led by the alpha wolf. Beta and Delta wolves may also occasionally participate in hunting. We save the first three best solutions obtained and update other search agents (including Omega) based on these three wolves. For this, we use Eq. (14). In this paper, only the update part of GWO algorithm is used.

$$\overrightarrow {{D_{ \propto } }} = \left| {\overrightarrow {{C_{1} }} . \overrightarrow {{X_{ \propto } }} - \vec{X}} \right|, \overrightarrow {{D_{\beta } }} = \left| {\overrightarrow {{C_{2} }} . \overrightarrow {{X_{\beta } }} - \vec{X}} \right|,\;\overrightarrow {{D_{\delta } }} = \left| {\overrightarrow {{C_{3} }} . \overrightarrow {{X_{\delta } }} - \vec{X}} \right|$$
(15)
$$\overrightarrow {{X_{1} }} = \overrightarrow {{X_{ \propto } }} - \overrightarrow {{A_{1} }} .(\overrightarrow {{D_{ \propto } )}} , \overrightarrow {{X_{2} }} = \overrightarrow {{X_{\beta } }} - \overrightarrow {{A_{2} }} .(\overrightarrow {{D_{\beta } )}} , \overrightarrow {{X_{3} }} = \overrightarrow {{X_{\delta } }} - \overrightarrow {{A_{3} }} .(\overrightarrow {{D_{\delta } )}} ,$$
(16)
$$\vec{X}\left( {t + 1} \right) = \frac{{\overrightarrow {{X_{1} }} + \overrightarrow {{X_{2} }} + \overrightarrow {{X_{3} }} }}{3}$$
(17)

3.4 Problem formulation

The majority of the proposed solutions for CPP have addressed the number of required controllers, their locations, and the mapping of switches to controllers [50]. Considering the end-to-end latency, this work aims to decrease the average load imbalance and the maximum load on the controllers, thereby reducing energy consumption. The assumptions that underlie this work are as follows:

Every switch can only connect to a single controller.

  • A controller can only be located in one of the nodes' coordinates.

  • Two different controllers cannot have the same coordinates.

  • The location of all network switches and controllers and the number of controllers are consistent and pre-defined.

The SDN can be modeled by an undirected graph \(G{ } = \left( {V,{ }E} \right)\) where \(V = { }\left\{ {i,{ }.{ }.{ }.{ }n} \right\}\) is the set of nodes (routers) and \(E\) is the set of edges. The edge \(uv{ }\) corresponds to the bidirectional link between nodes \(u\) and \(v\) and its weight. Some usual metrics in SDN are defined as follows.

3.4.1 End-to-end latency

Let \(S = \left\{ {s_{1} , s_{2} , \ldots , s_{m} } \right\}\) denote the switches in the network and \(C = \left\{ {c_{1} , c_{2} , \ldots ,c_{n} } \right\}\) denote the controllers. The end-to-end latency in this method is the sum of the average inter-controller propagation latency denoted by AvgICL and the average switch-to-controller propagation Latency denoted by AvgSCL.

$$D_{e2e} = {\text{AvgICL}} + {\text{AvgSCL}}$$
(18)

3.4.2 Inter-controller propagation latency

Inter-controller propagation latency is the average latency between any pair of controllers in the network. It is calculated by Eq. (19), where k is the number of controllers to be installed in the network and |p|= k [13].

$${\text{AvgICL}} = \frac{1}{{\left| p \right|.\left( {\left| p \right| - 1} \right)}}\mathop \sum \limits_{{c_{i} ,c_{j} \in p}} d\left( {c_{i} ,c_{j} } \right)$$
(19)

3.4.3 Switch-to-controller propagation latency

The switch-to-controller latency is the time taken to transfer data between the controller and the switch in SDN. The average is calculated by Eq. (20) [13]. The latency of the shortest path from the switch s ∈ S to the controller c ∈ P is denoted with d(s, c).

$${\text{AvgSCL}} = \frac{1}{\left| S \right|}\mathop \sum \limits_{s \in S} \mathop \sum \limits_{c \in P} d\left( {s,c} \right)A_{S,C}$$
(20)

3.4.4 Controller load

The controller load shows the amount of load sent to the controller [18]. It can be calculated by Eq. (21), where \({\text{FL}}_{{{\text{in}}}}\) is the sum of the computation load of new flows arriving from inside of the network, \({\text{FL}}_{{{\text{out}}}}\) is the computation load of the flows arriving from other SDN domains, and \({\text{IR}}\) is the rule installation load. Here, the sum of these three items is used to calculate the load. How to get \({\text{FL}}_{{{\text{in}}}}\), \({\text{FL}}_{{{\text{out}}}}\) and \({\text{IR}}\) is out of the discussion of this paper [51].

$${\text{clLoad}} = {\text{FL}}_{{{\text{in}}}} + {\text{FL}}_{{{\text{out}}}} + {\text{IR}}$$
(21)

3.4.5 Controller load imbalance

If the number of switches mapped to a controller is equal between all the controllers, there will be optimal load balancing in the network. The balanced or unbalanced load of the controller can be determined by the number of elements forwarded to it and is denoted by FE. The assignment matrix is defined as \(n_{p}^{s}\) where s represents the number of nodes that cannot communicate with the controller and p represents the number of FEs assigned to the controller [52].

$${\text{AvgLI}} = \max \left( {\max n_{p}^{s} - \min n_{p}^{s} } \right)$$
(22)

3.4.6 Energy consumption

This article considers the energy consumption in controllers, switches, and communication links to calculate the energy consumption of the network. It is calculated as follows [53]:

$$E = \mathop \sum \limits_{i = 1}^{n} \left( {e_{li} \times E_{{{\text{swi}}}} + e_{2i} \times E_{ci} + e_{3i} \times L} \right) + E_{{{\text{link}}}}$$
(23)

Here, \(E_{{{\text{swi}}}}\) denotes energy consumption of \(i_{{{\text{th}}}}\) switch and \(E_{{{\text{ci}}}}\) represents the energy consumption of the \(i_{{{\text{th}}}}\) controller. Also, L and \(E_{{{\text{link}}}}\) represent the Latency of the network and the total energy consumption of all the active links in the network, respectively. There are, three normalized weight parameters \(e_{li}\), \(e_{2i}\), and \(e_{3i}\) which are derived through simulation run for a given period [54].

4 System description

SDN is a recently developed technology that transforms conventional network infrastructures into more adaptable, agile, flexible, and manageable network topologies. In SDN, the network status is considered dynamic, meaning that the number and state of each controller, whether it is on or off, depend on the network traffic. When the network load increases, it is necessary to add one or more controllers to handle the load and resolve overload problems. Conversely, if the network load decreases, reducing the number of controllers is important to prevent unnecessary expenses. The article assumes a fixed number of existing controllers, with some of them being turned on or off depending on the network load over time. Furthermore, the article identifies the number and placement of nodes and controllers.

The primary objective is to determine the ideal number of controllers and determine which switches should be mapped to each controller. To enhance performance, it is advantageous for switches that communicate frequently with each other to be controlled by the same controller, reducing the need for rule transmission between controllers and minimizing energy and time wastage. Finding the suitable number of controllers, their placements, and assigning the appropriate switches to them has become a critical challenge in SDN, referred to as the controller placement problem (CPP). CPP aims to achieve objectives such as reducing delays, improving energy efficiency, enhancing load balancing, increasing reliability, and ensuring security through the determination of the optimal number of controllers and the allocation of suitable switches to them. This paper aims to address the CPP by evaluating the optimal number of controllers, their placements, and the assignment of different switches to them. The proposed method of this article is based on game theory and metaheuristic algorithms. Game theory provides a mathematical framework for investigating the interactions between related components in interactive decision-making situations, where players' goals and preferences are potentially in conflict [55, 56]. It should be noted that mathematical methods guarantee finding the optimal solution, whereas (meta)heuristic methods do not. On the other hand, heuristic methods can handle large and complex optimization problems, while mathematical methods struggle to solve large optimization problems [28]. Since game theory has a mathematical foundation and is a precise methodology, it is used to determine the number of controllers. However, due to the dynamic nature of the network, the critical path problem (CPP) is defined as an NP-hard problem. Therefore, utilizing game theory for such purposes can be time-consuming. Therefore, metaheuristic algorithms are used to determine the optimal mapping and interaction of switches with controllers. Figure 2 shows overall model framework diagram of this paper.

Fig. 2
figure 2

Overall model framework diagram

4.1 Finding the number of controllers by game theory

To fulfill the QoS requirements, the number of controllers should be considered in relation to the number of network switches. However, this approach is not cost-effective or efficient. Therefore, due to the limitations of using controllers, the number of required controllers should be periodically determined based on network traffic. When the network load increases, one or more new controllers should be added to manage the load and address overload issues. Conversely, if the network load decreases, the number of controllers should be reduced to avoid unnecessary expenses. In this article, it was assumed that the number of existing controllers was fixed and, over time, some of these controllers were turned on or off depending on the network load. Additionally, the number and location of nodes and controllers were identified. The main goal of this phase is to determine the optimal number of controllers using game theory. Game theory analyzes the interaction between independent and self-interested players and explores how they can interact to achieve a stable allocation of shared and limited network resources [47]. In the scenario of selecting the number of controllers in this section, a mixed game is employed. Each controller can act as a player, and the strategies can be active or inactive. Players can select a strategy based on the probability that changes with network conditions. In this article, we propose determining the number of controllers based on system traffic and the load on each controller.

According to the model illustrated in Fig. 3, there are an equal number of players and controllers, specifically from 1 to N. Each player has the choice of adopting either an A (active) or I (inactive) strategy. Player1 has a probability of P to be activated and a probability of 1-p to be inactivated. Similarly, each of the other players has a probability of q to be activated and a probability of 1-q to be inactivated. In our scenario, if cl1 is regarded as player1, any of the remaining controllers will function as player 2.

Fig. 3
figure 3

Game theory model for controller selection

The initial status of controllers is stored in array S. The size of the array is equal to the number of controllers. A value of 0 in array S indicates that a controller is inactive, while a value of 1 indicates that it is active. Initially, all elements of the array are set to 0, assuming that all controllers are inactive.

Each controller tries to choose its strategy between the active and inactive strategies. The probability of selecting the active strategy for each controller is stored in an array called strProb. The size of the strProb array also equals the number of controllers. Initially, the probability of choosing an active strategy for each controller is considered 0.5. Figure 4 shows the initial strProb array. This probability changes over time, depending on network conditions.

Fig. 4
figure 4

The status of the StrProb. a The initial strProb array. b Updated strProb array if \(\beta \le {load}_{cl1}<\alpha\)

The decisions in this phase are based on the load of the controllers. The value of maxload represents the maximum load a controller can handle and is measured using CBench software. CBench is a software module that can be added to the controller for workload calculation in Linux operating systems [57]. If the load value of a controller is close to the max load, it would indicate that it is in a critical state and will soon lose its efficiency. Therefore, it would be beneficial to add more controllers to the network and balance the load. In this scenario, the active probability of other controllers increases. Conversely, if the load on a controller is very low, it would imply that the controller is practically useless and it is better to deactivate it, resulting in a decrease in its active probability. To determine the probability of a controller being either active or inactive, we considered a lower bound called \(\beta\) and an upper bound called \(\alpha\). The value of \(\alpha\) and \(\beta\) is user-defined. The strProb array updates based on Eq. (24) and Eq. (25), where n is the index of other controllers, \(cl_{x}\) is the controller x, \({\text{load}}_{x}\) is the load of the \(cl_{x}\), and \(\gamma\) is added or subtracted to the active probability of a controller. The value of \(\gamma\) is user-defined too. Here, we considered the value of \(\alpha\) as \(\frac{3}{4}\max {\text{Load}}\), \(\beta\) as \(\frac{1}{4}\max {\text{load}}\), and \(\gamma\) as 0.2. Figure 4 illustrates the initial status of strProb array and an example of its updating.

This algorithm continues until reaching an acceptable level of load balancing and a stable state. Here, after determining the values of the strProb array, the roulette wheel is used to choose active controllers. As mentioned before, the strProb array is an active probability value for each controller and the probability of an inactive value is defined by \(1 - {\text{active}}\;{\text{Probibility}}\). If the active strategy is selected by a roulette wheel, for a controller, array S will be set for it and the number of active controllers will increase by one; Otherwise, array S will be updated by 0 for that controller and the number of active controllers will decrease by one. The number of controllers, determined by game theory, is sent as input to the proposed metaheuristic algorithm to assign switches to these controllers.

$${\text{strProb}}\left[ {cl_{x} } \right] = \left\{ {\begin{array}{*{20}l} {{\text{ straProb}}\left[ {cl_{x} } \right] + \gamma ,} \hfill & {\beta \le {\text{load}}_{x} {\text{ < }}\alpha {\text{ }}} \hfill \\ {{\text{straProb}}\left[ {cl_{x} } \right] - \gamma ,} \hfill & {{\text{load}}_{x} < \beta {\text{ }}} \hfill \\ \end{array} } \right.$$
(24)
$${\text{strProb}}\left[ {n - cl_{x} } \right] = \left\{ {\begin{array}{*{20}l} {{\text{straProb}}\left[ {n - x} \right] + \gamma ,} \hfill & {{\text{load}}_{x} > \alpha } \hfill \\ {{\text{straProb}}\left[ {n - x} \right] - \gamma ,} \hfill & {\beta \le {\text{load}}_{x} < \alpha } \hfill \\ {{\text{straProb}}\left[ {n - x} \right] + \gamma ,} \hfill & {{\text{load}}_{x} < \beta } \hfill \\ \end{array} } \right.$$
(25)

4.2 Proposed controller placement solution

As mentioned earlier, the optimal mapping of switches to controllers is one of the most critical challenges in SDN. If done correctly, it can significantly reduce network delay and distribute network load. This paper presents a method for mapping switches to the best controller using GEO and GWO optimization algorithms. However, since CPP is discrete, the algorithms need to be discretized initially. The following section describes the discretization of both GEO and GWO algorithms.

4.2.1 Discrete GEO algorithm

Since the basic GEO algorithm is designed for continuous problems, it must be discretized to be used in a discrete problem like CPP. As shown in Eq. (26), a new position in GEO is determined based on the step vector. The step vector is the sum of the attack vector and the cruise vector, and x represents the present position of the eagle

$$x = x + {\text{stepVector}}$$
(26)

Since the value of x changes based on the step vector, the new position contains continuous values, so it needs to be discretized. In our method, we used genetic operators based on the step vector to discretize the GEO algorithm instead of increasing or decreasing the motion vector from the current location. In the following section, a detailed explanation will be provided on how to calculate a new position for each of the positive and negative states.

4.2.1.1 Negative step vector

When the step vector is negative, the eagle tends to search more, so the operators must have more exploration power and better global search. For this purpose, duplicate and mutation operators are used. In the duplicate method, one part of the solution is copied into another solution. Here, the number of copied cells is 0.4 times the number of controllers. In the mutation method, a sub-part of the answer is changed. First, a random number between 0 and 1 is generated, and the product of the number of controllers and this random number determines the number of mutated cells in this operator [58]. Figure 5 shows an example of duplication and mutation. To choose a proper operation, first, a random number called r is generated. As per Eq. (27), if the value of r is greater than 0.75, the duplicate operator is applied to the best solution. This means that to find new solutions, the values of the best solution are copied over the selected solution. For more exploration, if r is greater than 0.75, the duplicate operator will use one of the existing solutions instead of the best solution. Otherwise, the mutation operator will be used.

$$x_{t + 1} = \left\{ {\begin{array}{*{20}l} {{\text{Duplicate}} x_{{{\text{best}}}} \;\;\;\;\;\;\;\;\;, r \ge 0.75} \hfill \\ {{\text{Duplicate}} x_{j } \;\;\;\;\;\;\;\;\;\;,0.5 \le r < 0.75} \hfill \\ {{\text{Insert}}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; r < 0.5} \hfill \\ \end{array} } \right.$$
(27)
Fig. 5
figure 5

Operations in negative step vector. a Insertion mutation operator. b Duplicating indexes operator

4.2.1.2 Positive step vector

When the step vector is positive, the eagle is more inclined to attack, so the operators provide the possibility of local search. In this case, four operators, namely single-point crossover, uniform crossover, two-point crossover, and swap operator, are used. These operators make relatively few changes in the solutions, which leads to a desire for more local exploration and preparation for the attack in the new solution.

In the single-point crossover, first, two parents and a crossover point are chosen. Then, the information on the left (or right) side of the crossover point is swapped between the two parents to produce two children. In the two-point crossover, two crossover points are selected, and the information between these two points in the two parents is exchanged. The uniform crossover produces a random crossover vector filled with binary values. In this vector, a value of 1 indicates that genes at the specified index are swapped between parents, while a value of 0 indicates that each parent retains its gene at the specified index. In the swap operator, the data of one of the parents is randomly exchanged. Examples of these operators can be seen in Fig. 6.

Fig. 6
figure 6

Operations in GEO discretization for positive step vector. a one-point crossover, b Uniform crossover

When the step vector is positive, a random number, r, is generated. Based on this number, the algorithm decides which operator to use. If r is greater than or equal to 0.75, the single-point crossover operator is used. If r is between 0.5 and 0.75, the uniform crossover operator and if r is between 0.25 and 0.5, the two-point crossover operator is used. Otherwise, the swap operator is used, as shown by Eq. (28).

$$x_{t + 1} = \left\{ {\begin{array}{*{20}l} {{\text{single}} - {\text{point }}\;{\text{crossover}}\;\;\;, r \ge 0.75} \hfill \\ {{\text{uniform}}\; {\text{crossover}}\;\;\;\;\;\;\;\;\;\;,0.5 \le r < 0.75} \hfill \\ {{\text{two}} - {\text{point}}\;{\text{ crossover}}\;\;\;\;\;0.25 < r < 0.5} \hfill \\ {{\text{swap}}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;r < 0.25} \hfill \\ \end{array} } \right.$$
(28)

4.3 Discretization of the grey wolf optimization algorithm

Genetic operators provide us with the opportunity to explore and exploit more, resulting in better outcomes. However, GEWO is a hybrid algorithm, and incorporating these operators into both GEO and GWO algorithms adds unnecessary overhead. Hence, a simpler method is used to discretize GWO. As mentioned earlier, in GWO, three superior wolves, namely alpha, beta, and delta, are employed to update the wolves. In the continuous method, the new location is determined by calculating the average Euclidean distance from the desired wolf to these three wolves. However, this approach yields continuous results and is not effective for discrete problems, necessitating a modification in the updated part of the algorithm. Grey wolf discretization consists of two steps. In the first step, a random number, denoted as “r”, is generated. The new solution is determined based on the alpha wolf if r < 0.25, on the beta wolf if 0.25 < r < 0.5, on the delta wolf if 0.5 < r < 0.75, and otherwise, a random solution is selected for further exploration. Therefore, each solution is produced in discrete mode using the three existing solutions (Alpha, Beta, and Delta), along with a randomly generated new solution.

$${\text{super}}\_{\text{wolf}} = \left\{ {\begin{array}{*{20}l} {{\text{alfawolf}},} \hfill & {r \ge 0.75} \hfill \\ {{\text{betawolf}},} \hfill & {0.5 \le r{\text{ < }}0.75} \hfill \\ {{\text{deltawolf}}} \hfill & {0.25 < r < 0.5} \hfill \\ {{\text{randomsolution}}} \hfill & {{\text{r}} < 0.25} \hfill \\ \end{array} } \right.$$
(29)

The second step describes how to make updates based on the solutions selected from the previous step. First, the value of \(\vec{A}\) and \(\vec{c}\) must be determined. Equation (30) shows how to determine the value of \(\vec{A}\) و \(\vec{c}\).

$$\begin{gathered} \vec{A} = 2\vec{a}.\overrightarrow {{r_{1} }} - \vec{a} \hfill \\ \vec{c} = 2.r_{2} \hfill \\ a = 2 - {\text{cur}}\_{\text{it}} \times \left( \frac{2}{it} \right) \hfill \\ \end{gathered}$$
(30)

where \({\text{cur\_it}}\) is the current iteration, it is the maximum iteration and \(r_{1}\) and \(r_{2}\) are random vectors in the range [0,1]. The value of a decreases linearly from 2 to 0 during iterations. The value of \(\vec{A}\) و \(\vec{c}\) determines the degree of potentiality to explore or attack. In this step, a random value R is also generated. If the value of A is less than R, the desire to explore is greater, and the new location is equal to the value of the superior wolf. Otherwise, the answer will depend on the value of c. If c is less than R, the desire to explore is greater, and the new value will be equal to the value of the superior wolf.

$$D = \left\{ {\begin{array}{*{20}l} {{\text{super}}\_{\text{wolf}}\_{\text{position}}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;R > c} \hfill \\ {{\text{grey}}\_{\text{wolf}}\_{\text{position}}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{\text{otherwise}}} \hfill \\ \end{array} } \right.$$
(31)
$${\text{new\_position}} = \left\{ {\begin{array}{*{20}l} {{\text{super}}\_{\text{wolf}}\_{\text{position}} \;\;\;\;\;\;R > A} \hfill \\ {D\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{\text{otherwise}}} \hfill \\ \end{array} } \right.$$
(32)

4.4 The proposed hybrid controller placement algorithm

We can improve the methods by combining them together [48, 59,60,61]. In the suggested method, the initial population is first generated, and the fitness of the population is calculated based on the introduced fitness function. First, the average fitness values are calculated. In the next step, the population with fitness higher than the average value is used as input for the golden eagle algorithm. The best three answers in this array are selected as alpha, beta, and delta. These three wolves, along with the rest of the population with lower fitness values, are then given as input to the grey wolf algorithm. In this part, only the updated operator of the grey wolf is used, so using this algorithm is not expected to impose significant overhead on the system. The solutions generated from both algorithms are merged, and their fitness values are calculated using the fitness function. If the new solutions are a better fit than the previous solutions in this array, the array will be updated, and the new value will be placed in the array as a potential solution. Otherwise, the array will remain unchanged. At this stage, the average value of the solutions' fitness values is calculated, and once again the solutions with higher fitness are used in the GEO algorithm, while the rest of the population with low fitness is updated using GWO. Finally, the best answer is updated using the SA algorithm to perform a better local search. With SA, solutions around the final solution are explored, resulting in a local search around the optimal solution. Since the SA algorithm is only applied to the best answer, it is expected to add minimal overhead to the algorithm and can be disregarded given its positive impact on the final results. The mentioned process is repeated until the completion of the determined iterations, which are set to 200 in this paper. Figure 7 illustrates the convergence rate of this algorithm, indicating that it optimizes with an accuracy of 1.349784e-31. Figure 8 presents the flowchart of the proposed algorithm.

Fig. 7
figure 7

Qualitative results as convergence curve

Fig. 8
figure 8

Flowchart of the proposed algorithm

4.4.1 Complexity

In this section, the complexity of GEWO will be examined in more detail. The results are very satisfactory, and the execution time is also acceptable, according to the results. In each iteration, the solutions are divided into two distinct groups, and each group is updated with one of the discrete algorithms. Therefore, the overall computational complexity of discovering the optimal location of the controller selection part could not be calculated precisely The complexity of population generation in the proposed algorithm is equal to \(O\left( {{\text{Npop}} \times {\text{Dim}}} \right)\), where \(Npop\) represents the number of the population, and \({\text{Dim}}\) represents the dimensions of the problem. If the proposed algorithm is to be repeated K times, then \(O\left( {K \times \frac{{{\text{Npop}}}}{2} \times {\text{ Dim}}} \right)\) is required to execute the main part of this algorithm, i.e., hybridization of GEO and update part of GWO. On the other hand, the SA algorithm is repeated only on a solution of size M, so the complexity of this algorithm will be \(O\left( {K \times M \times {\text{Dim}}} \right)\)). Similarly, if we have the implementation of operators on half of the population and in 50% of repetitions, then the complexity of the operators of this algorithm will be equal to \(O\left( {\frac{K}{2} \times \frac{{N_{{{\text{pop}}}} }}{2} \times {\text{Dim}}} \right)\). Therefore, the degree of complexity of the suggested algorithm can be expressed in the form of Eq. (33).

$$\begin{aligned} O\left( {{\text{GEWO}}} \right) = & \;O\left( {{\text{Npop }} \times {\text{Dim}}} \right) + O\left( {\frac{K}{2} \times \frac{{{\text{Npop}}}}{2} \times {\text{ Dim}}} \right) + O\left( {K \times \frac{{{\text{Npop}}}}{2} \times {\text{ Dim}}} \right) + O\left( {K \times M \times {\text{Dim}}} \right) \\ = & \;O\left( {{\text{Npop}} \times {\text{Dim}}} \right) + O\left( {K \times {\text{Npop}} \times {\text{Dim}}} \right) + O\left( {K \times M \times {\text{Dim}}} \right) \\ \end{aligned}$$
(33)

In Eq. (33), by neglecting the generation of the initial population which is the same for all metaheuristic algorithms, the complexity of the proposed approach is greatly deduced with \(\frac{{{\text{Npop}}}}{2}{ }\) and \(\frac{K}{2}\). GEWO is only \(O\left( {K \times M \times {\text{Dim}}} \right)\) worse than GEO, and according to the results, this complexity is considered very insignificant.

5 Performance evaluation

This section describes the key features of the results of the experiments that evaluate the efficiency of the proposed algorithm and prove the statements made in the previous sections. These experiments utilize various topologies of different sizes that are present in the Internet Topology Zoo [62]. Table 2 represents the details of the different network topologies used. The maximum number of iterations in the algorithms is set to 50. In this case, 12 controllers are considered as the maximum number, and each controller can be turned on or off based on network traffic. Since game theory suggests adjusting the number of controllers according to changes in network traffic, each network is evaluated with a different number of controllers. Therefore, the performance of each network has been evaluated with 2, 4, 6, and 8 controllers. The number of packets to be transferred is 200. The default values for the algorithm's other parameter values are represented in Table 3. The termination criterion is reaching the maximum number of iterations.

Table 2 Details of different network topologies
Table 3 Simulation parameters

Furthermore, due to the random nature of the optimization of algorithms mentioned above, each algorithm is run 50 times independently, and the results are presented statistically visually. It is worth mentioning that all experiments are carried out in the same environment with specifications expressed in Table 4. The results of GEWO are compared with the results of several newfangled algorithms containing the golden eagle optimization (GEO) [73], grey wolf optimizer (GWO) [56], partial swarm optimization (PSO) [74], and Slap Swarm Algorithm (SSA) [58]. All the algorithms are written in MATLAB and multiple runs are performed on all algorithms. Table 4 shows the characteristic of the test environment.

Table 4 The characteristics of the test environment

First, random traffic is applied to the network and the relation between the switches is determined by the number of packets exchanged between them. In the next step, the switches to the controllers are mapped in a way to make sure that the switches sharing the highest number of connections be under the supervision of a common controller in the same domain. The relation of the switches in two different domains of different controllers is fewer. In this case, no longer there is a need to load the data and the rules of the switches to communicate with each other on different controllers.

In this phase, the GEWO method is compared with four other methods in four real-world networks with different controllers to evaluate its efficiency. The efficiency of the GEWO algorithm is shown through Boxplot diagrams and convergence rate diagrams. A Boxplot diagram demonstrates whether an algorithm works efficiently or not by using variance to determine the number of random states it may have. The convergence diagram displays the convergence rate of each algorithm. The convergence analysis provides a better understanding of the explorative and exploitative behavior of an algorithm. A decreased convergence rate indicates that fewer iterations are required to achieve a satisfactory approximation. This implies that the proposed solution has the potential to deliver superior results in a shorter amount of time compared to other advanced algorithms. Our objective is to determine the optimal number of controllers and efficiently assign switches to them, all while maintaining a low convergence rate. This can contribute to the reduction of load imbalance, latency, and ultimately energy consumption. In cases where there is an imbalance in the load of controllers, some may remain idle and waste energy, while others may become overloaded, resulting in increased energy consumption.

The Boxplot diagrams indicate that the proposed algorithm outperforms the competitor algorithms and has fewer random states. This suggests that GEWO yields highly stable results compared to other algorithms. Moreover, the standard deviations confirm the stability of the solutions obtained by GEWO, as it consistently has the lowest standard deviation. The following section presents the convergence curves for GEWO and the other algorithms. It can be concluded that GEWO exhibits a better convergence rate in all four networks with different numbers of controllers. As observed, the GEWO algorithm performs well right from the start and demonstrates much better convergence than the other algorithms. Figure 7 displays the Boxplots chart, while Fig. 8 shows the convergence rate for the proposed algorithm in the Aconet network, which consists of 33 switches and 48 edges. It is evident that GEWO outperforms the other four algorithms in the ACONET network. The experiments were conducted with four different numbers of controllers: 4, 5, 6, and 8.

Figure 9 presents the Boxplot chart, and Fig. 10 shows the convergence rate for the GEWO algorithm in the Arnes network with 34 switches and 47 edges. Experiments have been conducted with four different numbers of controllers: 4, 5, 6, and 8.

Fig. 9
figure 9

Boxplots of the results on the Aconet network

Fig. 10
figure 10

Convergence rates of the algorithm on the Aconet network

Figure 11 illustrates the Boxplot chart, while Fig. 12 displays the convergence rate for the GEWO algorithm in the Bics network with 46 switches and 85 edges. Experiments have been conducted using 4 different numbers of controllers: 4, 5, 6, and 8.

Fig. 11
figure 11

Boxplots of the results on the Arnes network

Fig. 12
figure 12

Convergence rates of the algorithm on the Arnes network

Figure 13 presents the Boxplots chart, while Fig. 14 displays the convergence rate for the GEWO algorithm in the Colt network, which consists of 149 switches and 191 edges. As shown in Figs. 15 and 16, the experiments were conducted using 4 different numbers of controllers: 4, 5, 6, and 8.

Fig. 13
figure 13

Boxplots of the results on the Bics network

Fig. 14
figure 14

Convergence rates of the algorithms on the Bics network

Fig. 15
figure 15

Boxplots of the results on the Colt network

Fig. 16
figure 16

Convergence rates of the algorithms on Colt network

In this part, GEWO is measured in terms of average degree imbalance, average max controller load, average energy consumption, and end-to-end delay. If the results were shown in each round of execution, there would be many fluctuations, and it would be hard to determine which algorithm is more efficient with a high degree of certainty. Therefore, the results are shown cumulatively. When the results are cumulative, they do not belong to only one round and represent the results from the first round up to the current round. In this case, a smoother result will be obtained, and it will be easy to determine which algorithm would yield better results. Based on the cumulative chart and bar chart shown in Figs. 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, and 32, GEWO gives favorable results. What is more, it should be noted that average degree imbalance and average max controller load are interrelated. Therefore, if the load balance is not good, the load will not be distributed fairly among the controllers, resulting in an increase in the maximum load. Based on the evaluation of the algorithms, the images show that by balancing the load between the controllers and reducing network traffic, there is a decrease in end-to-end delay and energy consumption. This section presents the findings obtained from varying the number of controllers on four well-known software-defined networks: Acone, Rnes, Bics, and Colt from the Internet Topology Zoo. The measurements include average degree imbalance, average max controller load, average energy consumption, and average end-to-end delay. Bar graphs displaying these metrics are shown below for all four networks with various controllers, and the findings are compared with GWO, PSO, SSA, and GEO algorithms. Due to the optimal mapping of switches to controllers, there is no need to continuously load additional information in each controller, resulting in more efficient end-to-end delay compared to other algorithms. Moreover, separate tables present the statistical results for different numbers of controllers. Each cell indicates the improvement percentage of the GEWO algorithm in comparison to other algorithms.

Fig. 17
figure 17

Bar graph of the obtained results by the algorithms on the Aconet network. a Average degree of load imbalance b End-to-end delay. c Average energy consumption. d Average max controller load

Fig. 18
figure 18

Cumulative diagrams of load imbalance obtained by the algorithms on the ACONET

Fig. 19
figure 19

Cumulative diagrams of max controller load obtained by the algorithms on the ACONET

Fig. 20
figure 20

Cumulative diagrams of consumed energy obtained by the algorithms on the ACONET

Fig. 21
figure 21

Bar graph of the results achieved by the algorithms on the Bics network. a Average degree of load imbalance. b End-to-end delay. c Average energy consumption. d Average max controller load

Fig. 22
figure 22

Cumulative diagrams of load imbalance obtained by the algorithms on Bics network

Fig. 23
figure 23

Cumulative diagrams of maximum controller load obtained by the algorithms on Bics network

Fig. 24
figure 24

Cumulative diagrams of Energy consumption obtained by the algorithms on Bics network

Fig. 25
figure 25

Bar graph of the results achieved by the algorithms on the Arnes network. a Average degree of load imbalance. b End-to-end delay. c Average energy consumption. d Average max controller load

Fig. 26
figure 26

Cumulative diagrams of load imbalance obtained by the algorithms on Arnes network

Fig. 27
figure 27

Cumulative diagrams of average maximum controller load obtained by the algorithms on Arnes network

Fig. 28
figure 28

Cumulative diagrams of consumed energy obtained by the algorithms on Arnes network

Fig. 29
figure 29

Bar graph of the results achieved by the algorithms on the Colt network. a Average degree of load imbalance. b End-to-end delay. c Average energy consumption. d Average max controller load

Fig. 30
figure 30

Cumulative diagrams of load imbalance obtained by the algorithms on Colt network

Fig. 31
figure 31

Cumulative diagrams of maximum controller load obtained by the algorithms on Colt network

Fig. 32
figure 32

Cumulative diagrams of consumed energy obtained by the algorithms on Colt network

Figure 17 shows the results of comparing the GEWO algorithm with GWO, PSO, SSA, and GEO algorithms using different controllers in the Aconet network. The results indicate that the proposed algorithm performs more efficiently than the others in terms of load balance, maximum load, energy consumption, and end-to-end delay. Figure 18 compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of load imbalance on the Aconet network with different numbers of controllers (4, 5, 6, and 8 cumulatively). The results show that the GEWO algorithm has less load imbalance on the controllers compared to the other algorithms. Figure 19 compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of maximum controller load on the Aconet network with different numbers of controllers (4, 5, 6, and 8 cumulatively). The results show that the GEWO algorithm has a better maximum controller load on the controllers compared to the other algorithms. Figure 20 indicates a cumulative diagram and compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of consumed energy on the Aconet network. The results show that the GEWO algorithm has less consumed energy on the controllers compared to the other algorithms.

Likewise, the statistical results of the algorithms are presented in Table 5. This table displays the percentage improvement in GEWO compared to other algorithms. As shown, the GEOW algorithm performs better in most cases with different numbers of controllers in the Aconet network. The percentage of improvements in energy consumption are as follows: 10.9429, 12.1633, 11.0042, and 10.6511% for GWO, PSO, SSA, and GEO, respectively. The results demonstrate that GEWO achieves an average of 11.19% better energy consumption compared to the other investigated algorithms. Furthermore, the GEWO algorithm outperforms other algorithms in terms of improving end-to-end delay in the Aconet network, with improvements of 30.84, 24.95, 21.0722, and 19.22% compared to GWO, PSO, SSA, and GEO, respectively. On average, GEWO improves the end-to-end delay in the Aconet network by 24.024%. The results indicate that GEWO effectively controls load imbalance and performs an average of 37.836% better than the reviewed algorithms. Specifically, it performs 40.07% better than GWO, 37.69% better than PSO, 37.23% better than SSA, and 36.33% better than GEO. This algorithm also effectively improves the maximum load of the controllers, with an average improvement of 31.65%. The results clearly demonstrate that determining the number of controllers based on game theory leads to greater optimality in the network.

Table 5 Statistical results of the algorithms obtained on the Aconet network over 50 independent runs

Figure 21 compares GEWO with GWO, PSO, SSA, and GEO algorithms on the Bics network, considering the number of controllers differently. As shown in Fig. 19, GEWO outperforms the other four algorithms in terms of load balance, maximum controller load, energy consumption, and end-to-end delay. Figure 22 compares GEWO, PSO, SSA, GEO, and GWO algorithms in terms of load imbalance in the Bics network. In this section, each comparison was made with different numbers of controllers (4, 5, 6, and 8). The results indicate that the GEWO algorithm creates less load imbalance in the network compared to other algorithms. Figure 23 illustrates the performance and efficiency of GEWO in terms of the maximum load of the controller in the Bics network cumulatively. The results demonstrate that the GEWO algorithm imposes a lower maximum load on the controllers compared to other algorithms. Figure 24 compares the energy consumption of GEWO, PSO, SSA, GEO, and GWO algorithms cumulatively. The findings indicate that the GEWO algorithm consumes less energy than other algorithms.

Likewise, the improvement rate of GEWO compared to other algorithms is given in Table 6. As shown, the GEWO algorithm performs better with a different number of controllers in terms of energy consumption in the Bics network. It performs 9.32% better than GWO, 12.92% better than PSO, 12.37% better than SSA, and 13.08% better than GEO. On average, it performs 11.92% better in energy consumption in the Bics network compared to the other four algorithms. The GEWO algorithm also performs better in terms of end-to-end delay compared to the other investigated algorithms. Specifically, it performs 33.9264, 23.6864, 8.20922, and 12.777 better than GWO, PSO, SSA, and GEO, respectively. On average, GEWO has reduced end-to-end delay in the Bics network by 19.6498%. The results show that GEWO effectively controls load imbalance and performs 18.7545% better than the other four algorithms on average. It is 21.5337% better than GWO, 18.88% better than PSO, 17.73% better than SSA, and 16.86% better than GEO. This algorithm also effectively improves the maximum load of the controllers, achieving an average improvement of 23.64%.

Table 6 Statistical results of the algorithms obtained on the Bics network over 30 independent runs

The operation of GEWO in the Arnes network has been investigated in the following. Figure 25 compares GEWO with GWO, PSO, SSA, and GEO algorithms in this network. The evaluation has been repeated with different numbers of controllers: 4, 5, 6, and 8. As the results indicate, the proposed algorithm performs more efficiently than others in terms of load balance, maximum load, energy consumption, and end-to-end delay. Figure 26 compares GEWO, PSO, SSA, GEO, and GWO algorithms in terms of load imbalance on the Arnes network with different numbers of controllers: 4, 5, 6, and 8 cumulatively. The results show that the GEWO algorithm has less load imbalance than other algorithms. Figure 27 evaluates GEWO in terms of the maximum load imposed on the controllers and compares its performance with PSO, SSA, GEO, and GWO algorithms. The results show that the GEWO algorithm has a better max controller load on the controllers compared to the other algorithms. Figure 28 compares GEWO, PSO, SSA, GEO, and GWO algorithms in terms of consumed energy on the Arnes network, cumulatively. In this network, GEWO performs better than other algorithms in terms of energy consumption.

Table 5 presents the optimal performance of the GEWO algorithm compared to GEO, PSO, SSA, and GWO algorithms statistically. It is observed that in the Arnes network, the GEWO algorithm performs better with varying numbers of controllers. The percentage of improvement in energy consumption are as follows: 12.21% for GWO, 13.5595% for PSO, 13.1705% for SSA, and 12.9295% for GEO. The results demonstrate that the GEWO algorithm in the Arnes network achieves an average improvement of 12.9672% in energy consumption compared to the other investigated algorithms. Additionally, the GEWO algorithm reduces network end-to-end delay by an average of 15.4658% compared to the four other algorithms, namely GWO, PSO, SSA, and GEO. Specifically, it outperforms GWO, PSO, SSA, and GEO by 27.6003, 9.50641, 15.5287, and 9.22782%, respectively. Furthermore, the results indicate that the GEWO algorithm effectively controls load imbalance, performing an average of 21.3454% better than the other algorithms. Specifically, it outperforms GWO, PSO, SSA, and GEO by 24.532, 21.05, 20.27, and 19.51%, respectively. Moreover, Table 7 shows that this algorithm excels in improving the maximum load of the controllers, achieving an average improvement of 21.3454%.

Table 7 Statistical results of the algorithms obtained on the Arnes network over 30 independent runs

Figure 29 presents the results of comparing the GEWO algorithm with GWO, PSO, SSA, and GEO algorithms using different controllers in the Colt network. The results show that the proposed algorithm performs more efficiently than the others in terms of load balance, maximum load, energy consumption, and end-to-end delay. Similarly, Fig. 30 compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of load imbalance on the Colt network with different numbers of controllers (4, 5, 6, and 8) as a cumulative diagram. The results reveal that the GEWO algorithm has less load imbalance on the controllers than the other algorithms. Figure 31 compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of maximum controller load on the Colt network with different numbers of controllers (4, 5, 6, and 8) as a cumulative diagram. The results indicate that the GEWO algorithm has a more efficient maximum controller load on the controllers compared to the other algorithms. Figure 32 indicates a cumulative diagram and compares the GEWO, PSO, SSA, GEO, and GWO algorithms in terms of consumed energy on the Colt network. The results show that the GEWO algorithm consumes less energy on the controllers compared to the other algorithms. Likewise, the statistical results of the algorithms are given in Table 5. This table shows the percentage improvement of GEWO compared to the other algorithms. As shown in the Colt network, the GEWO algorithm performs better in most cases with different numbers of controllers. The percentage of improvements in energy consumption are as follows: 10.0969% for GWO, 10.5076% for PSO, 10.3496% for SSA, and 11.1768% for GEO. The results reveal that the GEWO algorithm in the Colt network performs 10.5327% better in energy consumption on average compared to the other investigated algorithms. Besides, the GEWO algorithm performs better in terms of improving delay compared to the other investigated algorithms in the Colt network. That is, 27.1608, 26.789, 24.6126, and 20.0883% better than GWO, PSO, SSA, and GEO, respectively. On average, GEWO improves the delay in the Arnes network by 24.6627%. The results show that GEWO controls the load imbalance well and performs 18.3514% better on average than the rest of the reviewed algorithms. It is 21.0638% better than GWO, 18.4714% better than PSO, 18.0627% better than SSA, and 15.8077% better than GEO. As shown in Table 8, the proposed algorithm also works well in improving the maximum load of the controllers and improves it by 18.3514% on average.

Table 8 Statistical results of the algorithms obtained on the Colt network over 30 independent runs

As the results indicate, GEWO performs 29.8820% better than GWO, 21.2347% better than PSO, 17.3556% better than SSA, and 15.33043% better than GEO in terms of end-to-end delay improvement. It is also 26.8020, 24.0252, 23.3271, and 22.1329% better than GWO, PSO, SSA, and GEO, respectively, in terms of load imbalance. Furthermore, it outperforms GWO, PSO, SSA, and GEO by 9.3529, 27.15325, 34.3542, and 37.98%, respectively, in terms of performing the maximum load of controllers. Additionally, it performs better than GWO, PSO, SSA, and GEO by 10.64062, 12.195, 11.7367, and 12.1802%, respectively, in terms of energy consumption of controllers.

As discussed in Sect. 2, most research on CPP tends to focus on only one or two parameters. However, this study takes into account end-to-end delay, load balancing, and energy consumption. In terms of end-to-end delay, an improvement of 13.07% was observed in the hybrid MRFO and SSA [1]. The SCPBC [34] advanced it by 15.02%, VCDA [63] by 7.8%, and SQHCP [41] by 15%. Conversely, GWEO substantially improved the delay by 20.95% within the CPP context. In terms of energy consumption, VCDA managed to reduce it by 13.5%, whereas GEWO could only achieve a reduction of 11.65%. As previously stated, the results suggest that GEWO minimizes the load imbalance by up to 24.07%. It can reduce the end-to-end delay by 20.95% and the average energy consumption by 11.65%.

6 Conclusion

The present study aims to explore the controller placement problem (CCP) in software-defined networks (SDN). In the early SDN, there was only one controller in the network, but this caused this single controller to become a bottleneck in the system and if it fails, the entire system will fail, so having several controllers helps to have a reliable system. The ideal situation for the number of controllers is to have as many controllers as there are switches, but since the cost of each controller is high, the optimal number of controllers must be found. The issue of determining the number and placement of controllers is known as the controller placement problem (CPP). The present study aims to explore the CPP in SDN. Initially, game theory is used to predict the optimal number of controllers. Next, a hybrid algorithm called GEWO is introduced, which combines the golden eagle optimization algorithm (GEO) with grey wolf optimization (GWO). This research aims to balance the load of controllers in order to reduce their maximum load and energy consumption. By achieving load balance and reducing network traffic, the end-to-end delay is also reduced. Since GEO and GWO are continuous algorithms while CCP is discrete, they need to be discretized. Genetic operators are employed to discretize the GEO algorithm, which is expected to improve its performance and prevent it from getting stuck in local optima. Subsequently, the suggested algorithm is evaluated on four real-world software-defined networks with zoo topology. GEWO is compared with four metaheuristic algorithms using different numbers of controllers. The findings indicate that the proposed algorithm successfully minimizes load imbalance, reduces the maximum load on controllers, and consequently reduces energy consumption. Moreover, the proposed algorithm exhibits better performance in terms of end-to-end delay compared to other competitor algorithms, offering enhanced convergence rate, exploration, and exploitation. The results reveal that GEWO reduces load imbalance by up to 24.07%, decreases end-to-end delay by 20.95%, and reduces average energy consumption by 11.65%.

Nonetheless, it should be mentioned that more CPU time is required and additional storage space is needed. We aim to enhance this work in the future by reducing CPU time and eliminating the necessity for additional storage space.