## 2 Intelligence Artificial (AI)-Based Resource Allocation Algorithms in Dynamic Traffic Scenario
### Prediction-Based NFV Reconfiguration Algorithm  
We illustrate a very general NFV reconfiguration algorithm for the case where reconfiguration is necessary due to VNF-FG traffic variations. The sets, parameters and variables are defined in Tables 2 and 3. In this paper we assume that the VNF-FG are linear graphs in which each link is characterized by the same bandwidth value. Because we also assume that \(N\) VNF-FGs are considered and the VNF-FG bandwidth can vary over time then we denote with \(b_{j}(i)\) (\(i=1,\cdots,N;j=1,\cdots\)) the bandwidth of \(i\)-th VNF-FG in \(j\)-th Time Interval (TI). The TI duration is denoted with \(T_{s}\). To introduce the algorithm we introduce the VNFI graph, the nodes of which correspond to the instanced VNFIs while the edges correspond to virtual links interconnecting the VNFIs. It should be noted that the VNFI graph corresponds to a VNF-FG when VNFIs are not shared between VNF-FGs. On the contrary, in the case of VNFI sharing, it provides information on the total set of VNFIs instantiated to support VNF-FGs and their interconnection. Figure 1: Cloud resource allocation for one Virtual Network Function Instance (VNFI) in a Network Function Virtual Infrastructure-Point of Presence (NFVI-PoP) (**a**); resource reconfiguration when a traffic increase occurs (**b**); resources over (**c**) and under (**d**) provisioning when a traffic prediction error is made. The NFV reconfiguration algorithm has the objective to determine an embedding \(\Gamma(\tilde{G},G)\) of the VNFI graph \(G=(V,L)\) into the physical graph \(\tilde{G}=(\tilde{V},\tilde{L})\) by determining: (i) in which NFVI-PoP of any VNFI is executed; (ii) the cloud (processing) resources to be assigned to the VNFIs; (iii) in which network paths any logical link has to be routed. When traffic variations over time occur, cloud and bandwidth reconfigurations are needed to reduce the costs. Some reconfiguration techniques have been proposed. For instance the solution proposed in [8] leverages the following techniques: (i) migration of VNFIs towards lowest cost NFVI-PoPs; (ii) vertical cloud resource scaling by increasing/decreasing the number of cores allocated to the VNFIs. To apply the techniques, embedding changes of the VNFI graph \(G=(V,L)\) into the physical graph \(\tilde{G}=(\tilde{V},\tilde{L})\) are needed and depending on the processing capacities \(f_{v}^{(j)}\) (\(j=1,2,\cdots\)) requested by the nodes \(v\in V\) and the requested bandwidth \(f_{e}^{(j)}\) (\(j=1,2,\cdots\)) by the links \(e\in L\) of the VNFI graph in the \(j\)-th TI (\(j=1,2,\cdots\)). The processing capacity \(f_{v}^{(j)}\) and the link bandwidth \(f_{e}^{(j)}\) are given by the sum of the bandwidths of VNF-FGs that share the node \(v\in V\) and the link \(e\in L\) respectively. Hence the processing capacities and the link bandwidths are depending on the offered VNF-FG bandwidths and for this reason they are not a-priori known. We report a reconfiguration solution based on the prediction of the offered VNF-FG bandwidths. The algorithm can be easily extended to the case in which the values of \(f_{v}^{(j)}\) (\(j=1,2,\cdots\); \(v\in V\)) and \(f_{e}^{(j)}\) (\(j=1,2,\cdots\); \(e\in L\)) are directly predicted. Because it is not possible to determine the traffic exactly, we propose a solution that underestimates or overestimates the traffic according to the values of the resource allocation and QoS degradation costs. The main steps performed by the framework for the cloud and bandwidth resource provisioning are illustrated in Algorithm 1. The inputs are: the physical graph \(\tilde{G}=(\tilde{V},\tilde{L})\), the VNF-FG bandwidths