## 3 Problem Definition and Solution Model
### Stochastic Solution Model  
Once the problem to be maximized or minimized is formulated, it can be solved using either deterministic or stochastic solution algorithms. Deterministic methods often need extensive gradient information to locate global optimum solutions, which can be challenging for engineering optimization problems that are non-convex or discrete. For this reason, stochastic methods stand out as a widely preferred option for solving these types of problems. It is worth noting that this study does not focus on comparing the efficiency of different optimization algorithms. Various stochastic optimization algorithms such as harmony search [23; 51], genetic algorithm [53; 58], differential evolution [55], and particle swarm optimization [49; 54] are available to handle the GM selection problem. In this study, a solution model based on the stochastic harmony search (HS) algorithm [50] was preferred to solve the GM selection problem. The HS algorithm mimics the natural techniques that musicians employ to discover harmonious sounds while performing. Similar to how jazz improvisations strive for musical harmony, the optimization process aims to determine the best solution. Five algorithm parameters should be first set, namely harmony memory size (_HMS_), harmony memory considering rate (_HMCR_), pitch adjusting rate (_PAR_), distance bandwidth (\(b_{w}\)), and termination criterion. The HS-based solution algorithm for the real GM selection problem involves five main steps. The representative display of each step of the solution algorithm is shown in Figure 8. In the figure, code-based and scenario-related problems are sketched, and spectral shapes can be applied for either horizontal or vertical GM components. At Step 1, the GM catalogue is created for all orientations (X, Y, and Z) or individual combined horizontal spectra (for example, the SRSS or so on) (XY, Z) according to \(M_{w}\), \(R\), and \(V_{s,30}\) to reflect the local soil class. Based on the analysis model (e.g., two- or three-dimensional analysis), target spectral shapes, constraints about the compatibility of spectral shapes including both the mean and/or standard deviations, limits for scaling values, and  
Figure 8: Representative display of the HS-based solution model for GM selection. the required number of GMs in the set are defined. Then, HS algorithm parameters with the termination criterion are established (see Section 4). Note that the GM sets are obtained by selection and scaling from the catalogue defined in Step 1. Thus, the practitioners can create their own catalogue in terms of regional seismic characteristics accounting for local soil class, source mechanisms, type of fault such as near-fault sites, and so on. In Step 2, the **HM** is created multiple times as the HMS using randomly generated decision variables, including GMs and their corresponding scaling values. Each GM set, called a harmony vector, is calculated by Equation (2) and stored in the **HM**. In this step, the worst harmony in the **HM**, which has the highest value of the objective function for minimization problems, is also determined. In Step 3, a new harmony (viz., a new GM set) is generated through a process referred to as improvisation, which is governed by three fundamental principles: _HMCR_, pitch adjusting, and random choosing. _HCMR_ represents the likelihood of utilizing the memory consideration rule, while (1-_HMCR_) signifies the likelihood of employing a random selection rule. These rules are applied for each variable separately and a new harmony is created in this step. For example, if the memory consideration rule is applied, this means that the corresponding variable of the new harmony is selected from the **HM**. If not, then the regarding variable is randomly chosen from the feasible space of the corresponding variable (viz., the random choosing rule is applied). Pitch adjusting is applied to the variable selected from the **HM** considering the probability of _PAR_.