## 3 Problem Definition and Solution Model  
### Definition of the Problem  
The improved model is capable of selecting GMs for both code-based and scenario-based selection practices and seismic code applications need to define two different functions (at least) for horizontal and vertical directions. These functions are called \(f_{ch}(\mathbf{x})\) and \(f_{cv}(\mathbf{x})\), as given in Equation (2). The scenario-based selection, or if desired the code-based selection, on the other hand, requires definition of four different functions considering the mean and dispersion for horizontal and vertical directions. Therefore, \(f_{dh}(\mathbf{x})\) and \(f_{dv}(\mathbf{x})\) functions are superimposed to consider the dispersion of spectral accelerations in addition  
Figure 6: Typical representation of the alignment of target and mean spectra (**a**) before; (**b**) after iterations of the algorithm. Figure 7: Typical representation of the alignment of target spectra and the standard deviation of In (Sa) of selected records (**a**) before; (**b**) after iterations of the algorithm. to \(f_{ch}(\mathbf{x})\) and \(f_{cv}(\mathbf{x})\) for horizontal and vertical directions, respectively. The GM selection issue essentially involves minimizing the difference in shapes between the target and the chosen GMs. Consequently, it is necessary to develop an objective function and decision variables pertaining to GM selection. Besides the minimization of the gap between the shapes, criteria defined by the codes and/or practitioners need to be incorporated. For this reason, the GM record selection problem is addressed as a constrained optimization problem. Each constraint can be described as \(g_{i}(\mathbf{x})\) and summations of penalties are also added to the objective function, which increases the function, which in fact needs to be minimized. The criteria outlined in Section 2.4 for choosing the GMs are handled as constraints of the problem. Accordingly, the objective function \(F(\mathbf{x})\), intended for minimization to determine the optimal solution, is specified in Equation (2). This function is also viable for determining both GM component pair sets. \[F(\mathbf{x})=f_{ch}(\mathbf{x})+f_{cv}(\mathbf{x})+f_{dh}(\mathbf{x})+f_{dv}(\mathbf{x})+\sum_{i=1 }^{k}g_{i}(\mathbf{x}) \tag{2}\]  
In Equation (2), vector \(\mathbf{x}\) comprises the decision variables, and its size is dictated by the number of GMs in a given record set. For instance, if there are 11 GMs in a record set, the size of \(\mathbf{x}\) would be 22, representing the labels of the 11 GMs along with 11 corresponding scale values. In Equation (2), \(k\) denotes the number of penalty functions under consideration. The function \(f_{ch}(\mathbf{x})\) is defined as the sum of squares of the error (SSE) between the mean horizontal spectrum of selected GMs and the corresponding target horizontal spectrum (Equation (3a)). This function is evaluated over the selected period range \([T_{min},\,T_{max}]\) for \(m\) number of discrete period values:  
\[f_{ch}(\mathbf{x})=\sum_{i=1}^{m}\bigl{(}S_{M,h}(T_{i})-S_{a,h}(T_{i})\bigr{)}^{2} \tag{3a}\] \[f_{cv}(\mathbf{x})=\sum_{i=1}^{m}\bigl{(}S_{M,v}(T_{i})-S_{a,v}(T_{i})\bigr{)}^{2} \tag{3b}\]  
In Equation (3), \(S_{M,h}(T_{i})\) and \(S_{M,v}(T_{i})\) represent the spectral value of the mean horizontal and vertical spectrum at period \(T_{i}\). These values may represent either the average of individual components in the set or the average of individual combined component pairs (for instance, the SRSS, geometric mean, maximum directional, etc.) in GM pair sets. \(S_{a,h}(T_{i})\) and \(S_{a,v}(T_{i})\) represent the spectral values of the target horizontal and vertical spectrum, respectively. The target spectrum can be also described in terms of the UHS or scenario-based CMS spectra. Like \(f_{ch}(\mathbf{x}),f_{cv}(\mathbf{x})\) is defined as the SSE between the average of selected GMs and the corresponding target in the vertical direction (Equation (3b)).