Is it possible to model these binary variables in CVX? (MILP)

Hi everybody
Let t_1, \dots, t_n be n binary variables.
Is there any way in CVX to map each of the 2^n combinations of these variables to a unique entry of a vector, say \mathbf{v}, of length 2^n.
The reason I am asking this is simple. Having n variables instead of 2^n.

You could do a binary expansion, sum(2^i * t(i)), which is a valid CVX affine expression in the binary variable t. But what do you want to do with the mapping? I’m not sure you’ll accomplish anything useful. You can’t use this CVX expression as an index of ether a MATLAB or CVX variable.

1 Like

This what I am exactly looking for. I have a given cost vector, say \mathbf{v}, of length 2^n whose elements correspond to each of the combinations of n binary variables. I wanted to use merely n binary variables to map to the vector \mathbf{v} to minimize the objective, instead of using 2^n variables. That would be a huge reduction in size of the variables.
Yes, I know it is not possible to use as index. It could be possible to use t_1, \dots, t_n and carefully shift a 1 in an all-zero binary vector, say \mathbf{e}, to find the index, and then do \mathbf{e} . * \mathbf{v}, but the operation becomes non-linear for n \geq 3 as the variables have to be multiplied by each other.
I wondered if there is any special technique for that in CVX environment.

You may be searching for fool’s gold in your quest to reduce from 2^n to n binary variables.

If you can figure out how to do what you want using anything in sections 2 or 3 of http://www.fico.com/en/node/8140?file=5125 , you should be able to implement it in CVX using the MIDCP capability.

1 Like

Many thanks Mark!
I will try it.