# Logic of multiple variables in ILP

Is there a better way to represent an AND of $$n$$ variables together other than creating $$O(n)$$ new variables and constraints?

• You might want to ask your other question separately, so it's not treated as an answered question, and then remove it from this post. Generally, this site works best when you ask one question per post. – D.W. Apr 25 at 22:55

There's a straightforward way to represent the logical AND of $$n$$ variables $$x_1,\dots,x_n$$: add the linear inequalities $$y \ge x_1+ \dots + x_n-(n-1)$$, $$y \le x_i$$ for each $$i$$, and $$0 \le y \le 1$$.