# Formulating indicator constraint set

I am having difficulty formulating the indicator constraints for the following:

Consider a set of $$A_{n}$$ decision variables such that $$A_{1},A_{2},⋯,A_{n}. While all of them are integers that are either equal or greater than zero, only either one or two of them are to be non-zero, i.e., the others are to be zero. Additionally, the two non-zero variables might also be equal, though they should be unequal most of the time.

Let $$A_{max}$$ be the maximum value, while $$A_{max2nd}$$ be the second largest.

$$A_{max2nd}$$=$$\sum\limits_{i}A_{i}-A_{max2nd}$$

Let $$A_{v'}$$ and $$A_{v}$$ be two decision variables that whose values are dependant on the value of $$\alpha_{i,j}$$

Let $$\alpha_{i,j}$$ be a binary variable linking $$A_{i}$$ and $$A_{j}$$ such that

$$\sum\limits_{(i,j)}\alpha_{i,j}\le1$$

$$\alpha_{i,j}=1$$ $$\implies$$ $$A_{v'}=A_{max}$$ and $$A_{v}=A_{max2nd}$$ for any pairs of $$i, j\in N$$

if no $$\alpha_{i,j}$$ is equal to 1, then

$$\sum\limits_{(i,j)}\alpha_{i,j}=0$$ $$\implies$$ $$A_{v}=A_{max}$$ and $$A_{v'}=0$$ (as $$A_{max2nd}$$ and the other $$A_{n}$$s are 0, other than $$A_{max}$$ which must always always be present)

Appreciate your kind guidance in creating the constraints.

Thank you!

Do you mean $$i$$ and $$j$$ instead of $$v$$ and $$v’$$?
If so, the constraints you want are $$\alpha_{i,j}\le A_i$$ and $$\alpha_{i,j}\le A_j$$.
• Dear Dr Rob, thank you for your reply. i, j are more like place holders for any one of the As, were just used to indicate that the As are in running sequence, while v', v are two specific instances for As that are affected by the binary variable $\alpha_i,j$. Thank you. – Mike Sep 9 '20 at 13:19