To continuously generate trajectories for serial manipulators with high dimensional degrees of freedom (DOF) in the dynamic environment, a real-time optimal trajectory generation method based on machine learning aiming at high dimensional inputs is presented in this paper. First, a learning optimization (LO) framework is established, and implementations with different sub-methods are discussed. Additionally, multiple criteria are defined to evaluate the performance of LO models. Furthermore, aiming at high dimensional inputs, a database generation method based on input space dimension-reducing mapping is proposed. At last, this method is validated on motion planning for haptic feedback manipulators (HFM) in virtual reality systems. Results show that the input space dimension-reducing method can significantly elevate the efficiency and quality of database generation and consequently improve the performance of the LO. Moreover, using this LO method, real-time trajectory generation with high dimensional inputs can be achieved, which lays a foundation for continuous trajectory planning for high-DOF-robots in complex environments.