title: Clean implementation of "decision matrix"
body: <p>I am trying to find a clean solution to implement a basic decision matrix in python. I have 8 sensors that monitor an installation, and based on the state of these 8 sensors, I need to activate some relays.</p>
  
  <p>My decision matrix looks like (S are sensors and R are R):</p>
  
  <pre><code>S1   S2   S3   S4   S5   S6   S7   S8   R1   R2   R3
  0    1    0    0    1    1    0    1    0    0    1
  1    0    1    0    0    1    1    0    1    1    1
  0    1    1    1    0    0    0    1    0    1    0
  ...
  </code></pre>
  
  <p>Currently the only implementation that I see, is a suite a if/elif statements for each row of my descision matrix like:</p>
  
  <pre><code>if S1==0 and S2==1 and S3==0 and S4==0 and S5==1 and S6==1 and S7==0 and S8==1:
      relay_state('R1', 0)
      relay_state('R2', 0)
      relay_state('R3', 1)
  elif ...
  </code></pre>
  
  <p>This will definitely work, but I wonder if there is a cleaner way to implement this?</p>