# Reformulating to locate the second largest decision variable of a set of decision variables

Consider a set of $$A_{vn}$$ decision variables such that $$A_{v1},A_{v2},\cdots,A_{vn}. While this is the standard formulation finding the maximum value of $$A_{vn}$$, I would also like to find the second largest $$A_{vn}$$ of this set of decision variables.

• Are the $n$ values known to be distinct? If not, what is the desired behavior if there is a tie for largest? – RobPratt Sep 9 '20 at 3:46
• Yes and no unfortunately, of all of them, only either one or two of them are to be non-zero, i.e., the others are to be zero. Additionally, all of them are integers that are to be greater or equal to zero. Lastly, the two non-zero variables might also be equal, though they should be unequal most of the time. Sorry for the initial omission of such information. Thank you! – Mike Sep 9 '20 at 3:54
• Then just take the sum of all of them and subtract the largest. – RobPratt Sep 9 '20 at 4:00
• Dear Dr Rob, Thank you very much! – Mike Sep 9 '20 at 6:35