  Time-varying optimization problems are central to many engineering
applications, where performance metrics and system constraints evolve
dynamically with time. A number of algorithms have been proposed in recent
years to solve such problems; a common feature of all these methods is that
they implicitly require precise knowledge of the temporal variability of the
solutions in order to exactly track the optimizers. In this paper, we seek to
lift these stringent assumptions. Our main result is a fundamental
characterization, showing that an algorithm can track an optimal trajectory if
and only if it contains a model of the temporal variability of the problem. We
refer to this concept to as the internal model principle of time-varying
optimization. By recasting the optimization objective as a nonlinear regulation
problem and using tools from center manifold theory, we provide necessary and
sufficient conditions both for an optimization algorithm to achieve exact
asymptotic tracking and for such an algorithm to exist. We illustrate the
applicability of the approach numerically on both synthetic problems as well as
practical problems in transportation.
