We consider first-passage percolation with positive, stationary-ergodic weights on the square lattice Zd. Let T(x) be the first-passage time from the origin to x in Zd. The convergence of the scaled first-passage time T([nx]) /n as n goes to infinity to the so-called time constant is a classical result. We view this convergence as a homogenization problem for a discrete Hamilton-Jacobi-Bellman (HJB) equation. By borrowing several tools from the continuum theory of stochastic homogenization for HJB equations, we derive an exact variational formula for the time-constant. The variational formula may also be seen as a duality principle, and we discuss some aspects of this. As an application, we construct an explicit iteration that produces the minimizer of the variational formula. |