River Routing with a Small Number of Jogs

The one-layer wiring problem of providing a one-to-one connection between two sets of terminals that lie on two horizontal lines by means of wires that are in the forms of disjoint rectilinear curves on a unit grid (where one unit is the minimum spacing between two wires), is called the river routing problem. The problem has been widely studied. Here this problem is studied when the number of horizontal segments in each wire is at most 2, and provide an $0(n^3 )$ time dynamic programming algorithm for finding the minimum separation between the two horizontal lines for n wires.