Application of particle swarm optimization and genetic algorithm for optimization of a southern Iranian oilfield

Optimization of the placement and operational conditions of oil wells plays an important role in the development of the oilfields. Several automatic optimization algorithms have been used by different authors in recent years. However, different optimizers give different results depending on the nature of the problem. In the current study, a comparison between the genetic algorithm and particle swarm optimization algorithms was made to optimize the operational conditions of the injection and production wells and also to optimize the location of the injection wells in a southern Iranian oilfield. The current study was carried out with the principal purpose of evaluating and comparing the performance of the two most used optimization algorithms for field development optimization on real-field data. Also, a comparison was made between the results of sequential and simultaneous optimization of the decision variables. Net present value of the project was used as the objective function, and the two algorithms were compared in terms of the profitability incremental added to the project over twelve years. First, the production rate of the producers was optimized, and then water alternating gas injection wells were added to the field at locations determined by engineering judgment. Afterward, the location, injection rate, and water alternating gas ratio of the injectors were optimized sequentially using the two algorithms. Next, the production rate of the producers was optimized again. Finally, a simultaneous optimization was done in two manners to evaluate its effect on the optimization results: simultaneous optimization of the last two steps and simultaneous optimization of all decision variables. Results showed the positive effect of the algorithms on the profitability of the project and superiority of the particle swarm optimization over the genetic algorithm at every stage. Also, simultaneous optimization was beneficial at finiding better results compared to sequential optimization approach. In the end, a sensitivity analysis was made to specify the most influencing decision variable on the project’s profitability.


List of symbols
Annual discount rate c 1 Self-learning coefficient c 2 Social-learning parameter Capex Capital expenditure ($) g best Global best t Total simulation time (years) v Particle velocity x Particle position

