  The calculus of variation and the construction of path integrals is revisited
within the framework of non-linear generalized functions. This allows us to
make a rigorous analysis of the variation of an action that takes into account
the boundary effects, even when the approach with distributions has
pathological defects. A specific analysis is provided for optimal control
actions, and we show how such kinds of actions can be used to model physical
systems. Several examples are studied: the harmonic oscillator, the scalar
field, and the gravitational field. For the first two cases, we demonstrate how
the boundary cost function can be used to assimilate the optimal control
adjoint state to the state of the system, hence recovering standard actions of
the literature. For the gravitational field, we argue that a similar mechanism
is not possible. Finally, we construct the path integral for the optimal
control action within the framework of generalized functions. The effect of the
discretization grid on the continuum limit is also discussed.
