A generalized dynamic flows problem