Hamiltonian (control theory)


The Hamiltonian is a function used to solve a problem of optimal control for a dynamical system. It can be understood as an instantaneous increment of the Lagrangian expression of the problem that is to be optimized over a certain time period. Inspired by, but distinct from, the Hamiltonian of classical mechanics, the Hamiltonian of optimal control theory was developed by Lev Pontryagin as part of his maximum principle. Pontryagin proved that a necessary condition for solving the optimal control problem is that the control should be chosen so as to optimize the Hamiltonian.

Problem statement and definition of the Hamiltonian

Consider a dynamical system of first-order differential equations
where denotes a vector of state variables, and a vector of control variables. Once initial conditions and controls are specified, a solution to the differential equations, called a trajectory, can be found. The problem of optimal control is to choose so that maximizes or minimizes a certain objective function between an initial time and a terminal time . Specifically, the goal is to optimize a performance index at each point in time,
subject to the above equations of motion of the state variables. The solution method involves defining an ancillary function known as the Hamiltonian
which combines the objective function and the state equations much like a Lagrangian in a static optimization problem, only that the multipliers, referred to as costate variables, are functions of time rather than constants.
The goal is to find an optimal control policy function and, with it, an optimal trajectory of the state variable, which by Pontryagin's maximum principle are the arguments that maximize the Hamiltonian,
The first-order necessary conditions for a maximum are given by
the latter of which are referred to as the costate equations. Together, the state and costate equations describe the Hamiltonian dynamical system, the solution of which involves a two-point boundary value problem, given that there are boundary conditions involving two different points in time, the initial time, and the terminal time.
A sufficient condition for a maximum is the concavity of the Hamiltonian evaluated at the solution, i.e.
where is the optimal control, and is resulting optimal trajectory for the state variable. Alternatively, by a result due to Olvi L. Mangasarian, the necessary conditions are sufficient if the functions and are both concave in and.

Derivation from the Lagrangian

A constrained optimization problem as the one stated above usually suggests a Lagrangian expression, specifically
where the compare to the Lagrange multiplier in a static optimization problem but are now, as noted above, a function of time. Proceeding with a Legendre transformation, the last term on the right-hand side can be rewritten using integration by parts, such that
which can be substituted back into the Lagrangian expression to give
To derive the first-order conditions for an optimum, assume that the solution has been found and the Lagrangian is maximized. Then any change to or must cause the value of the Lagrangian to decline. Specifically, the total derivative of obeys
For this expression to equal zero necessitates the following optimization conditions:
If both the initial value and terminal value are fixed, i.e., no conditions on and are needed. If the terminal value is free, as is often the case, the additional condition is necessary for optimality. The latter is called a transversality condition for a fixed horizon problem.
It can be seen that the necessary conditions are identical to the ones stated above for the Hamiltonian. Thus the Hamiltonian can be understood as a device to generate the first-order necessary conditions.

The Hamiltonian in discrete time

When the problem is formulated in discrete time, the Hamiltonian is defined as:
and the costate equations are
.

Behavior of the Hamiltonian over time

From Pontryagin's maximum principle, special conditions for the Hamiltonian can be derived. When the final time is fixed and the Hamiltonian does not depend explicitly on time, then:
or if the terminal time is free, then:
Further, if the terminal time tends to infinity, a transversality condition on the Hamiltonian applies.

The Hamiltonian of control compared to the Hamiltonian of mechanics

defined the Hamiltonian for describing the mechanics of a system. It is a function of three variables:
where is the Lagrangian, the extremizing of which determines the dynamics, is the state variable and is its time derivative.
is the so-called "conjugate momentum", defined by
Hamilton then formulated his equations to describe the dynamics of the system as
The Hamiltonian of control theory describes not the dynamics of a system but conditions for extremizing some scalar function thereof with respect to a control variable. As normally defined, it is a function of 4 variables
where is the state variable and is the control variable with respect to that which we are extremizing.
The associated conditions for a maximum are
This definition agrees with that given by the article by Sussmann and Willems.. Sussmann and Willems show how the control Hamiltonian can be used in dynamics e.g. for the brachistochrone problem, but do not mention the prior work of Carathéodory on this approach.

Current value and present value Hamiltonian

In economics, the objective function in dynamic optimization problems often depends directly on time only through exponential discounting, such that it takes the form
where is referred to as the instantaneous utility function, or felicity function. This allows a redefinition of the Hamiltonian as where
which is referred to as the current value Hamiltonian, in contrast to the present value Hamiltonian defined in the first section. Most notably the costate variables are redefined as, which leads to modified first-order conditions.
which follows immediately from the product rule. Economically, represent current-valued shadow prices for the capital goods.

Example: Ramsey–Cass–Koopmans model

In economics, the Ramsey–Cass–Koopmans model is used to determine an optimal savings behavior for an economy. The objective function is the social welfare function,
to be maximized by choice of an optimal consumption path. The function indicates the utility the representative agent of consuming at any given point in time. The factor represents discounting. The maximization problem is subject to the following differential equation for capital intensity, describing the time evolution of capital per effective worker:
where is period t consumption, is period t capital per worker, is period t production, is the population growth rate, is the capital depreciation rate, the agent discounts future utility at rate, with and.
Here, is the state variable which evolves according to the above equation, and is the control variable. The Hamiltonian becomes
The optimality conditions are
in addition to the transversality condition. If we let, then log-differentiating the first optimality condition with respect to yields
Inserting this equation into the second optimality condition yields
which is known as the Keynes–Ramsey rule, which gives a condition for consumption in every period which, if followed, ensures maximum lifetime utility.