# Solving MISCOP using CVX

Hi,

Given a MISCOP problem which was solved using Gurobi. Does this mean we can solve this MISOCP problem using CVX by setting cvx_solver Gurobi?
I have academic licenses for both CVX and Gurobi and both are running properly.

Regards.
Ahmed

Hi,
I’m trying to solve the following MISCOP problem. This problem has been solved using Gurobi optimizer according to the following paper ref section 4.1.
The probelm is formulated as follows
\text{min.}\ \ \sum_{i\in\mathcal{N}} P_i
\text{s.t.} \ \ \ \ \ \ \ x_{0,1} x_{0,2}\geq x_{1,1}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{0,3} x_{0,4}\geq x_{1,2}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{0,5} x_{0,6}\geq x_{1,3}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{0,7} x_{0,8}\geq x_{1,4}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{1,1} x_{1,2}\geq x_{2,1}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{1,3} x_{1,4}\geq x_{2,2}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{2,1} x_{2,2}\geq x_{3,1}^2
\ \ \ \ \ \ \ \ \ \ \ \ x_{3,1}\geq 2^{C/N}
\ \ \ \ \ \ \ \ \ \ \ \ x_{0,i} =1+y_is_{i}^2, \ \ \ i\in\mathcal{N}
\ \ \ \ \ \ \ \ \ \ \ \ x_{j,m}\geq 0 \ \ \ j=0,..,3 , \ \ \ \ m=1,...2^{3-j}
\ \ \ \ \ \ \ \ \ \ \ \ \sum_{i\in\mathcal{N}} P_is_i^2-y_is_i^2\geq E
\ \ \ \ \ \ \ \ \ \ \ \ 0 \leq y_i \leq P_i \leq P_{max}
\ \ \ \ \ \ \ \ \ \ \ \ y_i\leq \pi_i P_{max},\ \ y_i\geq P_i-(1-\pi_i)P_{max} ,\ \ \pi_i \in \{0,1\}

where \mathcal{N}=\{1,\ldots,8\} and s_i is the i-th singular value of a matrix \mathbf{H} \in \mathbb{R}^{8\times 8}

I’m trying to solve via CVX via the following code:
N=8; H=randn(N);
s=svd(H);l=s.^2;
C=10;E=5;
Pmax=2;
P_UB=Pmax*ones(N,1);
P_LB=zeros(N,1);k=0;
cvx_solver Gurobi
cvx_begin
variables P(N) y(N) x0(N) xn(N-1)
variable w(N)
x0=1+l.*y;
minimize sum _P
subject to
xn>=zeros(N-1,1);
for ii=1:2:N
x0(ii)*x0(ii+1)>=xn(k+1);
k=k+1;
end
xn(1)*xn(2)>=xn(5)^2;
xn(3)*xn(4)>=xn(6)^2;
xn(5)*xn(6)>=xn(7)^2;
xn(7)>=2^(C/N);
sum(P.*l-y.*l)>=E;
P_LB<=y<=P<=P_UB;
y<=w.*P_UB;
y>=P-(1-w).*P_UB;
cvx_end

but I have the following errors:
Error using .* (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

Error in * (line 36)
z = feval( oper, x, y );

Error in svd1_cvx (line 19)
x0(ii)*x0(ii+1)>=xn(k+1);

Hi,
I have modified the code to be like this:
N=8; H=randn(N);
s=svd(H);l=s.^2;
C=10;E=5;
Pmax=1000;
P_UB=Pmax*ones(N,1);
P_LB=zeros(N,1);k=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cvx_solver Gurobi
cvx_begin
variables P(N) y(N)
variable w(N) binary
expressions x0(N) xn(N-1)
%x0=1+l.*y;

minimize sum §
subject to
xn>=zeros(N-1,1);
x0>=ones(N,1)
for ii=1:2:N
x0(ii)*x0(ii+1)>=xn(k+1);
k=k+1;
end
xn(1)*xn(2)>=xn(5)^2;
xn(3)*xn(4)>=xn(6)^2;
xn(5)*xn(6)>=xn(7)^2;
xn(7)>=2^(C/N);
sum(P.*l-y.*l)>=E;
x0=1+y.*l;
for jj=1:N
P_LB(jj)<=y(jj)<=P(jj)<=P_UB(jj);
y(jj)<=w(jj).*P_UB(jj);
y(jj)>=P(jj)-(1-w(jj)).*P_UB(jj);
end
cvx_end

I got the following output:

Calling Gurobi 7.01: 51 variables, 27 equality constraints

Gurobi optimizer, licensed to CVX for CVX
Optimize a model with 27 rows, 51 columns and 99 nonzeros
Variable types: 43 continuous, 8 integer (8 binary)
Coefficient statistics:
Matrix range [9e-03, 1e+03]
Objective range [1e+00, 1e+00]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 5e+04]
Presolve removed 0 rows and 27 columns
Presolve time: 0.00s

Explored 0 nodes (0 simplex iterations) in 0.03 seconds
Thread count was 1 (of 4 available processors)

Solution count 0
Pool objective bound 0

Model is infeasible or unbounded

Best objective -, best bound -, gap -

Status: Failed
Optimal value (cvx_optval): NaN

I’m sure the problem is feasible, but I guess the reason of the failure because the problem is unbounded. How can I fix this?

Thanks

Ahmed

Hi again,
I have managed to solve this problem via this code

N=8; H=randn(N);
s=svd(H);l=s.^2;
C=10;E=5;
Pmax=2;
P_UB=Pmax*ones(N,1);
P_LB=zeros(N,1);k=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

cvx_begin
cvx_solver Gurobi_2
variables P(N) y(N)
variable w(N) binary
expression x0(N)
x0=1+l.*y;
minimize sum§
subject to

geo_mean(x0)>=2^(C/N);
sum(P.*l-y.*l)>=E;

for jj=1:N
P_LB(jj)<=y(jj)<=P(jj)<=P_UB(jj);
y(jj)<=w(jj).*P_UB(jj);
y(jj)>=P(jj)-(1-w(jj)).*P_UB(jj);
end
cvx_end

as you can see the first 7 constraints associated with x_{i,j} converted to geo_mean(x0)>=2^(C/N) so no need to go through all these 7 constraints.

Thanks
Ahmed