Inter-basin water transfer projects have large tunnels and the cost of implementation is high. In order to cut costs, this system should be optimized. In inter-basin water transfer projects, hydraulics and water resources are equally important. For optimizing, both hydraulic and hydrologic modeling flow conditions must be considered together. In this study, four dams and three water transfer tunnels were used for transferring water from Yalan dam to Zayanderud dam (YPGZWT project) in Iran. Dynamic programming (DP) and integrated solution of water resource and hydraulic models, developed by the authors, were used for optimizing the project. The objective of the study is the transferring of 95% of the water flow between both basins after supplying the agricultural consumption and environmental needs of their respective areas. The water level in the dam reservoirs and diameter of the tunnels were considered as the state variable and decision variable respectively in the DP model. The results showed that Yalan, Pashandegan and Gokan dams with a height of 135, 44 and 106 m, respectively, and Yalan–Pashandegan, Pashandegan–Gokan and Gokan–Zayanderud tunnel diameters, 2.812, 3.294 and 5.432 m, respectively, were the most economically optimal combination of water transferring in YPGZWT Project and the cost of this project is 350.70 million US dollars.