Minimizing the Lagrangian action of an impossible problem I'm working my way through Structure and Interpretation of Classical Mechanics (SICM), and am stuck on an exercise in Section 1.4:

Exercise 1.6.  Minimizing action:
  Suppose we try to obtain a path by minimizing an action for an impossible problem. For example, suppose we have a free particle and we impose endpoint conditions on the velocities as well as the positions that are inconsistent with the particle being free. Does the formalism protect itself from such an unpleasant attack? You may find it illuminating to program it and see what happens. 

While I totally understand what I'm supposed to do here (say use the Lagrangian for the free particle, but a path function that is (x(t), y(t), z(t)) = (sin, cos, identity), for example), I am not able to impose endpoint velocities. 
The function I'm minimizing takes a bunch of intermediate points, and uses Lagrangian interpolation to fit a polynomial to it. In case of the free particle, then, the optimal parameters will be such that the fitted curve is approximately a straight line. I think without imposing endpoint velocities, it is not possible to get an "inconsistent" problem, since any two points in the configuration space can be joined by a hyperplane, which will the path of a free particle.
PS: I am a programmer and would love to work through this book with someone more knowledgeable in physics.
 A: If your action only depends on first time derivatives, it is then not required for the trajectory to have second time derivative -- i.e. an abrupt change in velocity does not by itself give a contribution to the action. In other words, there is no penalty for changing your speed instantaneously. It then means that you can ignore the boundary values for velocities -- you can change them instantaneously anyway. 
For a free particle it is an easy fact that the straight line trajectory between the endpoints is the absolute minimum of action. If you try to prescribe the boundary values for velocities, then the trajectory is still going to be the same -- it will ignore your prescriptions because it can. It cannot ignore your coordinate boundary conditions, since changing coordinate instantaneously requires infinite velocity, and velocity does enter the action, so there will be a huge penalty for that.
Now, on more mathematical side, you can say that you consider the minimization problem in some class of functions. Say, smooth functions. Then velocity cannot change abruptly. But it can change arbitrarily quickly, and there is going to be no minimum in this class of functions in the same way as there is no minimum in the open interval $(0,1)$.
A: Peter Kravchuk has already given a good answer. Here we will follow the programming hint given in the Exercise 1.6 as a way to illuminate the issue. 
How would one program this minimization problem? By discretization. So the positions ${\bf r}_n$ live on discrete times 
$$t_n~=~n\Delta t,\qquad\Delta t ~:=~\frac{T}{N},\qquad  n\in\{0,\ldots,N\}.$$
Velocities are discretized as, e.g.,
$${\bf v}_n~:=~ \frac{{\bf r}_n-{\bf r}_{n-1}}{\Delta t}\qquad n\in\{1,\ldots,N\}.$$ 
(The action only depends on derivatives up to first order, so we don't have to consider acceleration, etc.)
Next the two position boundary conditions (BC) fix ${\bf r}_0$ and ${\bf r}_N$. The two velocity BCs then fix the neighbors ${\bf r}_1$ and ${\bf r}_{N-1}$. How would the remaining positions 
$${\bf r}_n,\qquad  n\in\{2,\ldots,N-2\}, $$
settle to minimize the action? Obviously this discretized problem is effectively equivalent to a variational problem between $t_1$ and $t_{N-1}$ with Dirichlet BCs ${\bf r}_1$ and ${\bf r}_{N-1}$, where we simply ignore the two outermost points ${\bf r}_0$ and ${\bf r}_N$.
