3

I'm trying to devise an algorithm that will simulate a network of pipes with multiple sources and multiple sinks of specific capacity.

So far I have tried using the classic Ford-Fulkerson algorithm but the issue i run into is this, given the following graph:

    S
    |
    a
   / \
  B   C

Given S with a source capacity of 1, and both B and C with a sink capacity of 1 - a flow will result S - a - B, saturating B to 1 and leaving C with flow 0.

I'm trying to distribute flow uniformly across the network, so that both B and C receive 0.5. Any ideas?

Thanks!

Radu
  • 45
  • 4
  • So you want equal (plus/minus 1) flow arriving at all sinks? Or do you want to maximize the minimum flow to any of the sinks? What is the function you want to optimize here? – Niklas B. Mar 21 '14 at 21:27
  • I want 0.5 in both B, C - as opposed to 1 in B and 0 in C. Edited the question for clarity. Thanks. – Radu Mar 21 '14 at 21:30
  • Yeah for this example it is clear what you want. But what do you want in the *general* case with more than 2 sinks for example? To achieve "equal" distribution you need to reduce the total flow in the general case, and I'm asking whether that is what you want, or what your definition of "uniform distribution" is – Niklas B. Mar 21 '14 at 21:30
  • Given n edges outbound from a, the inbound flow into a should be evenly distributed to the outbound edges (assuming the edges lead into a sink with adequate capacity). – Radu Mar 21 '14 at 21:33
  • You could use convex programming to find an appropriate flow with minimum L2 norm, but you haven't fully specified the problem, so I'm not sure whether that would be appropriate. – David Eisenstat Mar 21 '14 at 21:39
  • @Radu What if it's not possible to distribute the flow that way because capacities don't allow for a feasible flow that has your desired property? – Niklas B. Mar 21 '14 at 21:45

2 Answers2

1

Say you have n sources s1, ..., sn with source capacities ci and m sinks t1, ..., tm. Let f = sumi ci. We want to find a feasible flow in the network where every source i has a net flow of -ci and every sink has a net flow of f / m.

We can solve this by introducing a super source S and a super sink T and connecting each of the sources i to S via an edge (si, S) of capacity ci. We connect each ti to T via an edge of capacity f / m. Then we just run max-flow with source S and sink T.

If it is not possible to push exactly f / m units of flow to each sink, it is not clear what you want to optimize, but you might find the following two approaches useful:

  • Choose e and connect the sinks to T via edges with capacities f / m + e. Use binary search to find the minimum e such that the total flow will be f. This minimizes maxi inflow(ti)
  • Choose e and add the sinks to T via edges with lower bound e. Use binary search to find the maximum e that still allows for a feasible flow. This maximizes mini inflow(ti). The feasible flow problem with lower bounds can be reduced to max-flow: http://www.cs.uiuc.edu/~jeffe/teaching/algorithms/2009/notes/18-maxflowext.pdf In this case the construction is really simple: Just add an additional super-source S' and connect S' to S via an edge of capacity m * e. Connect all sinks to T via edges of capacity e. Check if the maximum flow between S' and T is m * e
Niklas B.
  • 92,950
  • 18
  • 194
  • 224
0

I work as a water network engineer. When I model water supply networks, I usually put sources as pressure nodes and sinks as demand nodes, because water simulation software solves for either the head or the flow at nodes. And I know the capability of the pumps at the source and the consumption at the customers. Flow in pipes is resolved with headloss-flow equations such as Hazen-Williams or Darcy-Weisbach.

In your example the sinks demand more than what the source can provide, all in terms of flow. The customers at both B and C will try to open their faucets as large as possible, to fulfil their 1 unit of demand; but assuming that the pipe path from a to B is identical to from a to C, the 1 unit of flow will split evenly after both B and C tried their best to maximise flow to their respective ends.

But because the constraint of 2 units total demand is not met, the simulation software will not resolve. Either the source should be changed to pressure node, which will give the pressure required to send 2 units of water out, or the customer demands should be reduced to match source capabilities. In the latter case, the purpose is to model the hydraulic grade line from source to sink.

yiuyan
  • 1