I want to express z(i,j)=abs(xi-xj) for which the following code I have written. Here y(i,j) is declared as binary variable. I am solving in CVX_sedumi solver which do not accomodate binary variables. Any suggestion?

Thanking you.

for i=1:n

for j=1:n

if(i<=j)

z(i,j)>=x(i)-x(j);

z(i,j)<=x(i)-x(j)+2*(y(i,j));

z(i,j)>=x(j)-x(i);

z(i,j)<=x(j)-x(i)+1*(1-y(i,j));

y(i,j)>=0; y(i,j)<=1;

end

end

end

An indentical post is at https://www.or-exchange.org/questions/8393/handling-binary-variables-in-sedumi-solver