Variational Principles of Dyna