Optimal Scheduling of Multiproduct Pipelines in Networks with Reversible Flow