Let $x(t) \in \mathbb{R}$, such that $x(0) = x_0$, $\dot{x}(0) = v_0$ Find the optimal trajectory for $x(t)$, such that $$L = \int_{t=0}^T|x(t) - x_f|^2dt$$ is minimized, subject to the constraint $|\ddot{x}(t)| \leq a_0, \forall t$. $x_0, x_f, v_0$ and $a_0$ are known constants.
Any insights on general methods to attacking such problems are welcome. I would appreciate any advice.
Edit: I would like to emphasize that essential part of this question is proving that the trajectory is optimal. The problem above is a much simplified version of the actual problem I am solving. Therefore, I ask for the principle of constructing necessary and sufficient equations for finding the optimal trajectory.
I don't know of any general method here so I'll stick with a guess based on simple physical intuition. My guess is that the optimal solution will be to switch between accelerating maximum in one direction, then the other direction (to kill the velocity and prevent too big overshoot) and then stay put (when we have reached the point $x_f$ with zero velocity). For these cases we can easily compute the value of $L$ which could serve as a check against other possible solutions.
By shifting the coordinate system and rescaling time and space coordinates we can for simplicity assume that $x_0 = 0$, $x_f = 1$ and $T = 1$. I will also assume that the initial velocity $x'(0) = 0$. For the case where we are free to choose $x'(0)$, see the end of this answer. Let's split into three cases depending on how large the maximum acceleration is.
If $a_0<2$ then the solution is to accelerate at max all the way so $x(t) = \frac{a_0t^2}{2}$. For this case it's clear that this is the optimal solution and we have $L = 1 - \frac{a_0}{3} + \frac{a_0^2}{20}$.
If $2<a_0<4$ then we accelerate at max till $t = 1 - \sqrt{\frac{(a_0-2)}{2a_0}}$ and then flip the sign of the acceleration and decelerate at max till we reach $x_f = 1$ at $t=1$. For this case $L = \frac{22 a_0^3-120 a_0^2+280 a_0 - 15\sqrt{2(a_0-2) a_0}(a_0-2)^2}{240a_0}$.
If $a_0 > 4$ then we accelerate at max till $t = \frac{1}{\sqrt{a_0}}$ then declerate at max till $t = \frac{2}{\sqrt{a_0}}$ (for which we are at $x_f=1$ with zero velocity) and then we stop accelerating and stay put. For this final case we find $L = \frac{23}{30\sqrt{a_0}}$.
A plot of the solution for $a_0 = 16$ is given below:
In the proposal above I have assumed that the initial condition is $x'(0)=0$, i.e. that we start off with zero velocity. If we are free to choose the initial velocity then let's solve by going backwards from $t=1$ starting at $x = x_f$. We stay here as long as we possibly can and then start accelerating maximally so that we just reach $x=0$ at $t=0$ (with non-zero velocity $x'(0) = \sqrt{\frac{a_0}{2}}$). Thus the solution (for $a_0>2$) will be $x(t) = 1 - (t/t_0-1)^2$ for $t < t_0$ and $x(t) = 1$ for $t>t_0$ where $t_0 = \sqrt{\frac{2}{a_0}}$. For this case we have $L = \frac{\sqrt{2}}{5\sqrt{a_0}}$.