Calculus of variation is a special case of optimal control theory in a particular sense.
Consider, Dido's iso-perimetric problem (colloquially said to be the oldest calculus of variation problem) which can be viewed as an optimal control problem, in the sense that what you get to control is the 'shape' of the curve, and your objective is to maximize the area.
Similarly, another classic problem in calculus of variation is the Brachistochrone Problem which got much attention from the likes of Newton, Bernoullis, Leibniz etc. Again in this case, we can consider the control to be the shape of the curve, and the objective to minimize time.
Now as you observed classical control theory is concerned with transfer functions, root locus, stabilization etc. Here traditionally the choice of control has been to stabilize a system, drive a system from one state to another etc. Optimality was indeed an after thought.
The field of optimal control only really took off in the 1960's due to Bellman and Pontryagin who introduced dynamic programmingand the maximum principle respectively. Of these the latter approach is specifically a great generalization of ideas from calculus of variations.
Very simplistically, in calculus of variations, we take a function from a space of functionals, 'perturb it a bit' (that is take its variation) and then derive conditions that function and the variations would satisfy if the function were optimal to begin with. So generally this gives necessary conditions (and indeed the maximum principle is a necessary condition where as the HJB equation is necessary and sufficient).
The great leap from calculus of variations to optimal control was a broad generalization of the kinds of variations we can consider. And so we say that calculus of variations is a special case of optimal control theory.
As a side note, another topic that relates calculus of variations and optimal control is principle of least action
As mentioned in the comments, Dr. Liberzon's book is an excellent introductory resource that combines both calculus of variations and optimal control in a very concise and readable form. There is a couple of chapters introducing calculus of variations and then moving into optimal control theory. So yes, studying calculus of variations first is recommended, but it needn't be a very deep study to get to optimal control. If you have a background in real and functional analysis, that should be sufficient for the Liberzon text.
If you want to study just calculus of variations I found Gelfand and Fomin to be pretty good. For a very deep study of optimal control Athans and Falb is a classic.
Other resources in no particular order are: Lectures on Calculus of Variations and Optimal Control by L.C Young, Mathematical Control Theory by E. D Sontag, Calculus of Variations and Optimal Control by G. Leitmann and lecture notes by H. Sussman.
When you directly minimize the cost functional (for instance using a discretization in time so that the integral becomes a summation), you are solving the optimal control problem for a single initial point $x_0$. Moreover, you will find an open-loop control, i.e. a function $t \mapsto u^*(t)$, which is not robust to perturbations in the dynamics (see Open-loop vs closed-loop).
When you solve the HJB equation, instead, you are simultaneously solving the problem for all values of $x_0$, and you can even provide an optimal control in feedback form.
Regarding the question on the double minimization problem, you are right. There is a double minimization problem, but
- The dimension of the minimization problem is the dimension of the control space, which is typically very small, so it not very expensive.
- Simulations have shown that the first minimization, the one while solving the HJB in step 1, does not need to be solved accurately, so one can discretize the control space with few controls and minimize over a finite set of possible control values. The second minimization problem, however, must be solved more accurately.
I recommend this book for more details.
Best Answer
I learned optimal control theory from an econ class, and hope my explanation would help.
short version for transversality conditions:
if end time $t_1$ is fixed but the value is free, then the co-state variable satisfies $\lambda (t_1)=0$, otherwise the shadow price of $y(t_1)$ is not zero, and we can increase or decrease it negatively with the direction designated by the sign of $\lambda (t_1)$.
if both are free, then optimal end time $t_1^*$ should give us zero (optimized) Hamiltonian at $t_1^*$: $\mathcal H(t_1^*, y^*(t_1^*),u^*(t_1^*),\lambda (t_1^*))=0$, otherwise the integrand is not zero at that time, and we can push forward or back the optimal end time positively with direction designated by the sign of $\mathcal H(t_1^*, y^*(t_1^*),u^*(t_1^*),\lambda (t_1^*))$.
long version:
first, let's change some notations: we have an optimization problem involving time $t$ where we can choose state variable $u(t)$ to influence $y(t)$:
$$ \max \int ^{t_{1}} _{t_{0}} L(t,y(t),u(t)dt $$ subject to $$ \dot y(t)= f(t, y(t),u(t)) $$ and initial condition $y(t_0)=y_0$ given. there shall be some conditions to be satisfied for function $L,g$ and the control $u$, otherwise we cannot talk about the maximum principle, but I simply omit them here.
to understand the transversality condition for variable endpoint problem, it's better to start from a constrained one: $y(t_1)= y_1$.
Then write the Hamiltonian as $$ \mathcal H(t,y,u,\lambda)=L(t,y,u)+\lambda g(t,y,u) $$
and the celebrated maximum principle states that
given optimal pair $(y^*(t),u^*(t))$, define the optimized value function as: $$ V(y_0,y_1,t_0,t_1)=\int ^{t_{1}} _{t_{0}} L(t,y^*(t),u^*(t)dt$$ and optimized Hamiltonian for time $t$: $$\mathcal H^*(t)=\mathcal H(t, y^*(t), u^*(t),\lambda (t))$$
analog to static optimization, we can also derive sensitivity results provided differentiability (which I'd call "envelop theorem"):
for fixed end time free value, the second one must be zero; for both free, the fourth also should be zero.