# Optimization of Mass Concrete Construction Using a Twofold Parallel Genetic Algorithm
## 3 Optimization Problem of the Construction Phase of a Massive Concrete Structure Using a GA
### Parallel Genetic Algorithm  
A pseudo-code of the optimization procedure is displayed in the Figure 1. The parallel Genetic Algorithm follows the main strategic principles of a sequential algorithm, however it makes use of a parallelized master-slave model that manages the calculation of the extents of cracking \(E_{Cr}(\mathbf{X})\) by running independent FEM analysis in each cluster node. The GA follows the generational model that replaces the old population by new individuals. However, an insertion criteria was adopted for which the new individuals will replace the old ones only if they are better evaluated. The genetic operators used are the tournament selection scheme, two-point crossover, and simple mutation ([22; 23; 25]).  
The control parameters that should be adjusted for the good performance of the model are: the population size \((N)\) indicating the number of chromosomes for each generation, which is assumed constant during the evolution process; the crossover probability \((P_{c})\), which indicates the number of individuals that are selected as progenitors that participate in the recombination process; the mutation probability \((P_{m})\) that commands the mutation procedure and, in this case, it produces a minor perturbation in the chromosome changing one randomly selected gene; the tournament size for the tournament selection \((N_{t})\), which helps to prevent stagnation, and, finally, the maximum number of generations, which is the algorithm stop criterion \((N_{g})\).  
The individuals of the initial population are generated randomly using a procedure of pseudo-random number generation that starts from a given value called seed. Due to their stochastic nature, the results of a Genetic Algorithm analysis will only be reproduced using the same seed.  
Figure 1: Pseudocode of the Genetic Algorithm (gray background indicates that the steps are parallelized.  
For the parallelized steps (highlighted in Figure 1), the Applicative Programing Interface OpenMP is used for the parallel implementations. Within this programing model, known as fork-join (see Figure 2 based on [26]), the program begins as a simple process that is called the master thread (initial thread). The master thread runs sequentially until the first parallel region is encountered. At this point, the master thread creates a set of parallel threads (team of threads). This process is called \"fork\". Thus, the commands inserted in the parallel region are ran in parallel by the different threads created. When the threads complete the statements in the parallel region, they synchronize and terminate, leaving only the master thread. This process is called \"join\".  
It should be stressed that, as the main computational effort of the GA is the calculation of the extents of cracking \(E_{Cr}(\mathbf{X})\) by the FEM analysis, the FEM code is also a parallelized program which is ran in several processes within each cluster node, thus characterizing the two-level parallel procedure referred to above.