Pipe Network Optimization in Multiphase Flow