10 4 we construct a general algorithm for single port networks and provide conditions under which it behaves optimally