Given limits for velocity, acceleration and jerk, $v_{max}(x)$, $a_{max}$ and $j_{max}$ respectively. The goal is to generate a velocity profile that obeys the limits and minimizes the time / maximizes the velocity.
In the case where jerk is not a constraint, a velocity profile which minimizes time with constant acceleration can be calculated by discretizing the velocity limit function into evenly spaced points. Then drawing lines between each pair of points, in the case of the line having too high of a slope the point is lowered. This is done from left to right and then from right to left which generates a minimum-time constant acceleration velocity profile. On page 20 This paper explains this method.
Although extension of that method such that the velocity profile is C2 continuous is not very straight forward.
For reference, in the picture above, the black curve is the velocity limit, the red curve is the velocity profile which is limited by acceleration and the velocity limit. The profile is assumed to start and stop at $0$. The velocity profile is C1 continuous and the goal is to generate a velocity profile which is C2 continuous. For clarification, only the velocity limit is non-constant, the other limits for acceleration and jerk are constant. How should this problem be approached?
