## 3 The Proposed Algorithm  
The new algorithm is presented in Algorithm 1 where, without loss of generality, an array representation with conventional indexed access is assumed for the members (individuals) of a population. At each generation, we examine the individuals in the population one by one, in sequence, conditionally replacing each with a newly created individual. A new individual is created from the current individual by using the best individual, the worst individual, and two random numbers--each chosen uniformly randomly in (0, 1]--per problem parameter (variable). The generation of the new individual \(x^{\text{new}}\), given the current individual \(x^{\text{current}}\), is described by the following equation (\(x^{\text{new}}\), \(x^{\text{current}}\), \(x^{\text{best}}\) and \(x^{\text{worst}}\) are each a \(d\)-component vector):  
\[x_{i}^{\text{new}}=x_{i}^{\text{current}}+r_{t,i,1}(x_{i}^{\text{best}}-|x_{i} ^{\text{current}}|)-r_{t,i,2}(x_{i}^{\text{worst}}-|x_{i}^{\text{current}}|)\]  
where \(x_{i}\), \(i=1\) to \(d\), represent the \(d\) parameters (variables) to be optimized, \(r_{t,i,1}\) and \(r_{t,j,2}\) are each a random number in (0.0, 1.0), \(t\) indicates the iteration (generation) number, \(x^{\text{best}}\) and \(x^{\text{worst}}\) represent, respectively, the best and the worst individual in the population at the time of the creation of \(x^{\text{new}}\) from \(x^{\text{current}}\). When \(x_{i}^{\text{new}}\) falls outside its problem-specified lower or upper bound, it is clamped at the appropriate bound. In the original Jaya algorithm, the new individual replaces the current individual only if it (the former) is better than the latter. The present algorithm, however, accepts the new individual if it is at least as good as (that is, has a fitness value that is equal or better--either smaller (for minimization) or larger (for maximization)--than that of) the current individual. The original Jaya updates the population-best and the population-worst individuals once every generation. Algorithm 1, however, checks to see if \(x^{\text{best}}\) needs to be updated, and performs the update if needed, after every single replacement of the existing individual. A similar approach is adopted for updating \(x^{\text{worst}}\), but in this case, an update is needed only for the case when the existing (current) individual is the worst one; this is because a replacement is guaranteed never to cause the objective (cost) function to be worse. ```
1 initialize the population;
2 find the best and the worst individuals in the population, and initialize bestIndex to the index of the best individual and worstIndex to the index of the worst individual;
3 while a pre-determined stopping condition is not satisfieddo
4 set the parameters (the \(r\)'s), independently of one another, to random values between 0.0 and 1.0;
5 foreach individual in the population starting from the first indexdo
6 create a new individual using the current individual, the individual at bestIndex, the individual at worstIndex, and the random parameters;
7 ifthe new individual is at least as good as the current individualthen
8 replace the current individual with the new individual;
9 ifthe current individual is better than the individual at bestIndexthen
10 update bestIndex to set it to the current index;
11
12 end if
13 ifthe current individual's index is the same as worstIndexthen
14 find the worst individual in the population and set worstIndex to the index of the worst individual;
15
16 end if
17
18 end for
19
20 end for
```  
**Algorithm 1**Pseudocode of the improved algorithm. The simultaneous presence in the population of more than one best (or worst) individual (clones of the same individual and/or different genotypes with the same phenotype) presents no problem for the new algorithm, because the computation of the best (or worst) is always over the entire population, that is, it is never done incrementally.