Worst-case optimal noncausal motion planning for residual vibration reduction