Consider a decision variable in a MILP constrained:
$$\sum_i p_i = 1$$
$$p_i\ \in \{0, 1\}$$
Obviously one element in $p$ is 1 and all others are 0. How can I set a decision variable to the index i of the element $p_i$ = 1?
I think I can do this by multiple if-then-else constraints but that's a bit clunky.