# A Trajectory Optimisation-Based Incremental Learning Strategy for Learning from Demonstration
## 5 Discussion
### Trajectory Generation Analysis among Different Algorithms  
The most prominent LfD methods are the GMM-based and DMP-based algorithms. Table 4 discusses the differences among the four algorithms: GMM, TP-GMM, DMP, and Bi-DMP, during the execution of the unscrewing nuts task depicted in Figure 16. In model construction, the GMM-based algorithm requires a larger number of demonstrations, whereas DMP requires only one demonstration. Therefore, in terms of cost, DMP is the more optimal choice. In the task of unscrewing nuts, there are differences in the performance of GMM and TP-GMM compared with DMP and Bi-DMP. GMM can generalise the distribution of demonstrations and then subsequently generate trajectories via Gaussian mixture regression (GMR) to perform tasks. However, since GMM cannot adapt to dynamic environments, it can only perform the demonstrated tasks. It means that it can only handle unscrewing a nut from a fixed position. The TP-GMM gains generalisation capabilities by adding frames of reference (frames). However, due to the sensitivity of the frames' orientation and the inherent uncertainty of the probabilistic model, the success rate of TP-GMM is sub-optimal in high-precision applications. In addition, due to generalisation issues, DMP cannot complete all the tasks of unscrewing nuts. In contrast, DMP enhanced with a BLS can accomplish all the tasks, achieving the highest success rate. Due to differences in programming logic and computer hardware configuration, algorithm running times vary. Overall, GMM-based methods have longer running times than DMP-based methods. This is because the K-means algorithm and the EM algorithm used in GMM computations require multiple iterative operations, especially the EM algorithm. As previously mentioned, GMM and TP-GMM are probabilistic models. Thus, their generated trajectories have uncertainties, with maximum errors and difference fluctuations greater than those of DMP. The difference is the sum of the coordinates of the Euclidean distance between the generated trajectory and the demonstration trajectory for the same target. Particularly for TP-GMM, significant deviations can occur (maximum error and difference will be huge) if the frames are incorrectly specified. Therefore, for the issues discussed in this paper, DMP-based methods are more suitable. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Algorithms** & **Success Rate** & **Running Time** & **Maximum Error (mm)** & **Difference Range (mm)** \\ \hline GMM & 7.14\% & 0.97s & 11.21 & 132.15–180.41 \\ TP-GMM & 14.29\% & 1.36s & 105.34 & 201.96–970.53 \\ DMP & 57.14\% & 0.16s & 2.76 & 128.65–147.88 \\ Bi-DMP & 100\% & 0.67s & 1.48 & 133.74–165.79 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Quantitative comparison of various algorithms. Table 5 shows the differences in trajectory generation between the G-PRM and the classic PRM. As shown in the figures within the table, the blue curve represents the imitated trajectory, the purple dashed line is the trajectory generated by the classic PRM, and the red curve is the trajectory generated by G-PRM. The cyan dots are Gaussian distribution sampling points used to construct the roadmap. The blue dot is the starting point, while the red and purple dots represent the target point and the new target point, respectively. Since the classical PRM lacks imitation capabilities, the generated trajectory is merely a curve connecting the starting point and the new target point, with a similarity to the blue curve of less than 60%. Despite resampling in each iteration, the similarity to the blue curve does not improve. The G-PRM designed in this paper optimises the sampling points to continuously improve the similarity of the generated trajectory (red curve) to the blue trajectory. Its final similarity is 34.04% higher than the trajectory generated by the classical PRM. The study has some limitations.