Pump power failure in pipelines is one of the most important factors causing water-hammer, which leads to sharp fluctuations in velocity and pressure. To prevent the destructive effects of this phenomenon, the use of pipe of appropriate compressive capacity and protective devices such as air-chambers and control valves is required. In a transmission system, increased diameter and decreased thickness of pipe leads to decreased flow velocity and compressive wave speed and reduction of water-hammer impact. Thus, although the increase of diameter leads to increased cost of pipe and decrease of thickness lowers its compressive strength, the resulting reduced fluctuation of water-hammer could minimize the cost by lowering the required pipeline class and decreasing the size and number of protective devices. In this paper, an optimization model has been presented for selection of the best diameter, thickness and pipe material and selection of positions and proper type of water-hammer controlling devices where a combined flowchart includes an optimization algorithm and flow analysis at steady and transient states. A self-adaptive real genetic algorithm has been used for this optimization, and its capability in cost reduction of pipelines has been approved in a case study.