Optimal valve location in long oil pipelines