# Large-Scale Truss-Sizing Optimization with Enhanced Hybrid HS Algorithm
## 2 Basic Formulations of HS and JAYA Algorithms  
### The HS Algorithm  
The classical HS formulation includes the following steps.  
1. \(N_{POP}\) solutions are stored in the Harmony Memory [HM] matrix: each row corresponds to a candidate design while columns store the values of variables. Designs are sorted by increasing structural weights (feasible designs) or penalized weights (infeasible designs). The limit number of iterations \(N_{itermax}\) is specified by the user. The harmony memory considering rate (_HMCR_), pitch adjustment rate (_PAR_), and bandwidth amplitude (_bw_) parameters may be specified by the user or adaptively changed in the search process. \[[\text{HM}]=\left[\begin{array}{ccccc}x_{1}^{1}&x_{2}^{1}&\dots&x_{\text{ NDV-1}}^{1}&x_{\text{NDV}}^{1}\\ x_{1}^{2}&x_{2}^{2}&\dots&x_{\text{NDV-1}}^{2}&x_{\text{NDV}}^{2}\\ \dots&\dots&\dots&\dots&\dots\\ x_{1}^{\text{NPOP}-1}&x_{2}^{\text{NPOP}-1}&\dots&x_{\text{NDV-1}}^{\text{NPOP} -1}&x_{\text{NDV}}^{\text{NPOP}-1}\\ x_{1}^{\text{NPOP}}&x_{2}^{\text{NPOP}}&\dots&x_{\text{NDV}}^{\text{NPOP} -1}&x_{\text{NDV}}^{\text{NPOP}}\\ \end{array}\right]\] (1)
2. A trial design (called \"harmony\") is generated using three rules: (i) random selection; (ii) harmony memory consideration; (iii) design vector adjustment. In random selection, each variable is randomly chosen from [_HM_]. The harmony memory considering rate HMCR ranges between 0 and 1, and expresses the probabilities of selecting a value \(x_{i}{}^{\prime}\) from the available set (\(x_{i}^{1}\), \(x_{i}^{2}\),..., \(x_{i}^{\text{NPOP}-1}\), \(x_{i}^{\text{NPOP}}\)) stored in the [_HM_]. The trial design \(\mathbf{X^{\prime}}=\{x_{i}{}^{\prime},x_{i}{}^{\prime},\ldots,x_{N}^{\prime}\}\) is kept or modified based on the pitch adjustment rate parameter \(PAR\), which states the probability (\(1-PAR\)) of keeping the set values \(x_{i}{}^{\prime}\).
3. A random number (\(rnd\)) is generated for each design variable. If \(rnd<HMCR\), HS takes a value from the corresponding column of [HM] and checks if it has to be pitch adjusted. If \(rnd<PAR\), the variable is modified as (\(x_{i}{}^{\prime}\pm rnd\cdot bw\)) where \(bw\) is an arbitrary distance bandwidth. Conversely, if \(rnd>HMCR\), a new value is randomly generated for the design variable.
4. If the new harmony \(\mathbf{X^{\prime}}\) is better than the worst design \(\mathbf{X_{\text{worst}}}\), it is included in [HM] replacing \(\mathbf{X_{\text{worst}}}\).
5. Steps (1) through (4) are repeated until a pre-specified number of iterations or function evaluations (i.e., structural analyses) are executed. The computational cost of the optimization process hence is \(N_{\text{POP}}\times N_{\text{itermax}}\) analyses, which may not be affordable for large-scale problems.  
The convergence behavior of HS may be improved by adapting internal parameters \(HMCR\), \(PAR\) and \(bw\) or generating trial designs that always lie in descent directions. The latter improves the HS ability to find global optima or nearly global optimum solutions (see, for example, [53]). However, performing too many line searches may complicate the original formulation of HS by a large extent.