## 4 Fast Optimization Method
### Batch Parallel  
As the population size and design variable dimensions increase, new requirements for the computational efficiency of the population arise. Parallel technology is proposed to meet this need and it can be divided into two methods, multi-threading and multi-process, as shown in Figure 3. Multi-threading parallel refers to task switching between different cores, reducing input-output latency, with a certain speed-up effect for I/O-intensive tasks, but with no significant increase in speed. Multi-process parallel is a technique that uses multiple independent processes to perform tasks in parallel. It achieves fast task processing by dividing large tasks into smaller tasks and executing these smaller tasks on multiple processes. As a result, we employed a multi-process technique to run our algorithm.  
Figure 2: Generation of a well spacing map. (**a**) The position relationship between the well and the grid where the well is located (**b**) Quantization of the distance of the target well from the surrounding well 1, (**c**) Well position after re-location. (**c**) Quantization of the distance of the target well from the surrounding well 2, (**d**) Quantization of the distance of the target well from the surrounding well 3, (**e**) Quantization of the distance of the target well from the surrounding wells.  
Precisely, the multi-process technique can (1) speed up task processing: multi-process parallel takes full advantage of multi-core processors, greatly improving task processing speed. (2) Improve system resource utilization: multi-process parallel can fully utilize system resources and avoid system efficiency degradation caused by excessive resource utilization by a single process. (3) Enhance program stability: multi-process parallel uses independent processes to execute tasks, so a process failure will not affect other processes, thus improving the stability of the program. The speed of task processing by multi-process parallel can be represented by the Amdahl, as shown in Equation (15), where \(T(n)\) represents the time when \(n\) processes are used to process a task, \(T(1)\) represents the time when a single process is used to process a task, and \(p\) represents the proportion of tasks that cannot be processed in parallel.  
\[T(n)=T(1)/(1-p+p/n) \tag{15}\]  
This paper proposes a multi-batch parallel technique using the \"spawn\" method, which is a sort of multi-process technique. This method divides each generation of population individuals into multiple batches, each containing multiple samples. When calculating the fitness value, multiple samples in each batch simultaneously enter the numerical simulator for calculation and they do not interfere with each other. The calculation speed is determined by the number of batches instead of the number of individuals in the population. The reason for using batches instead of the whole population is that the population size is huge, while the number of actual computer CPUs is relatively small. If all individuals within the population are computed at once, it may cause memory stack overflow and error, ending the calculation. The fewer the number of parallel batches, the faster the calculation results of the population, but it is necessary to pay attention to the number of individuals in each batch to ensure it does not exceed the number of CPU cores.