CVX has employed the mosek solver to solve the MILP. While in MILP, there exists a special ordered set (SOS), which is quite useful for coverting the MINLP (mixed-integer nonlinear program) into a standard MILP. Thus, I’m writing to ask how to specify such kinds of vectors in CVX?

For example, if in the problem, some varoables can only take one values in a set {a1, a2, a3, a4}, how to present this?

Thank your very much. For the SOS, you may refer to the following link on wiki.

The constaint I want to express is shown in the following: where v_i and u_{i,p} are SOS1 but the non-zero elements are not necessary 1, and can be e.g., integers less than 20. The v’i and u’{i,p} are binary SOS1 vectors. Thus, can anyone help on how to express this constraints in CVX? Thanks.

Thanks for the reply. How can I declare a vector, in which only one entry is an integer and the other entries are all zero in CVX？or can this be achieved by using some constraints?

Btw, how to specify the range of the integer variables? For example, if the non-zero entry can only choose from [ 2 3 5 9].

Thank you very much for your reply. I know that for the binary SOS1 vector, it is easy to use the trick as your mentioned to express. While, currently, I met a problem with two vector variables: say x1 and x2 having the same length. In my problem, they have the different non-zero values at the same index, like [0 a1 0 0] and [0 1 0 0]. As a1 is an integer and also an optimziation variable, I do not knw how how to express x1. Could you help on this issue ?

The constaint I want to express is shown in the following: where v_i and u_{i,p} are SOS1 but the non-zero elements are not necessary 1, and can be e.g., integers less than 20. The v’i and u’{i,p} are binary SOS1 vectors. Thus, can anyone help on how to express this constraints in CVX? Thanks.