Variational Principle for Optimal Quantum Controls in Quantum Metrology.