Discrete variational integrators and optimal control theory