## 4 Objectives and Parameters of the Optimization
Therefore, in the FaSHM, the magnets are subjected to a greater demagnetizing effect compared to the FaSynRM. Trial runs of the optimization routine with a constraint of \(H_{0}\) = 2 kOe showed an unacceptable reduction in efficiency and an increase in the maximum current of the armature winding. For this reason, a constraint of \(H_{0}\) = 2.5 kOe was adopted for the FaSHM, which is somewhat larger than for the FaSynRM. Also, in contrast to [14], when optimizing both machines, losses in the coasting mode (see Figure 1) with the motor turned off are considered. Even when the motor is turned off, the losses induced by permanent magnets in the magnetic core are not equal to zero, which is significant due to the long duration of this section of the working cycle. Hence, the objective function of the FaSHM takes the following form:  
\[ \begin{array}{c}F=\ln(<P_{loss}>)+0.7\ln(\max(I_{arm\;i}))+0.025\;\ln(\max(TR sym_{i}))+\\ +0.01\;\ln(\max(TR_{i}))+150\;\max(\delta_{\text{demag}}),\end{array}  \tag{3}\]  
where \(<\)\(P_{loss}\)\(>\) is the average total loss calculated in accordance with (2); \(\max(I_{arm})\) is the maximum armature current; \(\max(TRsym)\) is the maximum value of the symmetrized torque ripple; \(\max(TR)\) is the maximum value of the nonsymmetrized torque ripple; \(\max(\delta_{\text{demag}})\) is the maximum ratio of the area of permanent magnets with \(H\)\(>\)\(H_{0}\) to the total area of magnets. The objective function for the FaSynRM is as follows:  
\[ \begin{array}{c}F=\ln(<P_{loss}>)+0.7\;\ln(\max(I_{arm\;i}))+0.1\;\ln(\max( TR_{i}))+\\ 0.1\ln(Mrot)+0.1\;\ln(Mmag)+150\;\max(\delta_{\text{demag}}),\end{array}  \tag{4}\]  
where \(M_{rot}\) is the mass of the rotor, and \(M_{mag}\) is the mass of the permanent magnets. The weight constants 150, 1, 0.7, 0.1, 0.025, and 0.01 in Equations (3) and (4) indicate the significance of specific objectives. These values represent the approximate relative priorities assigned to each optimization goal, drawing from the author's experience in designing comparable machines. A coefficient of 150 at \(\delta_{\text{demag}}\) ensures the selection of designs in which there is no irreversible demagnetization of permanent magnets. The next most important goal (loss \(<\)\(P_{loss}\)\(>\)) has a weight coefficient equal to unity. The constant 0.7 signifies that a 1% decrease in the maximal current holds the same value as a 0.7% reduction in average loss. The objectives of minimizing symmetrized and unsymmetrized torque ripples hold relatively lesser significance. The constants 0.025 and 0.01 indicate that all else being equal, designs with lower torque ripples are favored. Additionally, to enhance clarity, the natural logarithm of Equations (3) and (4) is employed. The fminsearch optimization procedure according to the Nelder-Mead method [33], implemented in the MATLAB software, is described in detail in [34]. The fminsearch (\(F\), \(x0\)optimization procedure is launched to minimize the value of the objective function \(F\) by successively varying the vector \(x\) of electric machine parameters, where \(x0\) is the vector of initial values of the electric machine parameters. The procedure for calculating the objective function \(F\), implemented in MATLAB, includes the steps shown in the flowchart in Figure 5. This flowchart is valid for both FaSHM and FaSynRM. However, for FaSHM, the objective function is calculated according to (3), and for FaSynRM, according to (4). Table 3 shows the list of variable parameters for FaSHM and Table 4 for FaSynRM. After building the geometry of the electric machine corresponding to the current value of the vector \(x\), varied by the fminsearch function, its characteristics are calculated at operating points 0-5 (see Figure 2), necessary to calculate the terms of the objective function.