  We consider the problem of determining a sequence of payments among a set of
entities that clear (if possible) the liabilities among them. We formulate this
as an optimal control problem, which is convex when the objective function is,
and therefore readily solved. For this optimal control problem, we give a
number of useful and interesting convex costs and constraints that can be
combined in any way for different applications. We describe a number of
extensions, for example to handle unknown changes in cash and liabilities, to
allow bailouts, to find the minimum time to clear the liabilities, or to
minimize the number of non-cleared liabilities, when fully clearing the
liabilities is impossible.
