We present a method for improving adaptability of Learning from Demonstration (LfD) strategy by combining the LfD and Particle Swarm Optimization (PSO). A trajectory generated from an LfD is modified with PSO by minimizing a fitness function that considers constraints. Finally, the final trajectory is suitable for a task and adapted for constraints. The effectiveness of the method is shown with a target reaching task with a manipulator in three-dimensional space.