## 3 Improvement of the Existing Mechanism and Results  
Figure 18 shows the evolution of the objective function along with the generations. The figure shows the convergence between the best fitness and average fitness values found during the GA iterations. The upper plot (Figure 18a) displays the best score value (black dots) and the mean score (blue dots) versus generation. It showed little progress in lowering the fitness value. The best individual's fitness value remained small throughout the generations. The lower plot (Figure 18b) shows the average distance between individuals at each generation and represents the population's diversity. \begin{table}
\begin{tabular}{c c} \hline
**Fitting Parameter** & **Error** \\ \hline \(a_{0}=7.22\,\times 10^{-8}\) & \(5.91\,\times 10^{-8}\leq a_{0}\leq 8.53\,\times 10^{-8}\) \\ \(a_{1}=1.5\,\times 10^{-5}\) & \(1.3\,\times 10^{-5}\leq a_{1}\leq 1.6\,\times 10^{-5}\) \\ \(a_{2}=1.2\,\times 10^{-3}\) & \(0.001085\leq a_{2}\leq 0.001257\) \\ \(a_{3}=5\,\times 10^{-2}\) & \(0.04915\leq a_{3}\leq 0.05114\) \\ \(a_{4}=1.3\) & \(1.281\leq a_{4}\leq 1.331\) \\ \(a_{5}=10.13\) & \(9.954\leq a_{5}\leq 10.31\) \\ \hline \end{tabular}
\end{table} 
Table 6: Fitting parameters and errors. Figure 17: The desired and fitted trajectories. Table 8 shows the comparison between the optimal solution provided for the GA and the prototype's real dimensions. The GA provided a smaller mechanism through the best values of the seven parameters representing the mechanism's dimensions. The optimized mechanism followed the desired trajectory with a minimal error of 1.62 mm. Furthermore, it shows the distance the slider needs to move to reproduce the desired trajectory, which is generally proposed by the designer. Figure 19 shows the trajectories among the real data, the polynomial form, and the GA. It can be noticed that even though the error was minimal at the end of the trajectory, the mechanism was unable to reach the last point. This is logical considering the configuration of a slider-crank mechanism, derived from the fact that the slider-crank mechanism cannot close the path of the end-effector even when the distance traveled is increased. Figure 20 shows how the error between the trajectories was dramatically reduced when implementing the GA method. Figure 20a shows the error between the real trajectory recorded by the motion capture system and the end-effector's trajectory of the existing  
Figure 19: Results of the genetic algorithm (GA). \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \(\mathbf{F}\) & \(f_{1}\) & \(f_{2}\) & \(f_{3}\) & \(f_{4}\) & \(f_{5}\) & \(f_{6}\) & \(f_{7}\) & \(f_{8}\) & \(f_{9}\) & \(f_{10}\) \\ \hline Prototype & 411.19 & 83.77 & 7.63 & 87.17 & 10 & 90 & 344 & 0 & 0 & 125 \\ GA & 295.11 & 54.29 & 21.11 & 69.88 & \(-\)3.56 & 139.71 & 246.11 & 3.99 & \(-\)6.51 & 9.99 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Comparison between the existing prototype and the new proposal, units in mm. Figure 18: The transition of the fitness function. (**a**) Fitness value plot. (**b**) Average distance plot. prototype (this figure has already been presented at the end of Section 2.2.2). Figure 20b shows the error between the real recorded trajectory and the end-effector's trajectory obtained with the GA method. To validate the quality of the convergence, Figure 21 shows the histogram of the last population. The histogram shows the distribution of the last population in the upper and lower limits of each individual. The frequency represents the number of times that an individual is presented in each limit. The cumulative frequency (expressed in percentage) is the sum of the absolute frequencies and indicates the number of individuals in each interval. Concerning the angle of motion \(\gamma\), a difference of 2.5 degrees was found between the real trajectory and the end-effector's trajectory of the new mechanism (as is shown in Figure 22). Figure 21: The last population histogram. Figure 22: Angles of the amplitude of the trajectories.