Constraints

The following constraints are used in this example:

  • bounds on variables

  • for $\text {gate} \in \text {GATES}$,

    \[  \Variable{AssignAGate[gate]} \le \Variable{UseGate[gate]}  \]
  • for $\text {gate} \in \text {GATES}$,

    \[  \Variable{AssignBGate[gate]} \le \Variable{UseGate[gate]}  \]
  • for $\text {gate} \in \text {GATES}$,

    \[  \sum _{(\text {pred},\text {gate}) \in \text {ARCS}} \Variable{UseGate[pred]} + \Variable{AssignAGate[gate]} + \Variable{AssignBGate[gate]} \le 2  \]
  • for $\text {row} \in \text {ROWS}$,

    \[  \Variable{Output[1,row]} = \Argument{target\_ output[row]}  \]
  • for $\text {gate} \in \text {GATES}$ and $\text {row} \in \text {ROWS}$,

    \[  \Variable{Output[gate,row]} \le \Variable{UseGate[gate]}  \]
  • for $\text {gate} \in \text {GATES}$ and $\text {row} \in \text {ROWS}$,

    \[  \Argument{inputA[row]} \cdot \Variable{AssignAGate[gate]} \le 1 - \Variable{Output[gate,row]}  \]
  • for $\text {gate} \in \text {GATES}$ and $\text {row} \in \text {ROWS}$,

    \[  \Argument{inputB[row]} \cdot \Variable{AssignBGate[gate]} \le 1 - \Variable{Output[gate,row]}  \]
  • for $(\text {pred},\text {gate}) \in \text {ARCS}$ and $\text {row} \in \text {ROWS}$,

    \[  \Variable{Output[pred,row]} \le 1 - \Variable{Output[gate,row]}  \]
  • for $\text {gate} \in \text {GATES}$ and $\text {row} \in \text {ROWS}$,

    $\displaystyle  $
    $\displaystyle \quad \Argument{inputA[row]} \cdot \Variable{AssignAGate[gate]} + \Argument{inputB[row]} \cdot \Variable{AssignBGate[gate]}  $
    $\displaystyle  $
    $\displaystyle + \sum _{(\text {pred},\text {gate}) \in \text {ARCS}} \Variable{Output[pred,row]}  $
    $\displaystyle  $
    $\displaystyle \ge \Variable{UseGate[gate]} - \Variable{Output[gate,row]}  $