A variational characterization of the speed of a one-dimensional self-repellent random walk