  We discuss variational formulas for the limits of certain models of motion in
a random medium: namely, the limiting time constant for last-passage
percolation and the limiting free energy for directed polymers. The results are
valid for models in arbitrary dimension, steps of the admissible paths can be
general, the environment process is ergodic under shifts, and the potential
accumulated along a path can depend on the environment and the next step of the
path. The variational formulas come in two types: one minimizes over
gradient-like cocycles, and another one maximizes over invariant measures on
the space of environments and paths. Minimizing cocycles can be obtained from
Busemann functions when these can be proved to exist. The results are
illustrated through 1+1 dimensional exactly solvable examples, periodic
examples, and polymers in weak disorder.
