Concisely writing multiple similar constraints for an optimization problem

27 Views Asked by At

I am currently studying the linear optimization problems and would like to know if it is possible to make the notation for multiple similar constraints more concise.

For example, I know how to do that if you variables have integer subscripts($x_1,x_2,x_3...$). Then, if we have similar constraints on each variable, instead of writing it this way $$ x_1 \le 20 \\ x_2 \le 20 \\ x_3 \le 20 $$ We could simply write $x_i \le 20\ (i=1..3)$. But how can we do something similar when the variables are named more conveniently, for ex. $x_a,x_m,x_d$? ($a,m,d$ are not integers anymore). Would writing something like $x_i \le 20\ (i\in\{a,m,d\})$ be incorrect?

1

There are 1 best solutions below

3
On BEST ANSWER

What you wrote is correct. Another option is to let $I=\{a,m,d\}$ and then write the constraints as $x_i \le 20$ for $i\in I$.