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}<A$. 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.


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


$\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$.

  • $\begingroup$ 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. $\endgroup$ – Mike Sep 9 '20 at 13:19
  • $\begingroup$ Dear Dr Rob, yes, It was a typo. Thank you! $\endgroup$ – Mike Sep 10 '20 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.