A method for determining the optimal settings for the controllable taps u t of voltage regulating transformers and the capacitor bank switches u c in a distribution network, comprising: receiving a network model and determining a set of state variables x and control variables u; using an objective function that represents either energy loss or total demand on said distribution network, or a combination of the foregoing, calculating an overall objective value of the network under initial control variables u; performing a var optimization calculation with the controllable tap settings u t fixed at an initial value, or the best value found so far, to output an optimized set of control settings u c for minimizing the value of said objective function; characterized by further comprising: performing a voltage optimization calculation with the control settings u c fixed at the best solution found so far, to output an optimal set of control settings u t for minimizing the value of said objective function; using said objective function, evaluating the network performance using said optimal set of control settings u t and u c and repeating said steps of performing var optimization and performing voltage optimization until either the control values u t and u c do not change from one iteration to the next, the objective function value does not change or if the new objective function value is greater than the last; and outputting said control values u t and u c to a distribution control system. receiving a network model and determining a set of state variables x and control variables u; using an objective function that represents either energy loss or total demand on said distribution network, or a combination of the foregoing, calculating an overall objective value of the network under initial control variables u; performing a var optimization calculation with the controllable tap settings u t fixed at an initial value, or the best value found so far, to output an optimized set of control settings u c for minimizing the value of said objective function; characterized by further comprising: performing a voltage optimization calculation with the control settings u c fixed at the best solution found so far, to output an optimal set of control settings u t for minimizing the value of said objective function; using said objective function, evaluating the network performance using said optimal set of control settings u t and u c and repeating said steps of performing var optimization and performing voltage optimization until either the control values u t and u c do not change from one iteration to the next, the objective function value does not change or if the new objective function value is greater than the last; and outputting said control values u t and u c to a distribution control system. performing a voltage optimization calculation with the control settings u c fixed at the best solution found so far, to output an optimal set of control settings u t for minimizing the value of said objective function; using said objective function, evaluating the network performance using said optimal set of control settings u t and u c and repeating said steps of performing var optimization and performing voltage optimization until either the control values u t and u c do not change from one iteration to the next, the objective function value does not change or if the new objective function value is greater than the last; and outputting said control values u t and u c to a distribution control system.