I want to optimize a binary integer programing problem. There is a vector variable z and a matrix variable x. All I want to do is to find out the optimal solution of z and x to get the minimal objective.
There is each value for each combination of x and z. The following is a simple version of my problem. While when I write
w = [1,2,3,4,5,6,7,8,9];
cvx_begin
variable z(2) binary
variable x(2) binary
expression f
f = z(1)*z(2)*(x(1)*x(2)*w(1)) + z(1)*(1-z(2))*(x(1)*x(2)*w(2)+x(1)*(1-x(2))*w(3)) + ...
z(2)*(1-z(1))*(x(1)*x(2)*w(4)+x(2)*(1-x(1))*w(5)) + ...
(1-z(1))*(1-z(2))*( x(1)*x(2)*w(6)+x(1)*(1-x(2))*w(7)+x(2)*(1-x(1))*w(8)+(1-x(1))*(1-x(2))*w(9));
minimize(f);
cvx_end
Then, error emerges shown as
Error using .* (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.
It seems that the multiplication of x and z doesn’t follow the DCP rule, while I cannot find any way to write this correctly. Does anyone have any ideas about this?