Variational structure of the optimal artificial diffusion method for the advection-diffusion equation