I have 5 decision variables (say) x1 - x5, lower bound for each = 5, and upper bound for each = 30 and they are allowed to take only integer values. These decision variables are leveraged to calculate gross margin (via some function), and objective function is to maximize gross margin.
Now, while choosing optimal values for x1 - x5, I have a constraint that I should not have more than 2 (say) distinct values for x1 - x5.
Can anybody please help me as to how I can formulate the above constraint, i.e. count of distinct decision variables values <= 2. I am trying to build the program in pyomo.
Thank you.