# An Intelligent Approach to Allocating Resources within an Agent-Based Cloud Computing Platform
## 4 Intelligent Model for Allocating Resources
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Processing**} & \multicolumn{3}{c}{**Memory**} \\ \hline  & \(\mathbf{vcpu_{max}}\) & \(\mathbf{vcpu_{min}}\) & \(\mathbf{vcpu_{used}}\) & \(\mathbf{M_{max}}\) & \(\mathbf{M_{min}}\) & \(\mathbf{M_{used}}\) & \(\mathbf{M_{assigned}}\) \\ \hline VM\({}_{1}\) & & & & & & \\ VM\({}_{2}\) & & & & & & \\ VM\({}_{m}\) & & & & & & \\ \(PR^{e_{1}}\) & & & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of information on physical servers. Figure 4: Diagram of the collaborative agents shown in Figure 2 communicating to reach a solution S(P) to the request carried out by the service k.  
resources than those demanded by the service, the GMA determines that the physical node is not part of the global assignment process (see message \(rq_{3,5}\) of unavailable resources sent from the GMA in PR\({}_{3}\) to the SSA, Figure 4). If there is no physical machine that could respond to the increased service needs, a new physical server is requested to start up in order to instantiate a VM according to the minimum characteristics defined in the service level. When the machine has enough computational resources (cases PR\({}_{1}\) and PR\({}_{2}\) in), the GMA initiates the process based on the definition of the concept of the following case: \(C=\{P,\ S(P),\ E\}\) where:  
* \(P\) represents the description of the problem, with a matrix-matched representation directly related to the instantiation of resource use, \(I_{PR_{i}}^{t}\), along with the description of the service level that is instantiated and the temporary indicator (_timestamp_) that identifies the instant in which the problem has been detected, where \(VM_{t}^{k}\) is the description of the minimum resources, in terms of memory \(M\) and \(vcpu\), that are needed by the service. \[P=\left(I_{PR_{i}}^{t},VM_{t}^{k},timestamp\right)\] (1)
* S(P) represents the solution to the \(P\): \(S(P)\) = (\(M\), \(vcpu\)) in terms of \(vcpu\) and memory. * Finally, \(E\) represents the efficiency which is measured from two perspectives: micro and macro. \(\bigcirc\)  
Firstly, the efficiency at the micro level (\(E_{m}\)) is associated with the level of the efficiency of the solution proposed within the physical server where the VM has been deployed. The LMA proposes this level of efficiency according to the processor usage rates and the allocated memory. \[E_{m}=\left(\frac{\overline{p_{vcpu}}M_{used}}{M_{assigned}}\right)\text{,} \tag{2}\]  
where \(M_{used}\) and \(M_{assigned}\) are the used and total allocated memory, respectively. \(\bigcirc\)  
The efficiency at the macro level (\(E_{M}\)) is associated with the degree of efficiency from the point of view of the service and is calculated if the proposed solution requires the process of infrastructural resource distribution to be initiated at a macro level. In this sense, the degree of efficiency measures the number of additional nodes \(n\) required by the service. \[E_{M}=n \tag{3}\]  
Therefore, the efficiency is given by the following expression \(E\) = (\(E_{m}\), \(E_{M}\))  
The CBR (_Case-Based Reasoning_) starts by retrieving similar cases from the case memory. The most similar cases are selected as explained below, and the formal algorithm is given in Algorithm 1:  
1. Select the cases with similar characteristics to the physical machines and a degree of efficiency greater than 90%. The similar physical machines are evaluated according to the _benchmark_ parameter, which characterizes each physical machine. 2. On the basis of this subset of retrieved cases, a vector \(C_{i}\) is configured for each case that contains the same number of VMs that are in the case, and the free resources available \(Ci\) = (\(n\), \(M\), \(vcpu\)). 3. The cases selected from this subset are those that had previously used the same service, and for a similar period of time. This is determined by analyzing a network usage pattern over a period of one week.