How to solve the error "model.Q not representable "
回答済みHallo,
I'm using Gurobi's implementation of QP in Matlab and when calling the solver, I get this error message in Matlab:
"Error using gurobi_write
model.Q not representable "
I guess the problem is too big. Because the model is OK, when the Q matrix is smaller (6923 rows and 6923 columns). And I get the problem only after I changed the model with a 77456 × 77456 matrix Q and 25366 constraints.
I have tried to find solution in google or in the Gurobi documentation. There is only one similar issue announced before, which explained the issue but did not provide any specific measures (https://support.gurobi.com/hc/en-us/community/posts/4408451342993-Matlab-Error-model-A-is-not-representable-), and suggested to "Increasing this limit is currently registered as a feature request."
I wonder what is the maximum limit of the matrix Q, is it because my matrix Q is too big?
More important, is there any suggestions to solve the problem.
The code is attached as follow:
modelc.varnames = names;
modelc.modelsense = 'minimize';
modelc.Q = sparse(covX_reg);
modelc.obj = zeros(num_stocks,1);
modelc.lb =zeros(num_stocks,1);
modelc.ub =MaxBound;
modelc.A = sparse([ones(1,num_stocks);ExpectReturn;Constraints;coefficient]); %
modelc.rhs = [1 target_return bee' Crops_Production'];
modelc.sense = ['<' '='];
[p,q]=size(Constraints);
e='<';
Con_sense=repmat(e,1,p);
modelc.sense = [modelc.sense Con_sense];
[i,j]=size(Crops_Production);
c='>';
Pro_sense=repmat(c,1,i);
modelc.sense = [modelc.sense Pro_sense];
params.DualReductions=0;
gurobi_write(modelc, 'qp.lp');
resultc = gurobi(modelc);
Thank you in advance !
-
Hi Cai,
I wonder what is the maximum limit of the matrix Q, is it because my matrix Q is too big?
The maximum limit of nonzeros for matrix Q is currently 2 billion (\(2\cdot 10^9\)). If you want to construct and solve models with more than 2 billion nonzeros, you currently have to use the C API and the corresponding \(\texttt{X}\) functions, e.g., GRBXaddconstrs.
Best regards,
Jaromił0
サインインしてコメントを残してください。
コメント
1件のコメント