## 3 Offline Optimization and Adaptation Under Nonlinear Task Constraints
### Optimization and Adaptation Procedure
#### 3.3.2 Adaptation Procedure
Nonetheless, the optimization time in our method is significantly reduced due to improved numerical stability. Furthermore, we evaluate the generalization capability of each algorithm. In this context, generalization refers to the ability to maintain the initial distribution when encountering different task constraints and to achieve a high success rate. Specifically, if the optimized distribution closely matches the original distribution and achieves a high success rate, the method is considered to have strong generalization. The results show that [21] retains more of the original distribution compared to EKMPs [23]. However, in [21], due to the use of the unscented transform, which is sensitive to the coefficients, the estimates for \(\mathbf{\mu}_{\mathbf{w}}\) and \(\mathbf{\Sigma}_{\mathbf{w}}\) under task constraints are inaccurate. This leads to unfiltered joint distributions that violate the task constraints, resulting in task failures. Similarly, EKMP's use of Taylor linear expansion does not separate out some failed distributions, leading to a lower task success rate. Our method, however, after obtaining the optimized joint distributions, introduces a threshold to mitigate the distribution loss caused by the probabilistic characteristics. Specifically, the robot first generates task trajectories with via-point generalization, obtains the corresponding inverse kinematics solutions, and then evaluates the number of solutions within the optimized joint range. If this number exceeds the threshold, the robot executes the task. This approach reduces the distribution loss and improves success rates. The threshold determination process is obtained by sampling the via-points and recording the task execution results and the number of inverse solutions. However, due to the discrete nature of via-points, when the threshold intersects with continuous space, the optimization algorithm indicates task success, but the robot can fail. This issue requires more continuous via-point ranges for accurate task execution. Overall, despite the higher number of optimization parameters, our method achieves reduced optimization time and higher success rates by decoupling the mean and Gaussian distribution for each timestep and employing a dual optimization process for the ProMP parameters. These results demonstrate the high generalization capability of our method. Our method exhibits efficiency at the cost of increasing optimization parameters. The optimization time cannot fulfill real-time needs; however, the robot is equipped with flexible skills incrementally augmented from human demonstrations before online task execution. #### 5.4.2 Real-Time Movement Adaptation

Concerning robot real-time movement adaptation based on imitation learning (IL), ref. [47] first proposes the method of learning stable nonlinear dynamical systems (SEDS) with GMM-GMR. They utilize GMM to learn the relation of the Cartesian positions and velocities. Given the current positions, they use GMR to generate the velocities for task execution. They further develop the method in [30; 31], and ref. [32] to achieve real-time movement adaptation for the robot end-effector. In this paper, we compare our method to theirs (SEDS-GMR modulation) under the same dynamic environment (see Figure 8b). To be specific, the robot randomly generates the initial task execution trajectory from three skills (moving above, left, and right around obstacles). During task execution, the human gets involved by placing and changing objects in real-time. Given the initial task execution trajectories, we choose 6 Gaussian kernels and train the optimal GMM parameters with 1000 iterations offline to ensure accurate trajectory reproduction via GMR. We conduct 10 experiments for each skill with the qualitative and quantitative results shown in Figure 10 and Table 3. Figure 10a denotes 3D positions modulation when the robot selects to move right around the obstacle.