This paper undertakes the problem of optimal capacitor placement, replacement and control in large-scale unbalanced, radial or loop distribution networks. The problem is how to optimally determine the locations to install (or replace, or remove) capacitors, the types and sizes of capacitors to be installed (or replaced) and, during each load level, the control schemes for each capacitor in the nodes of a general three-phase unbalanced distribution system such that a desired objective function is minimized while the load constraints, network constraints and operational constraints (e.g. the voltage profile) at different load levels are satisfied. The objective function considered consists of two terms: cost for energy loss; and cost related to capacitor purchase, capacitor installation, capacitor replacement and capacitor removal. Comprehensive modelings of different components are presented which include primary power networks, three-phase transformers (different winding connections, off-nominal tap ratio, core and copper losses), cogenerators, voltage sensitive load models for single-phase, two-phase and three-phase loads, shunt capacitors and reactors. The new problem is formulated as a combinatorial optimization problem with a nondifferentiable objective function. The configuration space essential in the design of a annealing-based solution methodology for the new problem is derived.< <ETX xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">></ETX>