# Trajectory optimization for smoothness

I want to achieve the following in 2D (and without obstacles):

Given start position A and end position B, generate the path between the two points that optimizes a cost function that depends on total length and overall smoothness. The one constraint is a tangential constraint (ie. velocity constraint) at point A.

For example, the cost function could be

$$U = \int\limits_{t_\mathrm{A}}^{t_\mathrm{B}} a^2(t) dt + L$$

with $a$ the acceleration and $L$ the path length.

Do you know of a simple way I could solve this optimization problem, preferably using Python?

• Welcome to Scientific Computing SE. Can you please edit your question to clarify what you mean by optimising for smoothness? – Wrzlprmft Dec 7 '17 at 8:40
• This is a classical optimal control problem, on which there is a huge literature (for example, the book by Matthias Gerdts). I'm not aware of any dedicated Python packages, but if you have a time-stepping scheme for your ODE, it's perfectly feasible to solve the problem in Python. (Don't expect it to be simple, though -- not every problem has an easy solution...) – Christian Clason Dec 7 '17 at 10:24
• Wouldn't a straight line be the shortest and "smoothest" solution? – fibonatic Dec 7 '17 at 11:44