Variational and Optimal Control Problems on Unbounded Domains