A Method for Optimal Synthesis of Manipulation Robot Trajectories