I am trying to solve a simple optimal control problem, by using direct discretization with backward differences.
I was driven to try this out as FindMinimum did not work at all for more complex constrained optimization problems.
The problem is to minimize the travel time for a car starting at position x = 0, with velocity v=0 and arriving 300 distance units at rest, thus at tf we have x[tf]=300 and v[tf]=0.
The odes which are discretized are:
dv/dt = u
dx/dt = v
where u is the control (acceleration) bounded by:
-2 <= v <= +1.
The objective is to minimize tf which is the sum of the finite difference steps (the steps are fixed in number and are also optimization variables).
I attach the file I have written. I hope someone will be able to answer why FindMinimum does not work for this really trivial problem....
Attachment: car problem by hand implicit euler.nb, URL: ,