Introduction
One of the important steps in field development is the optimal placement of new infill wells and optimal specification of the operational conditions of the existing or new wells. This problem has recently gained more attention with an increase in demand for crude oil as the main source of energy to obtain maximum recovery or profit with a minimum investment. The common way in the industry to determine the location and operational conditions of the wells is based on engineering judgment. This approach depends on the evaluation of different scenarios using a reservoir simulator. However, because of the underground complexities and the large number of possible well configurations, evaluation of all the scenarios is not possible. Thereby, different automatic optimization algorithms have become increasingly popular including stochastic (global) and gradient-based algorithms (Centilmen et al. 1999;Silva et al. 2019). A formulation of the optimization problem was given as travelling salesman problem (TSP) and optimized by simulated annealing (SA) to find the optimum location of wells (Beckner and Song 1995). Bittencourt and Horne (1997) used hybrid genetic algorithm (HGA) in a well placement optimization problem. Their goal was to reduce the number of simulation runs. The HGA consisted of a polytope search (surrogate model) and the genetic algorithm (GA) as the core of the optimization. Santellani et al. (1998) applied an automatic technique to locate vertical injection wells. Their technique comprised a three-dimensional simulator and an external code based on natural selection. Guyaguler and Gumrah 1999) used genetic algorithm to optimize the production rate of the wells. Montes et al. (2001) optimized the location of vertical production and injection wells using the genetic algorithm. Yeten et al. (2003) used genetic algorithm to optimize the type, location and trajectory of complex and unconventional wells. Emerick et al. (2009) applied the genetic algorithm to the optimization of well locations considering non-linear constraints. Derivative-free methodologies, including the genetic algorithm, were used by Echeverría Ciaurri et al. (2010) to solve the problem of oil production optimization. Lu et al. (2019) solved the problem of optimizing the well locations, types, drilling order and control using the genetic algorithm. A two-stage workflow for optimization of the well numbers, injection and production well locations and completion design using GA and a streamline simulator was applied by Tanaka et al. (2020) on the Olympus model. Other researchers have also used GA for well placement and control optimization (Ding et al. 2014;Goldberg 1989;Hansen et al. 1988;Litvak et al. 2011;Nwachukwu et al. 2018;Perrone et al. 2015;van Essen et al. 2009;Zhang et al. 2013).
Onwunalu and Durlofsky (2009) applied particle swarm optimization and a new framework to the development of giant fields with the goal of maximizing the net present value. Their method combined well pattern optimization (WPO) consisted of well pattern description (WPD) followed by well-by-well perturbation by PSO. Wang et al. (2012) introduced a retrospective approach to locate wells under geologic uncertainty using PSO and simplex linear interpolation (SLI) as the core of the optimization process. Afshari et al. (2013) used particle swarm optimization coupled with a streamline simulator to find the optimal location of the wells and compared results with the results of GA and simulated annealing (SA). They concluded that PSO outperforms GA and SA regarding efficiency and accuracy. Ding et al. (2014) optimized the location of production and injection wells using the combination of modified PSO and quality maps, modified PSO, standard PSO and centeredprogressive PSO. Jesmani et al. (2016) applied PSO to a well placement optimization problem considering several practical placement constraints. They used two techniques to handle the constraints including the decoder and penalty techniques. In the penalty technique, they converted the constraint problem to an unconstraint problem by adding a penalty function to the objective function, and in the decoder function, they mapped the feasible areas into the PSO to satisfy the constraints. Bellout et al. (2012) addressed the problem of well placement and control optimization as a joint problem and obtained better results in comparison with separate optimization. Pouladi et al. (2017) employed particle swarm optimization for production well placement optimization in combination with a proxy to facilitate the objective function evaluation. Chen et al. (2017) optimized the location of the wells using cat swarm optimization (CSO) in terms of the net present value. Aliyev and Durlofsky (2017) introduced a multi-level optimization procedure using a combination of PSO and mesh adaptive direct search (MADS) to optimize well location and control. Their procedure was based on a sequence of up-scaled models from fine-grid geological models. A combination of PSO and GA into a hybrid GA-PSO algorithm has been used by Yazdanpanah et al. (2019) coupled with a streamline simulator for optimization of the location of the production and injection wells. PSO was coupled with the fast marching method as a proxy to assist the optimizer in well placement optimization under geological uncertainty (Yousefzadeh et al. 2020(Yousefzadeh et al. , 2021. According to the cited literature, particle swarm optimization and genetic algorithm are two of the most useful stochastic algorithms in field development optimization (Janiga et al. 2018). However, they can reach different results regarding their search algorithms. Although there is not a unique opinion between researchers on which optimizer performs better, according to the most of literature, PSO has shown a better convergence to the solution than GA in well placement optimization problems most of the time (Ding et al. 2014;Mohagheghian et al. 2018). However, they have shown different results and performance on similar cases. Consequently, their performance at finding the optimal solution for well placement and control optimization was evaluated in this study on a southern Iranian oil field. Further, as the decision variables, such as injection rate, production rate, and well locations have mutual impact on each other, sequential and simultaneous optimization of these parameters can give different results. Therefore, a comparison between the results of sequential and simultaneous optimization of the parameters was made in this study as well.
In the current study, particle swarm optimization and genetic algorithm were used to optimize the location and control variables of the wells in a southern Iranian oil field. First, the production rates of the wells were optimized. Next, water alternating gas injection wells were added to the model. The proper number of injection wells was determined by evaluating the NPV values, and the location and water/ gas injection cycle ratio was found by engineering judgment. After this stage, the location of the injection wells was optimized, and following it, the water/gas injection cycle ratio and injection rates were optimized. Following this stage, the production rate of the producers was gone under optimization again using both algorithms. Finally, simultaneous optimization of the decision variables was conducted to see its effect on the optimization results.

Particle swarm optimization
Particle swarm optimization is a stochastic population-based optimization algorithm which was first introduced by Kennedy and Eberhart (1995). This algorithm is inspired by the collective behavior of animals such as fish schooling or bird flocking. PSO begins solving the problem by generating some random solutions in the search space. Each solution is known as a particle, and a group of particles is called a swarm. Each particle has a velocity that moves in the search space and updates its position. The particle's velocity and position are updated using the personal and global best solutions from the previous steps: where v i (t) is the i-th particle's velocity at iteration t , x i (t) is the current position of the i-th particle, r 1 and r 2 are random numbers between 0 and 1. c 1 is the self-learning coefficient, and c 2 is the social-learning coefficient. is the inertia factor which indicates the particle's tendency to keep its current velocity. P best,i (t) and g best (t) are the best solutions experienced by the i-th particle and all of the particles up to iteration t , respectively. After updating the velocity and position of the particles, velocity and position limitations are applied to the particles. Then, the new particles are used to evaluate the objective function and to update P best,i (t) and g best (t) . The steps are repeated until the convergence criterion is met. Figure 1 shows the flowchart of the PSO algorithm.
The parameters used to update the velocity, the population size, and the maximum number of iterations affect the performance of the algorithm and need to be configured prior to using the algorithm: (2) x i (t + 1) = x i (t) + v i (t + 1) where parameters 1 and 2 are both considered equal to 2.05. Accordingly, the value of the parameters , c 1 and c 2 will be 0.7298, 1.49618 and 1.49618, respectively. The same values were used by Poli et al. (2007). Population size is and the maximum number of iterations is set to 20.

Genetic algorithm
The genetic algorithm is an evolutional optimization algorithm that is one of the most used algorithms in field development optimization. The genetic algorithm is inspired by the natural evolution law and is first introduced by Holland (1975). The genetic algorithm starts with a random generation of solutions. Each solution is indicated by a chromosome, and the fitness value of each chromosome is evaluated. The chromosomes with higher fitness values are used for reproduction in the next step, and the remaining are removed. There are two parts in the reproduction step: crossover and mutation. In the crossover stage, two individual chromosomes are used as parents to generate a new individual. The parents are selected based on the probability of selection which is determined using the overall fitness value of the generation and the fitness of the chromosomes that are going to be selected as the parents. The next step after crossover is mutation. Similar to nature, the mutation is utilized to keep diversity among the chromosomes. The mutation changes a random bit in the binary digits from 1 to 0 or vice versa. This can result in significant changes in the chromosomes and consequently in the production rate or location of the wells. After completing the crossover and mutation parts, the new generation is used to calculate the objective function. This procedure (as depicted in Fig. 2) is repeated based on the steps described above which leads to better generations tending to a global optimum if sufficient time and generations are provided. In this study, the maximum number of iterations, population size, crossover percentage and mutation percentage are chosen as 20, 20, 0.9 and 0.1, respectively.

Objective function
Every optimization problem requires an objective function. Various objective functions have been used in field development optimization, such as cumulative oil recovery, recovery factor, net present value, etc. As the net present value provides a more economic evaluation of the project, it is considered as a better objective function. A typical formula for NPV in field development optimization problems is given as follows: where r o , r g,p and r g,i are oil, produced and injected gas prices, r w,p is the produced water handling cost, and r w,i indicates water injection cost; q n o,j , q n lp,j , and q n li,j are production rate for oil, production and injection rates for l (l = w, g) at time step n, respectively. N t represents the number of simulation time steps, and the number of production and injection wells is denoted by N prod and N inj , respectively. Δt n is the simulation time step, t is the total simulation time, and b is the annual discount rate. Capex represents the total capital expenditure (i.e., wells drilling costs, completion costs, etc.) of the project and is calculated regarding Eq. (7) as follows: The economic parameters mentioned above to calculate the NPV are given in Table 1.

Results and discussion
As mentioned earlier, PSO and GA were used to optimize the location and operational conditions of the wells in a southern Iranian oil field in terms of maximizing the net present value of the project over 12 years. This model consisted of 50,520 active cells and 17 existing producers with 16 layers. Most of the inactive cells were below layer 8. As a result, injection wells were completed up to layer 8. Figure 3 shows the transmissibility distribution of the reservoir at the sixth layer in the X-direction. The reservoir had produced for 51 years, and its pressure had declined to 2500 psia near the production wells and to 3400 psia at peripheral regions, where a Fetkovich aquifer existed at the depth of 7453 feet. The economic parameters used to calculate the NPV are listed in Table 1. NPV values are calculated annually.

Stage 1: production rate optimization
At the first stage of the optimization, production rates of the existing producers were optimized. Seventeen producers were present in the field operating at a constant liquid rate (LRAT) with a minimum bottom-hole pressure of 2000 psia. This created the base case for optimization in this study. The base case was run, and its NPV was calculated to be 5.506 billion dollars. The maximum allowable daily oil and water production of the field were set to 100,000 and 200,000 STB. Optimization was conducted considering the oil and water production constraints and limiting the maximum selectable production rate of each well to 17,647 STB. Figure 4 shows the NPV versus the number of function evaluations (NFE) for both optimization algorithms.  Figure 4 shows the significant effect of the production rate optimization on the profitability increase of the project by both of the optimizers. According to this figure, PSO continued searching with a smooth slope compared to GA which shows its ability in getting out of local optima and reaching better results. Figure 5 represents a comparison between the cumulative oil production (COP) of the base case and the optimal cases. It can be seen that both algorithms resulted in higher oil production, but the improvement by PSO was higher than GA. After this stage, the control mode of the producers was changed to constant bottom-hole pressure as it is a common practice when introducing injection wells to the model.

Stage 2: addition of the injectors
After optimization of the production rates, water alternating gas (WAG) injectors were added to the model. At this stage, the best scenario obtained from the last stage was used which was the scenario obtained by the PSO. Different numbers of injection wells (from 3 to 8) were drilled in locations determined by engineering judgment operating at constant reservoir volume (RESV). The wells were drilled simultaneously, and a period of three months was considered for drilling the wells. The maximum allowable injection rate for water and gas was set to 20,000 bbl/day and 1000 bbl/day with a minimum bottom-hole pressure of 6000 psia. Water was injected for 1 year followed by a gas slug for 2 months giving a WAG ratio of 120:1. This ratio was obtained by trial and error. It is worth to mention that because of the high contrast in transmissibility values (very low or very high regions as depicted in Fig. 3), higher rates and higher duration of gas injection violated the convergence in solving the flow equations and urged the selection of a lower rate and duration of gas injection. Figure 6 shows the values of NPV for different number of injection wells.
As can be deduced from Fig. 6, the optimum number of injection wells was found to be four wells with an NPV of 7.28 billion dollars. NPV values for different number of injectors are listed in Table 2. The largest NPV is shown in bold typeface. In the next stage, the location of these four wells is going to be optimized using PSO and GA. Figures 7 and 8 show the COP and the cumulative water injection of the field for different optimal cases, respectively. The green line represents the case with optimized production rates from stage 1. Figures 7 and 8 show that the model with 4 injection wells had the highest oil production in the early times and in total. Also, the case with four injections well had a lower water injection compared to most of the other cases. This resulted in higher NPV values in comparison with other cases.

Stage 3: injection well location optimization
At this stage, the approximate locations of the four injectors from the previous stage were optimized. Because of the high  contrast in transmissibility values throughout the reservoir and its negative impact on gas injection, four feasible regions were determined around the locations obtained from the previous stage to search for the optimal location of the injectors. The feasible regions are illustrated in Fig. 9. Figure 9 shows the location and feasible regions for the injection wells. These regions were determined based on the transmissibility distribution and simulation results. Locating  Fig. 8 Cumulative water injection for different optimal cases-stage 2 Fig. 9 Feasible regions and the approximate optimal location for the injectors-stage 3 the injectors in these regions no longer caused convergence problems in solving the flow equations. More details on these regions can be found in Table 3.
It is worth pointing out that a same initial solution is considered for the algorithms to make the comparison between the algorithms more robust. Figure 10 shows the results of the optimization of the location of the injectors.
Like stage 1, both algorithms significantly increased the amount NPV, but PSO reached better results with a smoother search in comparison with GA. According to the results, PSO has reached an NPV value of 7.5987 billion dollars and GA has reached 7.4875 billion dollars which indicated the better performance of the PSO. The optimal locations of the injectors are reported in Table 4 and are shown in Fig. 11. In this figure, the injectors are indicated by a white ring around them, and a tag above them shows their name. All other wells are producers.
An explanation about the optimal location of the injectors is that in field development, the injectors tend to be drilled in locations with moderate transmissibility, but not locations with very high or low transmissibility. This is because if the injector is drilled in high transmissible locations, there will be an early water breakthrough in the producers that worsens the oil production and decreases the project's profitability.  On the other hand, if the injector is drilled at a location with extremely low transmissibility, there will be many difficulties in injecting the fluid into the reservoir because of the low injectivity of the well (this is also true for producers). Another reason is that due to the distribution of the producers mostly in the middle part of the reservoir (as shown in Fig. 11), the injectors tend to be drilled at positions approximately near the producers (not very close). This can help better sweep the oil toward the producers. Therefore, as the southern part of the reservoir has high transmissibility values and also is far away from the producers, the injectors are not drilled at that part of the reservoir.
To verify the improvement in the project's profitability, the COP of the optimal cases obtained by the two algorithms and the best case before optimization of the well locations are compared in Fig. 12. There was a slight improvement in COP after this stage of optimization. However, the improvement made by PSO was higher as shown in Fig. 12.

Stage 4: WAG ratio and injection rate optimization
After optimizing the location of the injectors, at this stage, the injection rates and WAG ratio of the wells were optimized. The initial guess for both algorithms was the same to have a better comparison between the algorithms. At this stage, the maximum possible water injection rate was set to 25,000 STB/D, and the gas injection rate was calculated based on the ratio of water to gas injection rate which was obtained during the optimization. Further, water was injected for 1 year and the period of gas injection was considered as a ratio of water injection period which was being optimized. Other constraints like maximum daily field oil and water production and control mode of the wells were as the previous stages. The results of this stage are reported in Fig. 13.
As can be seen from Fig. 13, PSO again provides better results compared to GA. It is worth pointing out that, at each stage, the model used for optimization was the best scenario obtained from the previous stage. The optimum WAG ratio was found to be 62:1 (water cycle to gas cycle), which shows the unsuitability of the reservoir for a WAG project. The final values of NPV were 7.6987 and 7.636 billion dollars for PSO and GA, respectively, which indicated a 1.31% and 0.5% increase by them. According to Figs. 14 and 15, the COP was not changed significantly, and it was the decrease in water injection that increased NPV.

Stage 5: production rate optimization (second)
At the fifth stage, the production rates of the producers were optimized again. The constraints were the same as the previous stages. Optimization of the production rates was done again since the optimal rates obtained at the first stage This indicated a 2.71 and 2.61% increase in NPV from stage 3 by the sequential optimization for PSO and GA, respectively, and a 6.56 and 4.56% increase in NPV from stage 3 by the simultaneous optimization for PSO and GA, respectively. These results implied the positive effect of simultaneous optimization of the decision variables and its outperformance over sequential optimization of the production rates, injection rates, and WAG ratio. Figure 20 shows the COP for the best case from the previous stage and the optimum cases obtained at this stage. It can be seen that PSO has reached a higher COP in comparison with GA.
In the end, it is worth presenting the cumulative effect of the optimization on the NPV increase of the project. Table 6 shows the final NPVs obtained by both algorithms using sequential optimization for all stages and simultaneous optimization of stages 4 and 5 as well as the initial base  Fig. 15 Cumulative water injection of the optimal cases-stage 4 might not be optimal after drilling the injectors. The reservoir model used for optimization was the model with the best scenario from the previous stage which had an NPV of 7.6987 billion dollars. Figure 16 shows the NPV versus NFE for both algorithms at this stage. As can be seen from Fig. 16, PSO and GA have reached approximately to similar answers. At this stage, GA has moved with a smoother slope compared to PSO; however, the final NPV values obtained by PSO and GA were 7.8046 and 7.7973 billion dollars, respectively. According to Fig. 17, GA reached higher oil production values during reservoir life. However, the amount of water production was significantly low in the scenario proposed by PSO which considerably reduced the costs and increased the NPV (Fig. 18).

Stage 6: simultaneous optimization of production rate, injection rate and WAG ratio
Simultaneous optimization of production rate, injection rate and WAG ratio of the wells was conducted at this stage to see its effect on the results. The model used for optimization was the model with the best scenario from stage 3 with a net present value of 7.5987 billion dollars. Figure 19 shows the NPV versus NFE for both algorithms for simultaneous optimization.
The final values of NPV provided by the two algorithms were 8.097 and 7.9455 billion dollars by PSO and GA, respectively. As the results suggested, PSO and GA both resulted in NPV increase at every stage, and PSO reached better results compared to GA at every stage. Moreover, NPVs obtained in simultaneous optimization were higher than those obtained by sequential optimization by the end of the production rate optimization (stage 5). These values are listed in Table 5. case's NPV. Values larger than the others are written in bold typeface.
To verify the results of Table 6, the cumulative oil and water production of the initial base case and the final optimum cases obtained by sequential and simultaneous optimization are presented in Figs. 21 and 22. In these figures, SIM stands for simultaneous optimization, and SEQ stands for sequential optimization.
According to Fig. 21, it can be inferred that both optimization approaches have had a significant contribution to the improvement of oil production. In the meantime, using the PSO algorithm with simultaneous optimization of the production and injection rates has come up with the highest COP. Further, cumulative water production of all cases lied within a small range with the PSO-SEQ as the lowest and GA-SEQ as the highest values. This was because why the final NPV of the PSO-SEQ case was slightly higher than the final NPV of the GA-SEQ.

Stage 7: simultaneous optimization of the production rate, injection rate, WAG ratio and injectors' location
To have a further evaluation of the effect of simultaneous optimization of the decision variables, production wells' rate, injection wells' rate, WAG ratio, and the location of the injectors were simultaneously optimized using the two  Fig. 18 Cumulative water production of the optimal cases-stage 5  Fig. 20 COP of the optimal cases-stage 6 optimizers at this stage. It is worth pointing out that including the number of injectors caused too many problems in solving the flow equations. This was because of the extreme contrast in the transmissibility distribution throughout the reservoir as mentioned earlier. Therefore, considering the number of injectors as decision variables asked for letting the injectors move in wider regions that increased the chance of a well to be placed at locations with high or low transmissibility. In this regard, if a well was placed at a location with very high or low transmissibility, it would cause too many problems that prevented the further advance of the simulation and caused critical issues in the optimization process. In this stage, the initial base case with an NPV of 5.506 billion dollars was used for optimization (everything was optimized simultaneously from the beginning). Figure 23 shows the optimization results obtained by the two algorithms. The final NPVs of the base case and the optimal cases obtained by simultaneous optimizations (stage 6 and stage 7) as well as the percentage of improvement with respect to the base case are presented in Table 7. Results showed that the simultaneous optimization of more decision variables increased the final NPV by 3% and 2.4% for the PSO and GA algorithms, respectively. The largest values are shown in bold in Table 7. Once again GA has converged earlier than PSO, but PSO has continued its search with a smoother slope.
The COP of the optimum cases obtained by the two optimizers in stages 6 and 7 was compared with each other as well as the base case in Fig. 24. This figure shows that the optimum case obtained by simultaneous optimization of the production wells' rate, injection wells' rate, WAG ratio and injection well's location using the PSO algorithm had the highest COP. Moreover, although the COP of the optimum case obtained by the GA at stage 7 was lower than the COP of the optimum case obtained by the PSO at stage 6, it  was higher compared with the COP of the optimal solution obtained by the GA at stage 6. In other words, this difference was because of the performance of the optimizers and not because of the approach of optimization. The optimal locations of the injectors obtained by PSO are reported in Table 8 and shown in Fig. 25. In this figure, the injectors are indicated by a white ring around them and a tag above them shows their name. All other wells are producers.
A comparison was made between the optimal well locations of the PSO algorithm obtained by sequential (at stage 3) and simultaneous (at stage 7) in Table 9. Note that, since PSO has reached better results than GA, only the results obtained by PSO are presented in this table.
The comparison between the results of the sequential and simultaneous optimization of the decision variables showed that the optimal locations obtained by simultaneous optimization were quite different from the results obtained by sequential optimization (Figs. 11, 25 and Table 9). Since the decision variables have a mutual influence on each other, different well locations give different optimal production and injection rates. This was shown in the results. A comparison between the optimal production rates, injection rates, and WAG ratio showed that simultaneous optimization achieved different results for these parameters as well. Figures 26 and 27 demonstrate the optimal production and injection rates of the wells for the two optimization approaches. It should be pointed out that only the results obtained by the PSO algorithm are presented in these figures as it provided better results in comparison with GA. It can be seen that the two approaches have given different optimal rates and WAG ratio accordingly. The optimum WAG ratio was calculated to be 66:1 (water cycle to gas cycle).

Fig. 25
The optimal location of the injectors (shown by white rings) obtained by the PSO and the existing producers optimizers to reach better results compared to sequential optimization. In this regard, results showed that simultaneous optimization of the decision parameters gived quite different solutions in comparison with sequential optimization. Moreover, the comparison between the results of the sixth and seventh stage suggested that incorporating more decision variables (well location, production rate, injection rate, etc.) in the course of simultaneous optimization had a high potential to give much better results than the case with fewer variables optimized simultaneously. Also, PSO outperformed GA at every stage. According to the NPV versus NFE figures, despite GA that had a higher speed at first but converges earlier, PSO continued searching with a smoother slope. It should be pointed out that there was a more difference in the final NPVs between the PSO and GA in simultaneous optimization. This could be because the PSO algorithm performed better than GA at dealing with more decision variables. A large number of decision variables result in long chromosomes in GA which requires a higher number of function evaluations to find the same answer as PSO does.

Sensitivity analysis
In this section, a sensitivity analysis was made on the degree of importance of the design parameters, including the production rates, well locations, number of injectors, WAG ratio, and injection rates, on the project's NPV. To do so, while holding all other design parameters, each parameter was altered by some percent and the corresponding change in the NPV relative to the amount of change in the design parameter was measured. Figure 28 shows the results of this sensitivity analysis. According to Fig. 28, production rate had the highest effect of the project's NPV. After that, the location of the injectors was the second most influencing parameter on the NPV, and other remaining parameters did not show significant effect on the project's NPV.

Conclusions
Particle swarm optimization and genetic algorithm were used to optimize a WAG project in a southern Iranian oil field. Production rates, number of injectors, well locations and WAG ratio are the variables that have been optimized in different stages. The results were compared in terms of the net present value of the field. Our study led to conlcude that PSO reached better NPVs compared to GA at every stage mentioned in the context. Also, during optimization, PSO had a smoother slope searching for the optimum solution than GA most of the time, which made the results more reliable since it can be a sign of avoiding the local optima. The optimum value of WAG ratio showed that the reservoir under study was not suitable for WAG injection which was the result of extremely high and low amounts of transmissibility throughout the reservoir. Finally, a comparison between the final results of sequential optimization and the results of simultaneous optimization showed that incorporating more decision variables in simultaneous optimization improved the results by a significant magnitude in comparison with the results of sequential optimization. This indicates the mutual impact of the decision variable on each other. Moreover, the sensitivity analysis suggested that the production rate had the highest influence on the project's profitability; however, this can be case specific which requires investigating it on more reservoir models.
Funding No funding was received for this research.
Availability of data and materials Data are confidential and cannot be shared.
Code availability Codes can be shared if requested.

Conflict of interest
The authors declare that they have no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.