Optimal power flow solutions using the gradient projection method. I. Theoretical basis