When I was trying to solve a very simple bin packing problem, the Gurobi solver just won't work. I do try some very simple optimization problem with 1 inequality constraint with Gurobi and it works. But it always return NA for little complicated ones. I am quite frustrated. Highly appreciate for help if anyone can help
%% By Linear programming
clear;clc;
weight = [4,4,5,7]';
cvx_begin
cvx_solver SDPT3
variables I(4,1) X(4,4)
minimize sum(I)
subject to
X * weight <= 10 * I;
sum(X) == [1,1,1,1];
X >= 0
X <= 1
I >= 0
I <= 1
cvx_end
X
I
%% By Integer programming
clear;clc;
weight = [4,4,5,7]';
cvx_begin
cvx_solver Gurobi
variables I(4,1) X(4,4)
minimize sum(I)
subject to
X * weight <= 10 * I
sum(X) == [1,1,1,1]
X >= 0
X <= 1
I >= 0
I <= 1
cvx_end
X
I
And this is the error message
Calling Gurobi 9.00: 44 variables, 28 equality constraints
------------------------------------------------------------
------------------------------------------------------------
Status: Error
Optimal value (cvx_optval): NaN
Error using cvx_end (line 267)
model.quadcon must be a struct array with fields q, and rhs
Try use these commands instead of Gurobi solver
or
Seems using Gurobi as external solver of cvx is not a wise choice. See: http://ask.cvxr.com/t/cvx-with-gurobi-error-warning/7072/3. They have reported the bug a few months ago.