# Parallel Improvements of the Jaya Optimization Algorithm
## 3 Parallel Approaches  
The parallel Java algorithm developed is shown in Figure 1. We will describe how the Jaya algorithm has been implemented in order to identify exploitable inherent sources of parallelism. Algorithm 1 shows the skeleton of the sequential implementation of the Jaya algorithm. The \"Runs\" parameter corresponds to the number of independent executions performed; therefore, in Line 26 of Algorithm 1, the different \"Runs\" solutions should be evaluated. First, for each independent execution, an initial population is computed (Lines 7-19), and, for each population member, VAR design variables can be obtained. It should be noted that the population size is an input parameter of the optimization algorithm, while the number of design variables is an intrinsic characteristic of the function to be optimized. The second input parameter is the number of \"Iterations,\" i.e., the number of new populations created based on the current population. Once a new population is created, each member of the current population is compared with its corresponding member of the new population, and is replaced if it improves the evaluation of the function. A detailed description of this procedure is shown in Algorithm 2. As said, Algorithm 2 shows the main steps of the \"Update Population\" function (Line 21 of Algorithm 1), which is usually executed thousands, or tens of thousands, or hundreds of thousands of times; that is, almost all the computing time is consumed by said function. Figure 1: Flowchart of the parallel Jaya algorithm. ```
1: Define function to minimize
2: Set \(Runs\) parameter
3: Set \(Iterations\) parameter
4: Set \(PopulationSize\) parameter
5:for\(l=1\) to \(Runs\)do
6: Create New Population:
7:for\(i=1\) to \(PopulationSize\)do
8:for\(j=1\) to \(VARS\)do
9: Obtain 2 random numbers
10: Compute the design variable of the new member \(Member_{j}^{i}\) {using Equation (1)}
11:if\(Member_{j}^{i}<MinValue\)then
12:\(Member_{j}^{i}=MinValue\)
13:endif
14:if\(Member_{j}^{i}>MaxValue\)then
15:\(Member_{j}^{i}=MaxValue\)
16:endif
17:endfor
18: Compute and store \(F(Member_{j}^{i})\) {Function evaluation}
19:endfor
20:for\(l=1\) to \(Iterations\)do
21: Update Population
22:endfor
23: Store Solution
24: Delete Population
25:endfor
26: Obtain Best Solution and Statistical Data
```  
**Algorithm 1** Skeleton of the Jaya algorithm  
In Lines 20-24 of Algorithm 2, a new member is computed using the Jaya algorithm, i.e., using Equation (1). It should be noted that this computing uses both the current best and worst solution. In Equation (1), iterators \(j\), \(k\) and \(i\) refer respectively to the design variable of the function, the member of the population, and the current iteration, while \(r_{1,k,i}\) and \(r_{2,k,i}\) are random numbers uniformly distributed. \[x_{j,k,i}^{\prime}=x_{j,k,i}+r_{1,k,i}\left(x_{j,best,i}-\left|x_{j,k,i}\right| \right)-r_{2,k,i}\left(x_{j,worst,i}-\left|x_{j,k,i}\right|\right). \tag{1}\]  
As said, the number of design variables for each member of each population (represented by \"VAR\" in Equation (2)) depends on the function to be optimized. In most of this study, we used the Rosenbrock function, as a test function, shown in Equation (2), where the number of design variables (VAR) is equal to 30. Regarding Algorithm 2, much of the computational cost corresponds to Lines 18-32. It should be noted that, in Line 22, the best and worst solutions are used, so this procedure depends on the \(i\) iteration. In Line 25 of Algorithm 2, the new member is evaluated using, for example, Equation (2), which corresponds to the Rosenbrock function. Naturally, the computational cost of Algorithm 2 can vary significantly depending on the function to be optimized. It should be noted that the total number of function evaluations depends on both the number of population updates (\"Iterations\" parameter) and the population size.