Controlling the unsteady effects of fluid flow (water hammer) is one of the most important monitoring factors for structural protection of transmission pipelines. These effects are controlled by surge tanks, air chambers, pressure relief valves, and check valves. Generally, the critical points are detected by simulating the unsteady flow of the fluid, and accordingly, optimum positioning of the control devices is decided. Among the search methods, Genetic Algorithm (GA) is an effective and robust method to solve highly complex optimization problems. Here, for the first time, GA coupled with an unsteady flow simulator is used to optimize the number and capacity of surge tanks in a pipeline system. In addition, the pipeline diameters are optimized for their best performance.