Equations of Motion to follow an trajectory There are two points $\vec{x}(t)$ and $\vec{u}(t)$ that change over time. We are interested in the time interval $t \in [0, T]$. The positions and velocities of both points at time $t=0$ are known. The entire trajectory of the second point $\vec{u}(t)$ is known in advance. It is also known that the acceleration of either point can not exceed a constant $a_{max}$ at any time.

The goal is to construct the trajectory $\vec{x}(t)$ that minimizes the average squared distance $S = \frac{1}{T}\int_{t=0}^{T}|x(t)-u(t)|^2dt$ while fulfilling the above acceleration constraint.

What is an aproppriate formalism to address this question, and, if possible, what are the equations that can be solved for the trajectory.

I have attempted to use Euler-Lagrange to solve this problem, but it does not seem to give satisfactory results. For example, a naive Lagrangian

$$L = \frac{mv^2}{2} - \frac{k|x(t)-u(t)|^2}{2}$$

has several problems


Even if $u(t)$ is a constant, $x(t)$ would oscillate around it instead of converging
The trajectory of $x(t)$ does not take any advantage of the knowledge of future values of $u(t)$, it only uses the current value
The acceleration of $x(t)$ can exceed $a_{max}$ if the points are sufficiently far away. I am not aware of a way to include the acceleration constraint into Lagrangian, as it typically only depends on position and velocity.


Perhaps Euler-Lagrange is not the correct way to approach this problem? Any hints are useful
Well, FWIW, in principle we could pick a Lagrangian

$$ L(\vec{x},\vec{v},\vec{a},t)~=~\frac{1}{2}|\vec{x}-\vec{u}(t)|^2 + {\infty} 1_{]a_{\max},\infty[}(|\vec{a}|), $$

where we implicitly assume the rule $\infty\cdot 0=0$.
Well, FWIW, in principle we could pick a Lagrangian

$$ L(\vec{x},\vec{v},\vec{a},t)~=~\frac{1}{2}|\vec{x}-\vec{u}(t)|^2 + {\infty} 1_{]a_{\max},\infty[}(|\vec{a}|), $$

where we implicitly assume the rule $\infty\cdot 0=0$.