# An Automated Design Method for Plane Trusses Based on User Preference Information
## 4 Cost Function Based on Modified Physical Programming (MPP)
### Treatment of Design Constraints  
Many design constraints, e.g., stress constraints and geometric constraints, need to be considered in the design process of truss structures. Generally, these design constraints are regarded as hard constraints, i.e., they cannot be violated. This study tends to handle the constraints as soft constraints, which means that they can be violated during the optimization process. Meanwhile, the final result needs to satisfy the constraints. This is beneficial to the full exploration of the optimal result.  
The penalty parameter \(r\) of constraint violation (Equation (37)) is set to be associated with the iteration steps. In the early stage of optimization, the penalty for the constraint violation is small, i.e., the value of \(r\) is small. As the optimization progresses, the value of \(r\) gradually increases, which indicates a larger penalty for the constraint violation. At the late stage of optimization, the penalty is sufficiently large to make the final result satisfy the constraints.  
\[r=T^{2}, \tag{37}\]  
where \(T\) = number of the current step of STSA during the iteration.  
For the \(i\)th constraint, the constraint violation \(v_{i}(x)\) is defined as the proportion of the current constraint value exceeding the constraint limit:  
\[v_{i}(x)=\begin{cases}\sum\limits_{k}\max(\frac{val_{k}}{val_{limit}}-1,0)\,\text{if}\ val_{limit}\ \text{is the upper limit value}\\ \sum\limits_{k}\max(1-\frac{val_{k}}{val_{limit}},0)\,\text{if}\ val_{limit}\ \text{is the lower limit value}\,\end{cases} \tag{38}\]  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Objective**} & \multirow{2}{*}{**Type**} & \multicolumn{5}{c}{**Boundary Values**} \\ \cline{3-6}  & & \(\mathbf{D}\leftarrow\) & \(g_{i1}\) & \(\leftarrow\mathbf{T}\rightarrow\) & \(g_{i2}\) & \(\leftarrow\mathbf{U}\rightarrow\) & \(g_{i3}\) & \(\rightarrow\mathbf{UNA}\) \\ \hline \(g_{1}(x)\) & 1-S & & \(-5\) & & 0 & 5 \\ \(g_{2}(x)\) & 1-S & & \(-4\) & & 1 & 6 \\ \(g_{3}(x)\) & 1-S & &where \(val_{k}=\) value of constraint function of the \(k\)th unit, for example, the tensile stress of the \(k\)th member, \(val_{limit}=\) value of constraint limit.  
Thus, the penalty term \(V(x)\) of constraint violation is defined by Equation (39):  
\[V(x)=1+r\sum_{i=1}^{nr}v_{i}(x), \tag{39}\]  
\[\text{min}cost=V(x)G(x)=\left[1+r\sum_{i=1}^{nr}v_{i}(x)\right]\cdot\sum_{j=1} ^{n_{ex}}\alpha_{j}\overline{g}_{j}\big{[}g_{j}(x)\big{]}. \tag{40}\]  
The new cost function (Equation (40)) is obtained by multiplying \(V(x)\) and \(G(x)\), which describes the quality of a new design during the optimization process. It combines the prediction model with the STSA method. On this basis, a new automated design method named STSA-P is established for the plane trusses, which applies user preference information. The design process using STSA-P is shown in Figure 11.  
The combination of the interactive system and the STSA algorithm forms the STSA-P design system. Designing a truss structure with this system, designers or users can preset some design information, such as boundary values, and they need to complete the evaluation using the interactive system. Then, the prediction model of user preference is automatically developed and combined with the cost function. After that, the optimization process starts. Finally, the design result is obtained. if the result fails to meet the user's needs, the designer or user can improve the result by modifying the adjustment coefficient until a satisfactory result is achieved.