Distribute 6 inputs to 9 outputs with pipes

I have the task to connect 6 input sources of fluid with 9 output (sinks) sources. Each input should be connected to each output. Each input should be able to distribute the fluid to only 1 output at a time. I have straight pipes, Y connections and valves, that I can use. I should use the MINIMUM amount of valves and Y connections as possible.

Is there a standard approach to reducing the number of components required for a design like this?

This is the best I could get to so far:

• Do you have T connections? – Chris Mueller Jun 16 '15 at 12:19
• No.I have only Y connections, valves and straight pipes. – Trenera Jun 16 '15 at 12:22
• Is there a difference between a Y connection and a T connection in this case? – Ethan48 Jun 16 '15 at 14:43
• I don't think so, but the task says Y connection... – Trenera Jun 16 '15 at 14:45

As mentioned in the comments, I think it is possible to do it with 15 valves (1 per inlet and 1 per outlet) and 13 Y connections as shown below:

I recommend approaching problems like this by starting with a base case and working up from there until you see a pattern.

For piping, the base case is a straight case with one input flowing to one output. Depending on the exact specs of the problem, this requires either 0 or 1 valves; it does not require any branching.

I------O   (or, I--▷◁--O)


Add an input to the base case:

  I--▷◁--Y---O
/
I--▷◁--+


Add an output to the base case:

I---Y--▷◁--O
\
+--▷◁--O


Add both an input and an output to the base case:

  I--▷◁--Y---Y--▷◁--O
/     \
I--▷◁--+       +--▷◁--O


Here's a nicer-looking diagram, if you prefer.

What you can see from looking at these simple cases is that:

• A single input or output requires no valves.
• If there is more than one input or output, each requires one valve.
• Each input or output beyond the first requires one branch.

Since your problem has multiple inputs and multiple outputs, the minimum number of valves is equal to the total number of inputs and outputs and the minimum number of branches is equal to two fewer than the total number of inputs and outputs.

• This correlates with my answer of 15 valves and 13 Y connections. – am304 Jun 16 '15 at 18:07