Optimal Online Control of Dynamical Systems Under Uncertainty